{
  "id": 20856896,
  "title": "Claude Code on an Anthropic-compatible gateway: where the key goes, which setting wins, and when it compacts",
  "url": "https://urgent.news/2026/11/20/claude-code-on-an-anthropic-compatible-gateway-where-the-key-goes",
  "topic": "ai",
  "section": "AI",
  "published": "2026-11-20T05:24:18.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/alex_uberllm/claude-code-on-an-anthropic-compatible-gateway-where-the-key-goes-which-setting-wins-and-when-it-3gk7"
  },
  "original_language": "en",
  "account": "Claude Code communicates with the Anthropic Messages API, which can be accessed through various endpoints, including a company's gateway or a marketplace. To set it up, two environment variables need to be exported: ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. These variables can be set in a terminal or a settings file to persist across sessions. To avoid storing the API key in source files, it is recommended to store it in a separately secured file and have the Claude Code script read it. The Claude Code settings file determines which settings take precedence, such as managed settings, local project settings, or global settings. In case of conflicts, the key provided in the settings file takes precedence over the shell key, and the model specified in the session takes precedence over the model setting. To use other models besides Claude models, the ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL, and CLAUDE_CODE_SUBAGENT_MODEL variables need to be set in the settings file. Claude Code assumes a context size of 200,000 tokens for non-Claude models and compacts the conversation when the context exceeds this size. The autoCompactWindow and CLAUDE_CODE_AUTO_COMPACT_WINDOW variables can be used to adjust the compaction threshold, and CLAUDE_CODE_MAX_CONTEXT_TOKENS can be set to the actual context size of the model being used. Keep in mind that using a third-party endpoint means that Claude Code will not have access to features specific to Anthropic's platform and that the cost shown will not reflect the actual usage charges from the third-party provider.",
  "summary": "Disclosure: I run UberLLM; the examples use its API, but the setup works the same with any compatible provider where noted. Claude Code talks to the Anthropic Messages API. Any endpoint that speaks that API can serve it: a model maker's own Anthropic-compatible endpoint, a company gateway, or a marketplace. I wrote earlier about mapping Claude Code to DeepSeek, GLM or Kimi . This post is the…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}