ANTHROPIC_BASE_URL and a bearer token. SnapGen exposes POST /v1/messages and model discovery for this workflow.
Anthropic documents gateway connectivity but does not officially support
routing Claude Code to non-Claude models. SnapGen currently converts Claude
Messages requests to its GPT routes; retest after major Claude Code upgrades.
Prerequisites
- Install Claude Code and confirm
claude --versionworks. - Create a SnapGen API key and add prepaid balance.
- Choose a current text model, such as
gpt-5.4-miniorgpt-5.5.
Configure the current shell
ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY. SnapGen expects Authorization: Bearer ...; Claude Code sends that header for ANTHROPIC_AUTH_TOKEN.
Verify the gateway
Test the Messages endpoint before starting Claude Code.type: "message" and text under content[0].text.
Start Claude Code
/status inside Claude Code. Confirm that the Anthropic base URL is https://api.snapgen.org and the credential source is ANTHROPIC_AUTH_TOKEN.
Persist the configuration
Add the gateway variables to theenv object in ~/.claude/settings.json:
.claude/settings.json.
Troubleshooting
Claude Code shows a login screen
Claude Code shows a login screen
Start it from the shell where
ANTHROPIC_AUTH_TOKEN is exported, or place
the variables in the user-level ~/.claude/settings.json file.The model is missing from /model
The model is missing from /model
Set
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1, restart Claude Code, and
confirm that GET /v1/models returns the ID.A new Claude Code version sends unsupported fields
A new Claude Code version sends unsupported fields
Update the gateway when available. As a temporary diagnostic, set
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 and retry.Requests return 401
Requests return 401
Confirm the key is active and assigned to
ANTHROPIC_AUTH_TOKEN. A key in
ANTHROPIC_API_KEY is sent through x-api-key, which SnapGen does not use.