- To deploy a gateway for your organization, see Roll out an LLM gateway
- For what Claude Code sends to a gateway, see the gateway protocol reference
Check for an existing configuration
Administrators can distribute the gateway address and credential through managed settings, device management, or anapiKeyHelper, so Claude Code picks them up at startup with nothing for you to set. To check whether your organization already did this:
1
Start Claude Code
Run
claude. If it opens to the login screen instead of a session, no gateway credential was distributed; configure it yourself below.2
Check the Status tab
If Claude Code started a session without showing the login screen, run
/status, which opens on the Status tab, and check two lines:Anthropic base URL: this line only appears when a gateway address is set. If it isn’t there, Claude Code isn’t pointed at the gateway; configure it yourself below.Auth tokenorAPI key: a line namingANTHROPIC_AUTH_TOKEN,ANTHROPIC_API_KEY, or anapiKeyHelperconfirms a gateway credential is active. ALogin methodline naming a claude.ai account instead means the credential wasn’t distributed; set it yourself.
3
Send a test message
Close the
/status menu and send any prompt in Claude Code. A normal response from Claude, with no error, confirms the gateway connection works./status menu look right but the message to Claude fails, see the troubleshooting table.
Configure Claude Code yourself
To configure Claude Code for the gateway yourself, you need from your gateway team:- The gateway’s base URL
- A credential: a key or token string, or a command that fetches one
- If your gateway team didn’t say which kind of credential it is, the credential variable section below covers what to try
- Set the credential variable and set the base URL: the two variables every gateway connection needs
- Verify the connection: confirm it works before persisting anything
- Configure each surface: if you are using a surface besides the Claude Code CLI, such as VS Code, see how to configure it with your gateway credentials
- Additional configuration: variables some gateways need beyond the base URL and credential, such as a custom header, a credential helper, model discovery, a provider-format base URL, or turning off traffic outside the gateway path. Set these only if your administrator named them or your network restricts egress
Set the credential variable
To authenticate Claude Code to the gateway, set your credential in an environment variable. Which variable depends on what your gateway team told you:
If you weren’t told which kind, use