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.

1

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).

2

Swap in a gateway access key

Not an upstream sk-… key — the same access key mounts into whichever header your SDK expects.

3

Use the gateway model name

Whatever you configured in the console — not the vendor's official name.

Authorization: Bearer <key>
OpenAI · DashScope · generic
Bearer prefix case-insensitive
x-api-key: <key>
Anthropic SDK
Authorization also accepted
x-goog-api-key: <key>
Gemini SDK
Authorization also accepted
HarnessProtocolSupportConfig targetKey names / settingsDocs
Terminal agents
Claude CodeAnthropicNativeenv varsANTHROPIC_BASE_URL, ANTHROPIC_API_KEY, ANTHROPIC_MODELDocs
Codex CLIOpenAI ResponsesNative~/.codex/config.tomlbase_url, env_key, wire_apiDocs
Gemini CLIGeminiNativeenv varsGOOGLE_GEMINI_BASE_URL, GEMINI_API_KEYDocs
OpenClawOpenAI / Anthropic-compatibleOpenAI-compatibleopenclaw.jsonmodels.providers.<id>.baseUrl, models.providers.<id>.apiKeyDocs
opencodeOpenAI-compatibleOpenAI-compatibleopencode.jsonprovider.<id>.options.baseURLDocs
CrushOpenAI / Anthropic-compatibleOpenAI-compatiblecrush.jsonproviders.<id>.base_url, providers.<id>.typeDocs
Factory DroidOpenAI / Anthropic-compatibleOpenAI-compatible~/.factory/settings.jsoncustomModels[].baseUrl, customModels[].providerDocs
GooseOpenAI-compatibleOpenAI-compatibleenv varsOPENAI_HOST, OPENAI_BASE_PATH, OPENAI_API_KEYDocs
AiderOpenAI-compatible (LiteLLM)OpenAI-compatibleenv varsOPENAI_API_BASEDocs
Qwen CodeOpenAI-compatibleOpenAI-compatibleenv varsOPENAI_BASE_URL, OPENAI_API_KEY, OPENAI_MODELDocs
OpenHandsOpenAI-compatible (LiteLLM)OpenAI-compatible~/.openhands/settings.jsonbase_url, model openai/ prefixDocs
Kimi Code CLIOpenAI / AnthropicOpenAI-compatibleconfig.tomlprovidersDocs
PlandexOpenAI-compatibleOpenAI-compatiblecustom models JSONbaseUrlDocs
SWE-agentOpenAI-compatible (LiteLLM)OpenAI-compatibleenv varsOPENAI_BASE_URLDocs
Grok BuildOpenAI-compatibleOpenAI-compatibleconfig.tomlcustom modelsDocs
Mistral VibeOpenAI-compatibleOpenAI-compatible~/.vibe/config.tomlprovidersDocs
MiMo CodeOpenAI-compatibleOpenAI-compatible/connect custom providerbase URL, API keyDocs
ForgeCodeOpenAI / AnthropicOpenAI-compatiblesetup wizardbase URLDocs
CodebuffOpenAI-compatibleOpenAI-compatiblesettingsbase URL, API keyDocs
IDEs & extensions
ClineOpenAI-compatibleOpenAI-compatibleSettings → OpenAI CompatibleBase URL, API Key, Model IDDocs
Roo CodeOpenAI-compatibleOpenAI-compatibleSettings → OpenAI CompatibleBase URL, API Key, Model IDDocs
Kilo CodeOpenAI-compatibleOpenAI-compatibleSettings → OpenAI CompatibleBase URL, API Key, Model IDDocs
ContinueOpenAI-compatibleOpenAI-compatibleconfig.yamlmodels[].apiBaseDocs
ZedOpenAI-compatibleOpenAI-compatiblesettings.jsonlanguage_models.openai_compatible.<id>.api_urlDocs
CursorOpenAIPartialSettings → Models → Override OpenAI Base URLOverride OpenAI Base URLDocs
WindsurfOpenAI-compatibleOpenAI-compatibleSettings → Models → BYOK / customBase URL, API KeyDocs
GitHub Copilot (BYOK)OpenAI-compatibleOpenAI-compatibleManage Models → OpenAI-compatibleBase URL, API KeyDocs
Managed platforms
WarpOpenAI / Anthropic / Gemini (BYOK)PartialSettings → BYOKBYOK API keysDocs
Amazon Q Developer CLIMCPNo custom endpointMCP serverDocs
DevinNo custom endpointDocs

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:

Claude Code

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

The harness pins its own model ID

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.

Anthropic-protocol harnesses take the root, not /v1

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 custom providers need wire_api="responses"

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.

LiteLLM-based harnesses want an openai/ model prefix

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.

Default is subscription OAuth, not your key

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.

IDEs infer tool/vision support from the model ID

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.

Long inference adds :keep-alive and _gateway_warning

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"

FAQ