Claude code (IS_SANDBOX=1 claude --dangerously-skip-permissions) doesn't work?

See title.

After exporting the api token and url for KIMI K2, claude faills to accept env variables with the:

IS_SANDBOX=1 claude --dangerously-skip-permissions

command. Thus, I have to accept all edits in the claude code cli, which is a huge waste of time. Help?

Could you please provide a more detailed reproduction? I was unable to reproduce your problem.

when i export the token and url, it usually works fine as a standard bash user for sandbox and dangerously skip permissions (not right now, as i’m getting a connectivity error, wondering if the api is even up). however, when i run it as root, it doesn’t pick up my exported api key or url, it defaults to my claude.ai config (anthropic), which i have no idea where that’s stored.

so:

unset ANTHROPIC_AUTH_TOKEN
export ANTHROPIC_BASE_URL=https://api.moonshotai/anthropic
export ANTHROPIC_AUTH_TOKEN=sk-MY_MOONSHOT_K2_API_KEY
IS_SANDBOX=1 claude --dangerously-skip-permissions

works fine as a standard user, but not as root. i’d like to run it as root.

IS_SANDBOX=1 claude --dangerously-skip-permissions

▐▛███▜▌ Claude Code v2.0.36
▝▜█████▛▘ Sonnet 4.5 · API Usage Billing
▘▘ ▝▝ /home/trading

/status
⎿ Status dialog dismissed

what is the time and date?
⎿ Unable to connect to API due to poor internet connection
Retrying in 4 seconds… (attempt 5/10)

✶ Whatchamacalliting… (esc to interrupt)

not connecting at all right now, everything else works (on the same virtual machne)

i think i found the solution:

unset ANTHROPIC_AUTH_TOKEN
export ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic
export ANTHROPIC_AUTH_TOKEN=sk-MY-API-KEY
export API_TIMEOUT_MS=600000
export ANTHROPIC_MODEL=Opus
export ANTHROPIC_SMALL_FAST_MODEL=Haiku
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
IS_SANDBOX=1 claude --dangerously-skip-permissions

as root seems work just fine
appreciate your time

I suspect that your environment variables changed when you su root.
BTW, use one line command may always works.

ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic ANTHROPIC_AUTH_TOKEN=sk-MY-API-KEY API_TIMEOUT_MS=600000 ANTHROPIC_MODEL=kimi-k2-turbo-preview ANTHROPIC_SMALL_FAST_MODEL=kimi-k2-turbo-preview CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 IS_SANDBOX=1 claude --dangerously-skip-permissions

what’s odd is that sometimes in claude code, the api completely stops. not sure how else to describe it. no errors, no issues, it starts running my instructions, then just halts with no output and a ready prompt. super odd. i ask it to “continue” and it does, for a few seconds, then stops again.