Skip to content
Français

Configure Claude Code

Run Claude Code with account access or an API key and select its model settings.

The agent image contains Claude Code. Remote sandboxes install claude if it is missing before the first turn; local host execution uses the executable already on your PATH.

  • Pinned versionThe image and remote installation use @anthropic-ai/claude-code at the version in agentVersions.claude.
  • Remote installationnpm installs it under ~/.outpost-tools in the sandbox.
  • Image onlybootstrap: false on dispatch() or createSandbox() skips installation; the image must provide claude.

Run claude, then /login, on the host. authentication: "account" copies the subscription login from ~/.claude/.credentials.json (or $CLAUDE_CONFIG_DIR/.credentials.json) into the sandbox’s private home.

import { createAgent, createClaudeHarness } from "@elie-laloum/outpost";

const coder = createAgent({
  harness: createClaudeHarness({ authentication: "account" }),
});

On macOS, Claude Code keeps its login in the keychain by default, and Outpost never reads a keychain. Run claude setup-token instead and pass the printed token as a variable. It uses your Pro, Max, Team or Enterprise plan.

import { createAgent, createClaudeHarness } from "@elie-laloum/outpost";

const coder = createAgent({
  harness: createClaudeHarness({
    authentication: { account: { variable: "CLAUDE_CODE_OAUTH_TOKEN" } },
    variables: {
      CLAUDE_CODE_OAUTH_TOKEN: process.env.CLAUDE_CODE_OAUTH_TOKEN ?? "",
    },
  }),
});

Choosing between account and API access, and where credentials go: Authentication. Vendor requirements: Claude Code authentication.

authentication: "usage" passes ANTHROPIC_API_KEY. Requests are billed to your Anthropic API account, not to a subscription.

import { createAgent, createClaudeHarness } from "@elie-laloum/outpost";

const coder = createAgent({
  harness: createClaudeHarness({
    authentication: "usage",
    variables: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ?? "" },
  }),
});

Omit model to use Claude Code’s default. A model object adds an effort level and an output limit.

import { createAgent, createClaudeHarness } from "@elie-laloum/outpost";

const coder = createAgent({
  harness: createClaudeHarness({
    authentication: "account",
    partialMessages: true,
  }),
  model: { name: "sonnet", reasoning: "high", maxOutputTokens: 32_000 },
});

API reference: ClaudeSettings and AgentModel.

  • One credential: Declaring ANTHROPIC_API_KEY with account access, or CLAUDE_CODE_OAUTH_TOKEN with API access, fails before the turn starts.
  • Permissions: Without permissions, headless turns run with --dangerously-skip-permissions. The sandbox, not the permission mode, is the isolation boundary.
  • Duplicate settings: Set maxOutputTokens or a CLAUDE_CODE_MAX_OUTPUT_TOKENS variable, not both.

API: createClaudeHarness · ClaudeSettings · createClaudeConversations · AgentAuthentication.