Claude Code API Gateway
Claude Code API Gateway: Connect with Two Environment Variables
Claude Code talks to models through the Anthropic Messages API (/v1/messages). gw-link serves the same protocol: point ANTHROPIC_BASE_URL at https://gw-link.com and use your console-issued sk- key as ANTHROPIC_AUTH_TOKEN. Claude Code itself needs no changes.
Native protocol, no shims
gw-link speaks the Anthropic-compatible /v1/messages API directly, so Claude Code's tool use, streaming and long context work as-is — no OpenAI-format translation in between.
One key per teammate
Create a separate API key per person or project, set spending caps, and see per-key usage and cost in the console.
Two entry points
https://gw-link.com is the primary endpoint and https://gw-link.ai is the US endpoint. Pick whichever is faster from your network; configuration is identical.
How to connect Claude Code
- Sign up and log in to the gw-link console, then create a key on the API Keys page (choose a Claude group).
- Set ANTHROPIC_BASE_URL=https://gw-link.com and ANTHROPIC_AUTH_TOKEN=<your key>. Do not append /v1 to the base URL.
- Run claude in your project and send a message to confirm the connection.
- To make it permanent, put the same values in the env block of ~/.claude/settings.json.
Configuration examples
macOS / Linux shell
export ANTHROPIC_BASE_URL="https://gw-link.com"
export ANTHROPIC_AUTH_TOKEN="sk-your-gw-link-key"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
claude~/.claude/settings.json (recommended, persistent)
On Windows the file is %USERPROFILE%\.claude\settings.json.
{
"env": {
"ANTHROPIC_BASE_URL": "https://gw-link.com",
"ANTHROPIC_AUTH_TOKEN": "sk-your-gw-link-key",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}Windows PowerShell
$env:ANTHROPIC_BASE_URL="https://gw-link.com"
$env:ANTHROPIC_AUTH_TOKEN="sk-your-gw-link-key"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
claudeFAQ
Does Claude Code work with gw-link?
Yes. gw-link exposes the same /v1/messages API as Anthropic, so Claude Code only needs ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN — no code changes or plugins.
Do I also need an Anthropic API key?
No. Use the sk- key issued by the gw-link console; usage is charged to your gw-link balance or subscription quota.
Should ANTHROPIC_BASE_URL include /v1?
No. Claude Code appends /v1/messages itself, so use https://gw-link.com. Using https://gw-link.com/v1 produces /v1/v1/messages and a 404.
Does it work with Claude Code in VS Code or JetBrains?
Yes. The IDE integrations run the same Claude Code, so the env block in ~/.claude/settings.json applies there too.
Which models are available?
Whatever your key's group allows. List them with curl https://gw-link.com/v1/models -H "Authorization: Bearer <your key>".
Last updated: