Skip to main content
Your coding tools and scripts reach your company’s models through the LLM Gateway with a personal xpander API key. Calls made with your key run as you: on the models your organization enabled for you, within your budgets, and they show under your name in Logs.

Gateway address

AI models & keys shows your exact address under Gateway address, with a copy button. The examples below use https://llm-gw.xpander.ai; replace it with yours on an Air-Gapped install.

The quick way: one copied command

  1. Open AI models & keys in Xpander Chat (Settings > AI models & keys).
  2. Under Connect a client, pick Claude Code, Codex CLI, OpenCode or Your own code.
  3. For Claude Code, Codex CLI and OpenCode, pick your system (macOS, Linux or Windows) and choose Copy setup command. Copying creates an API key for that client and computer. Paste the command in your terminal (PowerShell on Windows) and press Enter. Your coding tool starts already connected, and saves the connection in its own settings so every new terminal uses it.
  4. For Your own code, choose Copy prompt and paste it into the coding agent you use in your project. It wires your project’s OpenAI or Anthropic SDK calls to the gateway, reading the key from the XPANDER_GATEWAY_KEY environment variable. The prompt never contains your key.
Set up manually, in the same card, shows the files and commands below with your address filled in. While a new key is on screen, the key is filled in too. Codex, OpenCode and the SDK samples also take a Model you pick there.

Claude Code

No /login is needed: your xpander key signs Claude Code in. Add this to ~/.claude/settings.json (%USERPROFILE%\.claude\settings.json on Windows):
The address has no /v1. CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY lists the models your organization enabled for you in Claude Code’s /model, so there is no model to set. To try it in one terminal only:
Check it: run claude -p "reply with exactly: OK". In Claude Code, /status shows the gateway address.

Codex

No login is needed: Codex reads your key from XPANDER_GATEWAY_KEY. Add this to ~/.codex/config.toml (%USERPROFILE%\.codex\config.toml on Windows), with a model from AI models & keys:
Then keep the key for every new terminal:
Open a new terminal and start codex. Switch models with /model. Check it: codex exec --skip-git-repo-check "reply with exactly: OK" answers OK.

OpenCode

No login is needed: OpenCode reads your key from XPANDER_GATEWAY_KEY. Add a provider to ~/.config/opencode/opencode.json (%USERPROFILE%\.config\opencode\opencode.json on Windows):
List every model you use under models, and pick one as xpander/<name>. Keep XPANDER_GATEWAY_KEY for every new terminal as in the Codex section, then start opencode. Check it: opencode run "reply with exactly: OK" answers OK.

Your own code (SDKs)

The Anthropic SDK takes the address without /v1; the OpenAI SDK takes it with /v1. Both take your xpander key as their API key.
The gateway accepts these formats: A call in one format can be served by a model from a provider that speaks another, so Codex can run a Claude model when your organization enabled one for you.

Sending your key next to another sign-in

The gateway reads your xpander key from Authorization: Bearer, from x-api-key, or from the x-xpander-api-key header. When the Authorization header already carries another sign-in, such as your own Claude plan in Claude Code, send your xpander key in x-xpander-api-key:
The header is removed before the call reaches the model provider, and is never written to a log.

Check the connection

The answer lists the models and aliases your key may use. A 401 means the key is unknown, revoked or expired. Your newest call appears at the top of Logs (for admins) and in your own Usage. When a call is refused, Errors and what to do lists every message.