- If youâre a developer connecting to an existing gateway: connect Claude Code to your gateway
- If youâre an admin rolling out a gateway for your organization: deploy and distribute a gateway
- If youâre configuring a gateway product: the gateway compatibility guide
What a gateway provides
A gateway gives your organization one place to manage:- Credentials: the provider key stays server-side; developers hold gateway credentials instead
- Usage tracking: attribute usage by developer or team, regardless of which provider serves the request
- Cost controls: enforce budgets and rate limits in one place
- Audit logging: log every model request for compliance
- Provider switching: change the provider in gateway configuration, without touching developer machines
Roll out a gateway
When youâre ready to roll out an LLM gateway to your organization, the sequence is the same whichever gateway product you choose:- Deploy the gateway and give it your provider credential, so it can authenticate the requests it forwards.
- Issue each developer a gateway credential, so usage is attributed to the developer and offboarding revokes one credential.
- Distribute the configuration through a managed settings file and your secrets tooling, so every machine receives the base URL and a credential. When both are distributed, developers donât configure anything. If you donât have settings distribution in place, developers follow the connect page to set the variables themselves.
- Have each developer check for the configuration in Claude Code, so distribution problems surface before they depend on the gateway.
ANTHROPIC_BASE_URL the only destination a managed machine may use, set allowedProviders to ["customEndpoint"] in the same managed settings file and put the gatewayâs ANTHROPIC_BASE_URL in that fileâs env block. Claude Code then refuses a session pointed anywhere else, including at Anthropic directly or at a developerâs own proxy, and accepts ANTHROPIC_BASE_URL only with the value you set there. For a gateway reached through a provider-specific endpoint variable such as ANTHROPIC_BEDROCK_BASE_URL, the allowedProviders entry says which variable to pin. Requires Claude Code v2.1.285 or later.
Subscriptions and gateways
While a gateway credential variable orapiKeyHelper is active, requests carry that credential in place of a developerâs claude.ai subscription login, and the subscriptionâs usage limits donât apply to them. Claude Code keeps a saved claude.ai login on the machine but doesnât send it with those requests. That traffic is billed per token to whoever owns the credential the gateway forwards, such as your organizationâs Anthropic Console account, or your Amazon Bedrock, Google Cloudâs Agent Platform, or Microsoft Foundry account when the gateway routes there.
ANTHROPIC_BASE_URL is the variable that points Claude Code at the gateway. Setting only that variable, without a gateway credential, doesnât replace the subscription. Requests still route through the gateway, but a saved claude.ai login remains the active credential, so its usage limits and billing apply. Gateways that pass this traffic on to Anthropic must forward the OAuth capability in anthropic-beta; see the request headers reference.
Related pages
- Gateway overview: how a gateway works and how to choose between Claude apps gateway and another product
- Claude apps gateway: Anthropicâs self-hosted gateway with SSO sign-in and OTLP telemetry
- Connect Claude Code to an LLM gateway: set the base URL and credential on your own machine, with per-surface configuration and a troubleshooting table
- Roll out an LLM gateway for your organization: the admin checklist for deploying a gateway, issuing developer credentials, and distributing managed settings
- Gateway compatibility guide: what Claude Code sends to a gateway, for operators configuring one, covering endpoints, headers to forward, and feature pass-through