API documentation

Coding Tools

Connect Kilo Code, OpenCode, Claude Code, Codex, and similar coding agents to AIGate.

AIGate can be used as a custom provider in coding tools that support OpenAI-compatible or Anthropic-compatible APIs. Use the exact model id from /v1/models and keep the API key in an environment variable or the tool's secret storage.

Base URL
For OpenAI-compatible tools use https://api.aigate.shop/v1. For Claude Code use the same base URL with the Anthropic Messages route.

Quick test

Before configuring an IDE, check that the key and selected model work with a minimal request.

curl
curl https://api.aigate.shop/v1/chat/completions \  -H "Authorization: Bearer sk-your-api-key" \  -H "Content-Type: application/json" \  -d '{    "model": "openai/gpt-5.5",    "messages": [{ "role": "user", "content": "Say OK." }],    "stream": false  }'

Kilo Code

In Kilo Code settings, choose the OpenAI Compatible provider and fill in these values. If the model picker does not show the model automatically, enter the model id manually.

Kilo Code settings
Provider: OpenAI CompatibleBase URL: https://api.aigate.shop/v1API key: sk-your-api-keyModel ID: openai/gpt-5.5
  • Use an exact AIGate model id, for example openai/gpt-5.5.
  • If Kilo asks for a full endpoint URL instead of a base URL, use https://api.aigate.shop/v1/chat/completions.
  • For model not found errors, open /v1/models and copy the id exactly.

OpenCode

Run /connect, choose Other, enter provider id aigate, and paste your AIGate API key. Then create or update opencode.json in the project root.

opencode.json
{  "$schema": "https://opencode.ai/config.json",  "provider": {    "aigate": {      "npm": "@ai-sdk/openai-compatible",      "name": "AIGate",      "options": {        "baseURL": "https://api.aigate.shop/v1",        "apiKey": "{env:AIGATE_API_KEY}"      },      "models": {        "openai/gpt-5.5": {          "name": "GPT 5.5"        },        "anthropic/claude-sonnet-4.6": {          "name": "Claude Sonnet 4.6"        }      }    }  }}
  • Set AIGATE_API_KEY in the shell that starts OpenCode.
  • After saving the file, run /models and select the AIGate model.
  • Use @ai-sdk/openai-compatible for /v1/chat/completions. If a future setup requires /v1/responses only, switch that provider package to @ai-sdk/openai.

Claude Code

Claude Code uses the Anthropic Messages format. Point it at AIGate with ANTHROPIC_BASE_URL and use an Anthropic model id available in your catalog.

macOS / Linux
export ANTHROPIC_BASE_URL=https://api.aigate.shop/v1export ANTHROPIC_API_KEY=sk-your-api-keyexport ANTHROPIC_MODEL=anthropic/claude-sonnet-4.6export ANTHROPIC_DEFAULT_SONNET_MODEL=anthropic/claude-sonnet-4.6export ANTHROPIC_DEFAULT_OPUS_MODEL=anthropic/claude-opus-4.7export ANTHROPIC_DEFAULT_HAIKU_MODEL=anthropic/claude-haiku-4.5claude
Windows PowerShell
$env:ANTHROPIC_BASE_URL="https://api.aigate.shop/v1"$env:ANTHROPIC_API_KEY="sk-your-api-key"$env:ANTHROPIC_MODEL="anthropic/claude-sonnet-4.6"$env:ANTHROPIC_DEFAULT_SONNET_MODEL="anthropic/claude-sonnet-4.6"$env:ANTHROPIC_DEFAULT_OPUS_MODEL="anthropic/claude-opus-4.7"$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="anthropic/claude-haiku-4.5"claude
  • AIGate accepts x-api-key and bearer authentication on /v1/messages.
  • If Claude Code shows the wrong built-in model, pin ANTHROPIC_MODEL and the default Sonnet, Opus, and Haiku variables.
  • To show gateway models in Claude Code's model picker, use a recent Claude Code version and enable gateway model discovery if needed.

Codex

Codex reads custom providers from ~/.codex/config.toml on macOS/Linux or %USERPROFILE%\.codex\config.toml on Windows. Use the Responses wire API for AIGate.

config.toml
model_provider = "aigate"model = "openai/gpt-5.5"[model_providers.aigate]name = "AIGate"base_url = "https://api.aigate.shop/v1"env_key = "AIGATE_API_KEY"wire_api = "responses"
Environment
# macOS / Linuxexport AIGATE_API_KEY=sk-your-api-key# Windows PowerShell$env:AIGATE_API_KEY="sk-your-api-key"
  • Restart Codex after editing config.toml or changing environment variables.
  • If a model does not work through Responses in a specific Codex version, use a model that supports /v1/responses or configure another OpenAI-compatible client through /v1/chat/completions.
  • Do not put the real key directly into config.toml; use env_key.

General rule

For any other coding assistant, pick the provider type by endpoint: OpenAI-compatible clients use /v1/chat/completions or /v1/responses with Authorization: Bearer; Anthropic-compatible clients use /v1/messages with x-api-key or bearer auth.