Requirements
- Claude Code, installed and working.
- Python 3.10 or later, with
pipor uv. - A Together API key.
Step 1: Install LiteLLM
Install the proxy withpip or uv:
Step 2: Export your Together API key
LiteLLM reads the key fromTOGETHERAI_API_KEY, not TOGETHER_API_KEY like the Together SDKs. Set it in your terminal before starting:
Step 3: Configure the proxy
Define your models in aconfig.yaml. Prefix each Together model ID with together_ai/, and give each model a short alias to pass to Claude Code. Any model from the serverless catalog works:
config.yaml
Step 4: Start the proxy
Start the server:Step 5: Connect Claude Code
In the same terminal, point Claude Code at the proxy and pass an alias from your config:ANTHROPIC_AUTH_TOKEN, so any value works. Setting it lets Claude Code run without an Anthropic login. If you’re logged in to Claude Code, you can omit it.
Claude Code starts as usual, with every request going through the proxy to the Together API.
Claude Code is now running on GLM 5.3, served by Together AI through your own gateway.
Secure the proxy (optional)
A master key makes the proxy require a key on every request. Set one before exposing the proxy beyond your machine, since anyone who can reach an unauthenticated proxy can spend on your Together account. The master key is a secret you make up, not a key issued by Together or LiteLLM:config.yaml
ANTHROPIC_AUTH_TOKEN for Claude Code, and as a Bearer token for direct calls to the proxy. To give other people their own keys and budgets instead of sharing the master key, create virtual keys, which also require a Postgres database.
Troubleshooting
Requests fail withNo connected db: The proxy has a master key configured and the token you passed doesn’t match it. This usually means LITELLM_MASTER_KEY is unset or has a different value in the terminal where you ran claude or curl. Export the value the proxy started with and try again.
The proxy logs Invalid model name passed in model=claude-sonnet-5: Something in your session, such as a subagent pinned to Anthropic’s sonnet alias, requested a model that isn’t in your model_list. Claude Code keeps working, but those requests fail. To route the aliases to a Together model, export ANTHROPIC_DEFAULT_SONNET_MODEL=glm-5.3 (and the matching OPUS and HAIKU variables) before starting Claude Code.
Next steps
TogetherLink
Run Claude Code on Together models without hosting a proxy.
Serverless models
Browse every model you can serve through the proxy.
OpenAI compatibility
See how the Together API maps to OpenAI’s format.
Third-party integrations
Use Together through other partner SDKs and gateways.