AI Coding Agents & Harnesses
Point Claude Code, Codex CLI, OpenClaw, Cline, Cursor and 25+ other coding agents at the gateway the same three steps — each with its exact config target and key names.
Every AI coding agent reads a base URL and an API key from somewhere — an env var, a config file, or a settings panel. This page lists where each harness reads them from, which protocol it speaks, and the one gotcha that actually trips people up. Full copy-paste configs live in the docs.
Point base_url at the gateway
Default https://your-gateway.gatellm.io — whether it includes /v1 depends on the SDK (each example gives the exact value).
Swap in a gateway access key
Not an upstream sk-… key — the same access key mounts into whichever header your SDK expects.
Use the gateway model name
Whatever you configured in the console — not the vendor's official name.
Authorization: Bearer <key>x-api-key: <key>x-goog-api-key: <key>| Harness | Protocol | Support | Config target | Key names / settings | Docs |
|---|---|---|---|---|---|
| Terminal agents | |||||
| Claude Code | Anthropic | Native | env vars | ANTHROPIC_BASE_URL, ANTHROPIC_API_KEY, ANTHROPIC_MODEL | Docs |
| Codex CLI | OpenAI Responses | Native | ~/.codex/config.toml | base_url, env_key, wire_api | Docs |
| Gemini CLI | Gemini | Native | env vars | GOOGLE_GEMINI_BASE_URL, GEMINI_API_KEY | Docs |
| OpenClaw | OpenAI / Anthropic-compatible | OpenAI-compatible | openclaw.json | models.providers.<id>.baseUrl, models.providers.<id>.apiKey | Docs |
| opencode | OpenAI-compatible | OpenAI-compatible | opencode.json | provider.<id>.options.baseURL | Docs |
| Crush | OpenAI / Anthropic-compatible | OpenAI-compatible | crush.json | providers.<id>.base_url, providers.<id>.type | Docs |
| Factory Droid | OpenAI / Anthropic-compatible | OpenAI-compatible | ~/.factory/settings.json | customModels[].baseUrl, customModels[].provider | Docs |
| Goose | OpenAI-compatible | OpenAI-compatible | env vars | OPENAI_HOST, OPENAI_BASE_PATH, OPENAI_API_KEY | Docs |
| Aider | OpenAI-compatible (LiteLLM) | OpenAI-compatible | env vars | OPENAI_API_BASE | Docs |
| Qwen Code | OpenAI-compatible | OpenAI-compatible | env vars | OPENAI_BASE_URL, OPENAI_API_KEY, OPENAI_MODEL | Docs |
| OpenHands | OpenAI-compatible (LiteLLM) | OpenAI-compatible | ~/.openhands/settings.json | base_url, model openai/ prefix | Docs |
| Kimi Code CLI | OpenAI / Anthropic | OpenAI-compatible | config.toml | providers | Docs |
| Plandex | OpenAI-compatible | OpenAI-compatible | custom models JSON | baseUrl | Docs |
| SWE-agent | OpenAI-compatible (LiteLLM) | OpenAI-compatible | env vars | OPENAI_BASE_URL | Docs |
| Grok Build | OpenAI-compatible | OpenAI-compatible | config.toml | custom models | Docs |
| Mistral Vibe | OpenAI-compatible | OpenAI-compatible | ~/.vibe/config.toml | providers | Docs |
| MiMo Code | OpenAI-compatible | OpenAI-compatible | /connect custom provider | base URL, API key | Docs |
| ForgeCode | OpenAI / Anthropic | OpenAI-compatible | setup wizard | base URL | Docs |
| Codebuff | OpenAI-compatible | OpenAI-compatible | settings | base URL, API key | Docs |
| IDEs & extensions | |||||
| Cline | OpenAI-compatible | OpenAI-compatible | Settings → OpenAI Compatible | Base URL, API Key, Model ID | Docs |
| Roo Code | OpenAI-compatible | OpenAI-compatible | Settings → OpenAI Compatible | Base URL, API Key, Model ID | Docs |
| Kilo Code | OpenAI-compatible | OpenAI-compatible | Settings → OpenAI Compatible | Base URL, API Key, Model ID | Docs |
| Continue | OpenAI-compatible | OpenAI-compatible | config.yaml | models[].apiBase | Docs |
| Zed | OpenAI-compatible | OpenAI-compatible | settings.json | language_models.openai_compatible.<id>.api_url | Docs |
| Cursor | OpenAI | Partial | Settings → Models → Override OpenAI Base URL | Override OpenAI Base URL | Docs |
| Windsurf | OpenAI-compatible | OpenAI-compatible | Settings → Models → BYOK / custom | Base URL, API Key | Docs |
| GitHub Copilot (BYOK) | OpenAI-compatible | OpenAI-compatible | Manage Models → OpenAI-compatible | Base URL, API Key | Docs |
| Managed platforms | |||||
| Warp | OpenAI / Anthropic / Gemini (BYOK) | Partial | Settings → BYOK | BYOK API keys | Docs |
| Amazon Q Developer CLI | MCP | No custom endpoint | MCP server | — | Docs |
| Devin | — | No custom endpoint | — | — | Docs |
What to name the gateway model
Some harnesses pin their own model ID and send it verbatim. If your gateway model has a different name, the first call 404s. Two ways to align:
Name the gateway model exactly what the harness requests — zero extra config.
Or override the harness to use your gateway name via its model env var (e.g. ANTHROPIC_MODEL).
Gotchas
Claude Code sends its configured default (e.g. claude-sonnet-4-5) — not your gateway name. Either name the gateway model exactly what the harness requests, or set its model env var (e.g. ANTHROPIC_MODEL) to your gateway name. Mismatch → 404 model_not_found on the first message.
The base URL for Anthropic-style clients goes to the gateway root (no /v1) — the client appends /v1/messages itself. Adding /v1 here double-stacks the path segment.
Codex CLI requires wire_api = "responses" for a custom [model_providers.*] block. The gateway implements /v1/responses natively — point base_url at it and set env_key to a gateway access key.
Aider, OpenHands and SWE-agent sit on LiteLLM: set OPENAI_API_BASE to the gateway and give the model an openai/ prefix (e.g. openai/gateway-model-name) so LiteLLM routes it as an OpenAI-compatible endpoint.
Codex, Gemini CLI and Qwen Code default to the vendor's OAuth / subscription login. To route through the gateway you must switch to API-key auth (set the key + base URL explicitly) — otherwise the agent bypasses the gateway entirely.
Cline / Roo / Kilo and others decide tool-calling and vision capability from the model name. A custom gateway name may disable function calling — if tool calls fail, check the client's capability-detection rules or name the model to match a known family.
During long upstream inference the gateway emits SSE :keep-alive comment lines (harmless — skip lines starting with :), and on a mid-stream break it inserts a _gateway_warning field instead of erroring, so harnesses like Claude Code don't abort the whole conversation.
# Every agent is one base_url + one access key away
export ANTHROPIC_BASE_URL="https://your-gateway.gatellm.io" # Anthropic agents: root (no /v1)
export ANTHROPIC_API_KEY="<gateway access key>"
export OPENAI_API_BASE="https://your-gateway.gatellm.io/v1" # OpenAI-compatible agents: /v1
export OPENAI_API_KEY="<gateway access key>"
# Codex CLI (~/.codex/config.toml) speaks the Responses protocol
# [model_providers.gatellm]
# base_url = "https://your-gateway.gatellm.io/v1"
# wire_api = "responses"