Selected models are free to useView free models

Which Claude Code Configuration Wins? An API Endpoint Conflict Map

Published Updated Data as of

By LanoX Research Team · Data checked 2026-11-23 (Asia/Dubai, UTC+4) · AI disclosure: This article was drafted with an AI writing program, and the LanoX Research Team then checked it against the official Claude Code documentation.

When an API endpoint appears in several places, which value does Claude Code use? The official documentation answers specific conflicts, but it does not put every configuration mechanism into one universal hierarchy. Settings-file precedence, environment-variable handling, credential selection, and model selection have distinct rules.

This map reflects the pages checked on November 23, 2026, in Dubai time. Intersections those pages do not resolve remain not stated. Credential priority is not treated as endpoint priority.

The official settings stack

The settings documentation states: “When the same key appears in more than one place, Claude Code uses the value from the highest level that sets it.”

Its order, highest precedence first, is:

  1. Managed settings
  2. Command-line JSON passed through --settings <file-or-json>
  3. Project-local settings: .claude/settings.local.json
  4. Shared project settings: .claude/settings.json
  5. User settings: ~/.claude/settings.json

The same page says nothing in your own settings files or --settings overrides a managed key. It also notes stricter-value exceptions for a few security-sensitive keys; those exceptions are not an endpoint rule here.

Two boundaries matter. Dedicated flags such as --model “aren't part of this stack”; the relevant settings-reference entry identifies which flags override a key. Environment variables are not a stack level either: shell-variable-versus-settings-key behavior is decided per pair. An env block inside a settings file, however, is an ordinary key and follows the settings levels above. These distinctions come from the settings page, not an inferred “CLI beats environment beats files” hierarchy.

ANTHROPIC_BASE_URL: the endpoint conflict

The environment-variable reference describes ANTHROPIC_BASE_URL as overriding the API endpoint to route requests through a proxy or gateway. The gateway connection page documents setting the gateway URL and credential variable either in the shell or in a Claude Code settings file.

Shell versus settings-file env

For the same variable in both places, the environment-variable page says the settings-file value applies “in most sessions”: Claude Code writes each env entry into its process environment, replacing the inherited shell value. The gateway page explicitly applies that rule to gateway configuration.

The environment-variable documentation states: “Between settings files, env values follow settings precedence, so a managed settings entry overrides the same variable in user or project settings.”

There is a documented launch-environment exception. The settings reference states: “When the Claude Desktop app or a self-hosted environment runner starts the session, the launch environment it builds takes precedence instead. Claude Code ignores an env value from a settings file for a variable that environment already sets.”

A separate host-routing rule also matters: when CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST is set, Claude Code ignores provider-selection, endpoint, and authentication variables—including ANTHROPIC_BASE_URL—in settings files. The environment-variable reference describes this for embedding host platforms; it does not identify CC Switch or LanoX as such a host.

Inspect the active configuration; distinguish reload from restart

The gateway connection page recommends /status to see which base URL and credential source Claude Code is using.

Timing is a separate question:

  • Shell changes: Claude Code reads shell variables at startup; changes apply the next time claude launches.
  • Settings-file `env` changes: values are reapplied to a running session when the file changes, subject to startup-only exceptions.
  • Removing a variable: removal does not unset it in an existing session; it takes effect at the next launch.

Those rules come from the environment-variable page. It identifies OpenTelemetry monitoring as an example of a feature retaining startup values until relaunch. The settings reference also specifies startup and live reapplication when saved changes alter merged env from user settings, --settings, and managed settings.

Shell exports reach only that terminal session and programs started from it. An editor started from the dock or Start menu will not see them; shell-only gateway exports also do not reliably reach supervisor-hosted background agents, according to the gateway page.

The same gateway page warns: “Don't put the credential in a project's .claude/settings.json. That file is committed and shared with everyone who clones the repository.” Official examples use placeholders such as https://llm-gateway.example.com and sk-gateway-key.

The documented empty-string workaround is narrower: setting a variable such as CLAUDE_CODE_USE_VERTEX to "" in env makes it unset for provider selection. Subprocesses still inherit the empty value. The documentation does not make this a general endpoint-reset rule.

Base URL without a gateway credential

The gateway documentation explicitly separates routing from authentication: with only ANTHROPIC_BASE_URL set and no gateway credential, requests still route through the gateway, but a saved claude.ai login remains the active credential. The subscription’s usage limits and billing apply.

Credential order is not endpoint order

The authentication page gives this credential-selection order:

  1. Cloud-provider credentials when CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX, or CLAUDE_CODE_USE_FOUNDRY is set
  2. ANTHROPIC_AUTH_TOKEN, sent as Authorization: Bearer
  3. ANTHROPIC_API_KEY, sent as X-Api-Key
  4. apiKeyHelper output
  5. CLAUDE_CODE_OAUTH_TOKEN
  6. Anthropic profile and federation credentials when named in ANTHROPIC_PROFILE; otherwise they rank below /login
  7. Subscription OAuth credentials from /login

For an API key, interactive mode prompts once for approval or rejection and remembers the choice; non-interactive mode (-p) always uses the key when present, as documented on the authentication page.

That page also states: “A signed-in Claude apps gateway session sits outside this list: it is a provider selection like Amazon Bedrock or Google Cloud's Agent Platform, and it outranks them.” When a gateway session exists, the CLI authenticates with the gateway token rather than the listed bearer token, API key, helper, or profile sources.

These are authentication rules—not evidence that one endpoint overrides another.

Model selection has its own order

The model configuration page lists model-selection priority as:

  1. /model <alias|name> during the session
  2. claude --model <alias|name> at startup
  3. ANTHROPIC_MODEL
  4. The settings-file model field
  5. ANTHROPIC_DEFAULT_MODEL for new sessions

Organizational restrictions still matter: the settings page says --model selects only among permitted models. A managed model is a starting default, not a lock; availableModels and deniedModels provide the locks. None of this establishes endpoint precedence.

Not stated in the official pages checked

  • Dedicated endpoint CLI flag: Whether such a flag exists, and whether it overrides another endpoint source, is not stated in the checked CLI reference, settings, and environment-variable pages.
  • CC Switch’s stack position: Its relationship to managed settings, --settings, files, or shell values is not stated. The LanoX guide does not identify where it writes configuration.
  • Base URL plus cloud-provider selection: Which endpoint receives requests when ANTHROPIC_BASE_URL coexists with Bedrock, Vertex, or Foundry selection is not stated. The authentication order does not resolve that endpoint intersection.
  • LanoX Base URL versus existing values: Which wins against existing shell or settings-file env values is not stated in the checked pages.

LanoX connection excerpts

From the live LanoX guide:

Select Claude Code in CC Switch and add a provider with your LanoX API key.

Use https://api.lanox.ai exactly. Do not include /v1 or a trailing slash.

After configuring the provider, fully quit Claude Code and reopen it to apply the new settings.

This article is LanoX-related backlink content; the product entry is LanoX.

These conclusions apply only to the pages and November 23, 2026 check times recorded here, not to later documentation or undocumented intersections.

FAQ

Which value wins when the same settings key is in several files?
The settings documentation states: “When the same key appears in more than one place, Claude Code uses the value from the highest level that sets it.” Highest first: managed settings, --settings, .claude/settings.local.json, .claude/settings.json, ~/.claude/settings.json.
Does a shell ANTHROPIC_BASE_URL beat the same variable in a settings-file env block?
For the same variable in both places, the environment-variable page says the settings-file value applies “in most sessions”: Claude Code writes each env entry into its process environment, replacing the inherited shell value.
How do I check which base URL Claude Code is using?
The gateway connection page recommends /status to see which base URL and credential source Claude Code is using.

Sources