Skip to content

Claude Code

Run Claude Code in a box with a masked Claude subscription token or Anthropic API key, or a login that stays in the guest.

Updated

Claude Code is Anthropic’s coding agent CLI. abx installs @anthropic-ai/claude-code 2.1.334 from npm into the image and runs it in the box. Use this page to choose how Claude Code authenticates and to launch it.

Launch

abx claude <box>

abx runs claude --dangerously-skip-permissions in the guest. A new conversation passes --session-id, and an existing one passes --resume. Arguments after -- go to Claude Code:

abx claude review -- --model claude-sonnet-5-5

With the anthropic/login mode, abx claude <box> -- auth ... runs claude auth ... on its own, outside a conversation, so you can sign in or check the login.

Authentication

Mode Access What it does
anthropic/oauth-token masked The default. A host-managed Claude subscription token from claude setup-token. The guest gets a handle bound to api.anthropic.com, not the token.
anthropic/api-key masked A host-managed Anthropic API key. The guest gets a handle bound to api.anthropic.com, not the key.
anthropic/login global, local You run claude auth login in the box, and Claude Code keeps and renews the login there.

Subscription token (masked)

Create a token on your own machine, where you are signed in to Claude with a Pro or Max subscription, then save it:

claude setup-token
abx auth set claude
abx auth verify claude
abx claude review

claude setup-token prints a sk-ant-oat… token that is valid for one year and is not saved anywhere. abx auth set claude with no --mode selects this mode and prompts for the token on the terminal, storing it in the OS keyring. To keep it in a password manager instead, pass --from:

abx auth set claude --from 'op://Development/Anthropic/oauth-token'

The token never enters the box. Claude Code receives CLAUDE_CODE_OAUTH_TOKEN set to an opaque handle, and smolvm swaps in the real token only on requests to api.anthropic.com. A token from setup-token can only run model requests: it cannot use claude.ai connectors, Remote Control or other features that need a full login.

The token does not renew. When it expires or you revoke it, model requests fail with an authentication error, while abx auth status still shows the mode as verified, because verification checks the route, not the token’s lifetime. To rotate it, create a new one with claude setup-token, save it again with abx auth set claude (or update the password manager entry), and push it to a running box with abx auth refresh <box> claude. Stopped boxes pick it up when they start.

API key (masked)

abx auth set claude --mode api-key --from 'op://Development/Anthropic/api-key'
abx auth verify claude
abx claude service-task

--from takes a secret provider URI. Without it, abx prompts for the key on the terminal and stores it in the OS keyring. See Secret providers.

Subscription login (global or local)

Sign in inside the box. With --access global, a named profile carries the login between boxes. A shared profile holds only the Claude subscription entry (claudeAiOauth in ~/.claude/.credentials.json); other saved credentials, workspace approvals, transcripts and plugins stay with the box.

abx auth set claude --provider anthropic --mode login --access global
abx claude review --auth-profile personal -- auth login
abx claude review
abx stop review
abx claude followup --auth-profile personal

Exit Claude Code before abx stop review; stop refuses with box-busy while it is still running, and the profile stays with review until a clean stop. While the saved selection is global, creating a Claude box without --auth-profile NAME (or --access local) fails with Global access requires --auth-profile NAME when creating a box.

For a login that stays on one box, use local access:

abx claude isolated --access local -- auth login

--access local at launch works when no Claude mode is saved, or when the saved mode is anthropic/login. If you saved a token or an API key, as in the quickstart, save the login route first with abx auth set claude --provider anthropic --mode login --access local.

A guest login can be read by software in the box. See Access modes.

claude.ai connectors

The connectors you set up on claude.ai, such as Gmail, Google Drive or Google Calendar, can load in Claude Code as tools. They act with your account’s permissions on services outside the box, so abx keeps them off by default: unless connectors are enabled for an anthropic/login box, it sets ENABLE_CLAUDEAI_MCP_SERVERS=false for every Claude launch.

Only anthropic/login can load connectors. Tokens from claude setup-token and API keys lack the user:mcp_servers scope, so Claude Code skips connectors with those modes whatever abx allows.

Turn connectors on for every new Claude box, or for one box when you create it:

abx auth connectors claude on
abx claude review --access local --connectors -- auth login
abx claude review

--connectors and --no-connectors override the saved setting on the launch that creates a box. The box records the choice and keeps it; repeating the other flag later fails with fixed-option. With connectors on and anthropic/login, the box also allows mcp-proxy.anthropic.com, which serves connector tool calls. With any other mode abx prints a notice and allows nothing extra. abx auth status claude shows the saved setting, and abx ls lists the boxes that have it.

Verification

abx auth verify claude checks the token and API key modes with one claude --print turn on claude-sonnet-5-5, with tools, MCP, settings and session persistence off. The API key turn also passes --bare; the token turn cannot, because --bare ignores CLAUDE_CODE_OAUTH_TOKEN. It runs a real model request on your account: with a token it counts against your subscription’s usage, and with an API key it can incur charges. Guest logins need no verification. See Verification.

Notes

  • Claude Code’s transcripts (.claude/projects) are kept on the host with the box. abx raises Claude’s transcript retention in managed settings so the host copy is not deleted after 30 days.
  • With no saved login, a token or an API key, the box may reach api.anthropic.com. With a guest login it may also reach claude.ai, claude.com and platform.claude.com, and mcp-proxy.anthropic.com when connectors are on. Add other hosts with --allow. See Network policy.
  • If something in the box sets ANTHROPIC_API_KEY, Claude Code uses it instead of CLAUDE_CODE_OAUTH_TOKEN. abx never sets both.

Type to search…

↑↓ navigate↵ selectEsc close