Models, providers, and auth
This page maps the authentication and provider-selection surfaces visible in the extracted cli.js.
Source anchors
| Semantic alias | Source | Approximate location | String or symbol | Meaning |
|---|---|---|---|---|
| SdkCredentialInitializer | cli.js | line ~43, byte 0x264c0 | ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN | Embedded SDK credential initialization path. |
| RuntimeApiKeyLookup | cli.js | line ~407, byte 0x2c6284 | process.env.ANTHROPIC_API_KEY | Runtime API-key lookup helper. |
| BearerTokenHeaderPath | cli.js | line ~404, byte 0x2c0d1e | ANTHROPIC_AUTH_TOKEN | Bearer-token authorization header path. |
| BedrockProviderGate | cli.js | line ~253, byte 0x1ed452 | CLAUDE_CODE_USE_BEDROCK | Provider classifier branch. |
| AnthropicAwsProviderGate | cli.js | line ~253, byte 0x1ed4b6 | CLAUDE_CODE_USE_ANTHROPIC_AWS | Anthropic AWS provider branch. |
| MantleProviderGate | cli.js | line ~253, byte 0x1ed4f3 | CLAUDE_CODE_USE_MANTLE | Mantle provider branch. |
| VertexProviderGate | cli.js | line ~253, byte 0x1ed523 | CLAUDE_CODE_USE_VERTEX | Vertex provider branch. |
| MainModelEnvOverride | cli.js | line ~253, byte 0x20ed29 | ANTHROPIC_MODEL | Model selection environment variable. |
| SmallFastModelOverride | cli.js | line ~253, byte 0x20eb73 | ANTHROPIC_SMALL_FAST_MODEL | Small/fast model override. |
| ModelSelectionFlag | cli.js | line ~19525, byte 0xdc18e4 | --model <model> | Root model-selection flag. |
| FallbackModelFlag | cli.js | line ~19525, byte 0xdc1b54 | --fallback-model <model> | Print-mode fallback model flag. |
Provider selection
The provider classifier visible around Dq() uses environment gates to choose a provider family. Confirmed strings include:
| Provider family | High-signal env vars |
|---|---|
| First-party/default | absence of provider-specific gates; OAuth/API-key helpers still apply. |
| Bedrock | CLAUDE_CODE_USE_BEDROCK |
| Vertex | CLAUDE_CODE_USE_VERTEX |
| Foundry | CLAUDE_CODE_USE_FOUNDRY |
| Anthropic AWS | CLAUDE_CODE_USE_ANTHROPIC_AWS |
| Mantle | CLAUDE_CODE_USE_MANTLE |
The bundle also contains region/base URL surfaces such as AWS_REGION, AWS_DEFAULT_REGION, CLOUD_ML_REGION, and ANTHROPIC_BASE_URL.
Credential sources
flowchart TD Env[Environment variables] --> Auth[Credential resolver] KeyHelper[apiKeyHelper / keychain helper] --> Auth OAuthFd[CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR] --> Auth ApiFd[CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR] --> Auth SessionToken[CLAUDE_CODE_SESSION_ACCESS_TOKEN] --> Remote[Remote/session auth] Auth --> Provider[Provider request]Confirmed credential surfaces include:
ANTHROPIC_API_KEYANTHROPIC_AUTH_TOKENCLAUDE_CODE_OAUTH_TOKENCLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTORCLAUDE_CODE_API_KEY_FILE_DESCRIPTORapiKeyHelperenterpriseGateway
Model and budget flags
| Surface | Runtime implication |
|---|---|
--model <model> | Selects a model alias or concrete model for the session. |
ANTHROPIC_MODEL | Environment-level default model source. |
ANTHROPIC_SMALL_FAST_MODEL | Overrides the small/fast model used by helper paths. |
--fallback-model <model> | Enables a print-mode fallback when the default model is overloaded. |
--thinking, --thinking-display, --max-thinking-tokens | Controls thinking mode and legacy thinking-token budget. |
--max-budget-usd, --task-budget, --max-turns | Enforces budget/turn constraints in headless or task-like paths. |
--betas <betas...> | Adds beta headers for API-key users. |
For the detailed runtime model resolver, logical model roles, provider-call shape, retries, rate-limit events, usage accounting, quota probes, and billing/overage UI, see Model selection, calls, usage, quota, and billing.
Error and availability hints
The bundle contains model/provider error strings that point users toward --model or /model when a deployment lacks a requested model. This supports the interpretation that model choice is both a CLI flag and an interactive command surface.
Caveats
- The bundled Anthropic SDK documentation strings include many API examples. This page only treats strings as runtime evidence when they connect to env-variable lookup, root flags, or provider classifier code.
- Provider names and env gates are source-anchored for this build; behavior can change across package versions.
Related docs
Created and maintained by Yingting Huang.