Connecting in Claude Code
-
Open or create the file
~/.claude/settings.json, where~is your home directory -
Fill it with the contents below
~/.claude/settings.json{
"env": {
"ANTHROPIC_BASE_URL": "<YOUR_URL>",
"ANTHROPIC_API_KEY": "<YOUR_API_KEY>",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": 1
}
}- Replace
<YOUR_API_KEY>with the API key issued to you- If you see these instructions but do not have an API key, contact your organization's administrator
- Replace
<YOUR_URL>with the OpenAI-compatible URL issued to you- If you see these instructions but do not have an OpenAI-compatible URL, contact your organization's administrator
- Optional: add the line
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": Xto theenvblock — it enables automatic compaction when the context fills up toXtokens. ReplaceXwith the value you need
- Replace
-
Start Claude Code. When asked
Do you want to use this API key?, answerYes- If you see the error
API Error: 401 Unknown API key: ..., contact your organization's administrator to reissue your API key
- If you see the error
-
To choose a model, use
/model. Explyt supports only the models markedFrom gatewayauto– maximum availability (uptime) and high qualityAnthropic/opus-5– Anthropic model with high-quality answersOpenAI/gpt-5.6-sol– general-purpose OpenAI model
If you run into problems while connecting, try typing /logout in the chat and start over.
For errors, see Error messages.