llm-gateway.md +29 −8
1# LLM gateway configuration1# LLM gateway configuration
2 2
33> Learn how to configure Claude Code with LLM gateway solutions, including LiteLLM setup, authentication methods, and enterprise features like usage tracking and budget management.> Learn how to configure Claude Code to work with LLM gateway solutions. Covers gateway requirements, authentication configuration, model selection, and provider-specific endpoint setup.
4 4
55LLM gateways provide a centralized proxy layer between Claude Code and model providers, offering:LLM gateways provide a centralized proxy layer between Claude Code and model providers, often providing:
6 6
7* **Centralized authentication** - Single point for API key management7* **Centralized authentication** - Single point for API key management
8* **Usage tracking** - Monitor usage across teams and projects8* **Usage tracking** - Monitor usage across teams and projects
10* **Audit logging** - Track all model interactions for compliance10* **Audit logging** - Track all model interactions for compliance
11* **Model routing** - Switch between providers without code changes11* **Model routing** - Switch between providers without code changes
12 12
13## Gateway requirements
14
15For an LLM gateway to work with Claude Code, it must meet the following requirements:
16
17**API format**
18
19The gateway must expose to clients at least one of the following API formats:
20
211. **Anthropic Messages**: `/v1/messages`, `/v1/messages/count_tokens`
22 * Must forward request headers: `anthropic-beta`, `anthropic-version`
23
242. **Bedrock InvokeModel**: `/invoke`, `/invoke-with-response-stream`
25 * Must preserve request body fields: `anthropic_beta`, `anthropic_version`
26
273. **Vertex rawPredict**: `:rawPredict`, `:streamRawPredict`, `/count-tokens:rawPredict`
28 * Must forward request headers: `anthropic-beta`, `anthropic-version`
29
30Failure to forward headers or preserve body fields may result in reduced functionality or inability to use Claude Code features.
31
32## Configuration
33
34### Model selection
35
36By default, Claude Code will use standard model names for the selected API format.
37
38If you have configured custom model names in your gateway, use the environment variables documented in [Model configuration](/en/model-config) to match your custom names.
39
13## LiteLLM configuration40## LiteLLM configuration
14 41
15<Note>42<Note>
129export CLOUD_ML_REGION=us-east5156export CLOUD_ML_REGION=us-east5
130```157```
131 158
132### Model selection
133
134By default, the models will use those specified in [Model configuration](/en/third-party-integrations#model-configuration).
135
136If you have configured custom model names in LiteLLM, set the aforementioned environment variables to those custom names.
137
138For more detailed information, refer to the [LiteLLM documentation](https://docs.litellm.ai/).159For more detailed information, refer to the [LiteLLM documentation](https://docs.litellm.ai/).
139 160
140## Additional resources161## Additional resources