Claude Code
Claude Code speaks the Anthropic Messages API, so it connects to 7API with two settings: the base URL and your key. You don't need an Anthropic account.
Configure
Save this as your Claude Code settings file and replace YOUR_7API_KEY with your key:
- macOS / Linux:
~/.claude/settings.json - Windows:
%USERPROFILE%\.claude\settings.json
{
"env": {
"ANTHROPIC_BASE_URL": "https://7api.st",
"ANTHROPIC_AUTH_TOKEN": "YOUR_7API_KEY",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
"DISABLE_TELEMETRY": "1",
"DISABLE_ERROR_REPORTING": "1",
"DISABLE_AUTOUPDATER": "1",
"DISABLE_BUG_COMMAND": "1",
"DISABLE_COST_WARNINGS": "1",
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1"
},
"permissions": {
"defaultMode": "auto"
},
"model": "opus[1m]",
"effortLevel": "high",
"theme": "dark"
}Then run claude. The CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC and DISABLE_* entries turn off telemetry and background calls that would otherwise spend tokens.
If you'd rather use environment variables for a single session:
export ANTHROPIC_BASE_URL="https://7api.st"
export ANTHROPIC_AUTH_TOKEN="sk-your-key"
claudeSwitching models
/model accepts any 7API model. Claude Code only shows names that start with claude-, so add that prefix to non-Claude models:
/model claude-opus-5-5
/model claude-gpt-6.1-sol
/model claude-glm-5.3
/model claude-deepseek-v4.1-flash
/model claude-kimi-k3
/model claude-grok-4.7The [1m] suffix (for example opus[1m]) turns on the 1M-token context window on Claude models.
Effort
effortLevel in settings, or /effort in a session, is sent as output_config.effort. See Reasoning effort for what each model accepts.
Troubleshooting
- 401 Invalid API key: make sure
ANTHROPIC_AUTH_TOKEN(notANTHROPIC_API_KEY) holds the 7API key. Also check that no other Anthropic key is set in your shell. - 404 errors: the base URL must be
https://7api.st, without/v1. - 402 errors: your balance is too low for the request's worst case. Top up, or start a fresh session with less context.
