GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - apimasterai/ai-coding-agent-api-configs: Working base_url and API key configs for every major AI coding agent — Cline, Claude Code, Kilo Code, OpenCode, Aider, Codex, Cursor. Plus a zero-dependency endpoint diagnostic tool.

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
README.md
README.md
 
 
README.zh-CN.md
README.zh-CN.md
 
 
check_endpoint.py
check_endpoint.py
 
 

Repository files navigation

AI Coding Agent API Configs

Working base_url + API key configurations for every major AI coding agent — Cline, Claude Code, Kilo Code, OpenCode, Aider, Codex, Cursor, Gemini CLI and more.

Every agent below supports pointing at a custom OpenAI-compatible or Anthropic-compatible endpoint. This repo collects the exact config file, the exact field, and the exact URL format for each one, plus the errors you hit when you get it wrong.

中文说明见 README.zh-CN.md


Why this repo exists

Every AI coding agent handles custom endpoints differently:

  • Some want https://host/v1, some want https://host with no suffix
  • Some use ANTHROPIC_BASE_URL, some use openAiBaseUrl, some use baseURL in a JSONC file
  • Some speak the OpenAI Chat Completions protocol, some speak the Anthropic Messages protocol, and mixing them up produces a 404 that looks like an auth problem

Getting this wrong costs an hour. The tables below are the answers.


Quick reference

Agent Config location URL format Protocol
Cline Settings UI → API Configuration https://host/v1 OpenAI
Kilo Code Settings → Providers → Custom provider https://host/v1 OpenAI
OpenCode ~/.config/opencode/opencode.jsonc https://host/v1 OpenAI
Claude Code ~/.claude/settings.json https://host (no /v1) Anthropic
Aider CLI flags / .env https://host/v1 OpenAI
Codex CLI ~/.codex/config.toml https://host/v1 OpenAI
Cursor Settings → Models → Override base URL https://host/v1 OpenAI
Gemini CLI env vars varies Google / OpenAI shim
LiteLLM api_base param https://host/v1 OpenAI
LangChain base_url param https://host/v1 OpenAI

The single most common mistake: using an OpenAI-format URL (/v1) with an Anthropic-protocol client, or vice versa. See Protocol mismatch below.


Cline (VS Code / Cursor)

Extension id: saoudrizwan.claude-dev

code --install-extension saoudrizwan.claude-dev

Open the Cline sidebar → gear icon → API Configuration:

Field Value
API Provider OpenAI Compatible
Base URL https://apimaster.ai/v1
API Key your key
Model ID e.g. claude-sonnet-4-6, gpt-5.5

Click Done. Send a test message — the footer should read openai-compat:<model-id>.

Troubleshooting

Symptom Cause
401 Key has a trailing space, or was copied from the wrong console
404 Model ID doesn't exist on this endpoint — check the provider's model list
Ignores your settings Provider not set to OpenAI Compatible, or you didn't click Done

Full walkthrough: cline-openai-compatible-setup


Claude Code (CLI)

Claude Code speaks the Anthropic Messages protocol, so the base URL is the site root with no /v1. This trips up almost everyone.

~/.claude/settings.json (macOS/Linux) or %userprofile%\.claude\settings.json (Windows):

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://apimaster.ai",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}

Then:

claude
/model claude-sonnet-4-6

Troubleshooting

Symptom Cause
Prompts you to log in to Anthropic ANTHROPIC_BASE_URL is wrong, or has /v1 appended
401 Try ANTHROPIC_API_KEY instead of ANTHROPIC_AUTH_TOKEN — which one works is version-dependent
Unknown model Model id not offered by your endpoint

If your provider only speaks the OpenAI protocol, Claude Code can't talk to it directly. Use claude-code-router as a translation layer, and set api_base_url to the full endpoint path (https://host/v1/chat/completions) so CCR doesn't mis-join the path.

Full walkthrough: claude-code-custom-api-setup


Kilo Code (VS Code / Cursor)

Settings → Providers → Custom provider → + Connect:

Field Value
Provider ID apimaster
Display name APIMaster.ai
Base URL https://apimaster.ai/v1
API key your key

Leave Headers empty. On the next screen check the model ids you want, click Add N model(s), then Submit. The provider appears under Connected providers with a CUSTOM tag.

Full walkthrough: kilo-code-custom-provider-setup


OpenCode

UI path: gear icon → Providers → Custom provider → + Connect, same fields as Kilo Code.

For reasoning-effort tiers you need the config file. ~/.config/opencode/opencode.jsonc (Windows: C:\Users\<you>\.config\opencode\opencode.jsonc):

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "apimaster": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "APIMaster.ai",
      "options": {
        "baseURL": "https://apimaster.ai/v1"
      },
      "models": {
        "claude-sonnet-4-6": { "name": "Claude Sonnet 4.6" },
        "gpt-5.5": { "name": "GPT-5.5" }
      }
    }
  }
}

Two URL traps specific to OpenCode:

  • Must include /v1. OpenCode appends /chat/completions itself. Without /v1 you get https://host/chat/completions → 404.
  • Don't use an api. subdomain unless the provider documents one — it can fail at TLS.

Never put your API key in opencode.jsonc. Use /connect in the terminal or the Providers UI; the key belongs in OpenCode's auth store. Restart or start a new session after editing.

Full walkthrough: opencode-openai-compatible-setup


Aider

export OPENAI_API_BASE=https://apimaster.ai/v1
export OPENAI_API_KEY=YOUR_API_KEY

aider --model openai/claude-sonnet-4-6

The openai/ prefix matters — it tells LiteLLM (which Aider uses internally) to route through the OpenAI-compatible path rather than trying to reach Anthropic directly.


Codex CLI

~/.codex/config.toml:

model = "gpt-5.5"
model_provider = "custom"

[model_providers.custom]
name = "custom"
base_url = "https://apimaster.ai/v1"
env_key = "CUSTOM_API_KEY"
export CUSTOM_API_KEY=YOUR_API_KEY
codex

Cursor

Settings → Models → enable Override OpenAI Base URL:

  • Base URL: https://apimaster.ai/v1
  • API Key: your key
  • Add your model id under Model Names, then click Verify

Note: Cursor's own agent features (Composer, Tab) route through Cursor's backend regardless of this setting. The override only affects direct chat model calls.


Platforms

LiteLLM
import litellm

response = litellm.completion(
    model="openai/claude-sonnet-4-6",
    api_key="YOUR_API_KEY",
    api_base="https://apimaster.ai/v1",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
LangChain
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="claude-sonnet-4-6",
    api_key="YOUR_API_KEY",
    base_url="https://apimaster.ai/v1",
)
print(llm.invoke("Hello!").content)
Open WebUI
docker run -d \
  -e OPENAI_API_KEY="YOUR_API_KEY" \
  -e OPENAI_API_BASE_URL="https://apimaster.ai/v1" \
  -p 3000:8080 \
  ghcr.io/open-webui/open-webui
OpenAI Python SDK
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://apimaster.ai/v1",
)

resp = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)

Protocol mismatch

The two protocols are not interchangeable, and the error messages don't tell you which one you got wrong.

OpenAI Chat Completions Anthropic Messages
Path POST /v1/chat/completions POST /v1/messages
Base URL you configure https://host/v1 https://host
Auth header Authorization: Bearer sk-... x-api-key: sk-...
Used by Cline, Kilo, OpenCode, Aider, Cursor, Codex Claude Code

Diagnosing: curl the endpoint directly first. If this works, the endpoint is fine and your client config is wrong:

curl https://apimaster.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4-6","messages":[{"role":"user","content":"ok"}]}'

A 404 with a valid key almost always means a path-joining problem: your client appended a path segment that the base URL already contained, or vice versa.


Verifying you're getting the model you paid for

If you're routing through any third-party endpoint — a gateway, a relay, an aggregator, your own proxy — the model id in your request is a label, not a guarantee. Worth checking:

  1. Response metadata. Compare the model field in the response against what you asked for.
  2. Token accounting. Tokenizer differences between model families show up in usage counts on identical inputs.
  3. Behavioral fingerprinting. Model families have stable, distinguishable response patterns on targeted prompts. This is the most reliable method and the hardest to fake.

A free tester for this: APIMaster Model Tester — works against any OpenAI-compatible endpoint, not just APIMaster's.


Contributing

Config for an agent that isn't here? Open a PR. Useful format:

  • Agent name and version tested
  • Exact config file path per OS
  • Exact URL format including whether /v1 is required
  • One error you hit and what fixed it

Corrections to existing entries are just as welcome — these tools change fast and stale config is worse than none.


Endpoint used in the examples

Examples use https://apimaster.ai/v1, an OpenAI-compatible endpoint that fronts multiple model providers with one key. Substitute your own — every config here works with any OpenAI-compatible endpoint, including a self-hosted new-api or LiteLLM proxy instance.

If you want to try the one in the examples: get a key · docs


License

MIT

About

Working base_url and API key configs for every major AI coding agent — Cline, Claude Code, Kilo Code, OpenCode, Aider, Codex, Cursor. Plus a zero-dependency endpoint diagnostic tool.

Topics

ai-codingaideranthropicapi-gatewayawesome-listbase-urlclaudeclaude-codeclinecodexcoding-agentcursorgptkilo-codellm-apillm-gatewayopenai-compatibleopencode

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.