Connect Claude Code
Configure environment variables to run Claude Code with platform models.
GoodPut AI implements the Anthropic Messages protocol, including streaming, tool calls, and reasoning content. Claude Code can use the platform directly as its gateway.
Configure environment variables
export ANTHROPIC_BASE_URL="https://api.goodputai.cn"
export ANTHROPIC_AUTH_TOKEN="YOUR_GOODPUT_API_KEY"
export ANTHROPIC_MODEL="z-ai/glm-5.2"
export ANTHROPIC_SMALL_FAST_MODEL="deepseek/deepseek-v4-flash"[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.goodputai.cn", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "YOUR_GOODPUT_API_KEY", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "z-ai/glm-5.2", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_SMALL_FAST_MODEL", "deepseek/deepseek-v4-flash", "User")If you previously configured ANTHROPIC_API_KEY, clear it to avoid a conflict with ANTHROPIC_AUTH_TOKEN.
Start
Open a new terminal and run claude.
Choose models
Both the primary and lightweight models can be any model in the catalog:
| Model | Suitable uses |
|---|---|
z-ai/glm-5.2 | Engineering tasks and Chinese-language work; a primary coding agent model served by our own infrastructure |
deepseek/deepseek-v4-pro | Flagship reasoning for complex tasks |
deepseek/deepseek-v4-flash | Fast and inexpensive; suitable for ANTHROPIC_SMALL_FAST_MODEL |
Without ANTHROPIC_MODEL, the platform automatically maps the Claude model names requested by Claude Code to compatible models, avoiding a missing-model error. Explicit selection is still recommended for predictable behavior.
Protocol compatibility
The gateway normalizes upstream differences, including signature compatibility in historical reasoning blocks and null content. No client adaptation is needed. /v1/messages/count_tokens is also available, so Claude Code can report context usage.
FAQ
Environment variable changes do not take effect
The terminal reads environment variables when it starts. After editing an rc file, open a new terminal, or run source ~/.zshrc, before starting claude.
How do I confirm that requests use GoodPut?
Run /status in Claude Code and check that the API Base URL is https://api.goodputai.cn.
Does web search work?
Yes. The platform’s search service handles Claude Code WebSearch requests. See web search.
Long tasks occasionally time out
The default per-request timeout is usually sufficient. If your own proxy chain has a shorter idle timeout, increase that proxy’s idle timeout to more than 600 seconds.