Skip to main content
Claude Code can connect to an LLM gateway through 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 --version works.
  • Create a SnapGen API key and add prepaid balance.
  • Choose a current text model, such as gpt-5.4-mini or gpt-5.5.

Configure the current shell

Use 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.
A successful response has type: "message" and text under content[0].text.

Start Claude Code

Run /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 the env object in ~/.claude/settings.json:
Prefer a shell secret manager or managed settings for production teams. Do not put the key in a repository’s .claude/settings.json.

Troubleshooting

Start it from the shell where ANTHROPIC_AUTH_TOKEN is exported, or place the variables in the user-level ~/.claude/settings.json file.
Set CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1, restart Claude Code, and confirm that GET /v1/models returns the ID.
Update the gateway when available. As a temporary diagnostic, set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 and retry.
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.