Copy-paste configs to point 31 AI coding agents (Claude Code, OpenCode, Codex CLI, Cline, Kilo, Aider,…
agent-provider-configs
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Copy-paste configs for pointing AI coding agents at any OpenAI-compatible or Anthropic-compatible API:
a gateway, a router, another model vendor, or a server on your own machine.
31 agents plus the Magpie provider manager, 21 provider presets, a source link for every key. Last checked: **2026-10-15**.
How do I point an AI coding agent at a custom OpenAI-compatible API?
You need three values: a **base URL**, an **API key**, and a **model ID** that the provider serves.
Where they go depends on the agent:
- **Claude Code** reads env vars: ANTHROPIC_BASE_URL (no /v1), ANTHROPIC_AUTH_TOKEN, ANTHROPIC_MODEL. It only speaks the Anthropic Messages API. Its aliases and background calls request their own Claude model IDs, so also set every ANTHROPIC_DEFAULT_*_MODEL; claude-code-provider does this and checks the result with one request.
- **OpenCode** and **Kilo Code** take a provider block in opencode.json / kilo.json with "npm": "@ai-sdk/openai-compatible" and options.baseURL.
- **Codex CLI** takes a [model_providers. ] table in ~/.codex/config.toml. It only speaks the OpenAI **Responses** API now; wire_api = "chat" was removed.
- **Cline, Roo Code, Cursor, Copilot, JetBrains** have an "OpenAI Compatible" option in their settings UI.
- Most other agents take a JSON or YAML provider entry. Find yours in the table, copy the block, replace the three placeholders.
Placeholders used everywhere: https://YOUR_PROVIDER/v1, YOUR_PROVIDER_API_KEY, MODEL_ID. Real values for 21 providers are in Provider presets.
The four mistakes behind most "404" and "model not found" errors
1. **/v1 or no /v1.** OpenAI-style base URLs end in /v1 (the client appends /chat/completions). Claude Code, Zed's anthropic_compatible, Goose, Roo Code and Factory's anthropic type want the Anthropic base URL **without** /v1 because they append /v1/messages themselves. OpenCode, Kilo, Continue and Crush use AI SDK or similar clients that want it **with** /v1. Each section below says which.
2. **Wrong protocol.** Codex CLI needs /v1/responses. Claude Code needs /v1/messages. An endpoint that only serves /v1/chat/completions works with neither.
3. **Model ID.** Use the exact ID from the provider's GET /v1/models, including any prefix (anthropic/..., accounts/fireworks/models/...). Aider additionally needs an openai/ prefix in front of it.
4. **A key from somewhere else wins.** A saved login, a stale OPENAI_BASE_URL, or a settings-file env block can override what you exported. The gotchas per agent list the known cases.
check.sh tests a base URL, key and model ID in one command before you touch an agent.
Contents
| Agent | Config location | Chat Completions | Responses | Anthropic Messages | Checked |
| --- | --- | :---: | :---: | :---: | --- |
| Claude Code | env vars or ~/.claude/settings.json | | | yes | CLI run |
| OpenCode | opencode.json | yes | yes | yes | CLI run |
| Codex CLI | ~/.codex/config.toml | removed | yes | | CLI run |
| Cline | extension settings, cline auth | yes | | yes (extension) | docs, source |
| Kilo Code | ~/.config/kilo/kilo.json | yes | yes | yes | docs, source |
| Roo Code | extension settings, import JSON | yes | | yes | docs, source |
| Continue | ~/.continue/config.yaml | yes | yes | yes | docs, source |
| Aider | env vars, .aider.conf.yml | yes | | via LiteLLM | docs, source |
| Hermes Agent | ~/.hermes/config.yaml | yes | yes | yes | docs, source |
| OpenClaw | ~/.openclaw/openclaw.json | yes | yes | yes | docs, source |
| Pi | ~/.pi/agent/models.json | yes | yes | yes | docs, source |
| oh-my-pi | ~/.omp/agent/models.yml | yes | yes | yes | docs, source |
| Crush | crushrc (or legacy crush.json) | yes | yes | yes | docs, source |
| Goose | ~/.config/goose/custom_providers/*.json | yes | yes | yes | docs, source |
| Qwen Code | ~/.qwen/settings.json | yes | yes | yes | docs |
| Factory Droid | ~/.factory/settings.json | yes | yes | yes | docs |
| Amp | Settings → Model Routing → Custom URL | yes | yes | yes | docs |
| Grok Build | ~/.grok/config.toml | yes | yes | yes | docs, source |
| DeepSeek Harness | Settings → Models, cordis.patch.yml | yes | yes | yes | docs |
| Command Code | /connect, ~/.commandcode/providers.json | yes | yes | yes | docs |
| jcode | jcode provider add → ~/.jcode/config.toml | yes | | | docs, source |
| Docker Agent | agent YAML, ~/.config/cagent/config.yaml | yes | yes | yes | docs, source |
| Zed | settings.json | yes | yes | yes | docs, source |
| Cursor (BYOK) | Settings → Models | yes | | | docs, staff posts |
| GitHub Copilot in VS Code | chatLanguageModels.json | yes | yes | yes | docs |