There are two base URLs. Which one you need depends on the format your tool speaks, not on the model you call. Every model works with both.
| Format | Base URL | The tool then calls |
|---|---|---|
| OpenAI | https:/ |
/, /, / |
| Anthropic | https:/ |
/, / |
Use the same API key for both.
The /v1 mistake
This is the most common setup error.
- OpenAI SDKs and OpenAI-format tools add only the endpoint (
/chat/completions) to the base URL. So the base URL must end in/v1. - The Anthropic SDK and Claude Code add
/v1/messagesto the base URL. So the base URL must not end in/v1.
| You set | The tool calls | Result |
|---|---|---|
OpenAI tool, https:/ |
/ |
Works |
OpenAI tool, https:/ |
/ |
404 not_ |
Anthropic tool, https:/ |
/ |
Works |
Anthropic tool, https:/ |
/ |
404 not_ |
Also check that the URL starts with https:// and has no trailing /. Some tools add their own
/ and end up calling //chat/completions.
SDKs
| SDK | Setting | Value |
|---|---|---|
| OpenAI Python | OpenAI(base_ or OPENAI_ |
https:/ |
| OpenAI Node / TypeScript | new OpenAI({ baseURL }) or OPENAI_ |
https:/ |
| Anthropic Python | Anthropic(base_ or ANTHROPIC_ |
https:/ |
| Anthropic TypeScript | new Anthropic({ baseURL }) or ANTHROPIC_ |
https:/ |
LangChain ChatOpenAI |
base_ |
https:/ |
| curl | full URL | https:/ or / |
from openai import OpenAI
import anthropic
openai_client = OpenAI(base_url="https://api.yunshurouter.com/v1", api_key="tq-...")
anthropic_client = anthropic.Anthropic(base_url="https://api.yunshurouter.com", api_key="tq-...")
import OpenAI from "openai";
import Anthropic from "@anthropic-ai/sdk";
const openai = new OpenAI({ baseURL: "https://api.yunshurouter.com/v1", apiKey: "tq-..." });
const anthropic = new Anthropic({ baseURL: "https://api.yunshurouter.com", apiKey: "tq-..." });
Coding tools
| Tool | Format | Where | Base URL | Key setting |
|---|---|---|---|---|
| Claude Code | Anthropic | ~/ → env, or shell |
ANTHROPIC_ |
ANTHROPIC_ |
| Codex CLI | OpenAI Responses | ~/ |
base_ with wire_ |
env_ names your key variable |
| Cursor | OpenAI | Settings → Models → API Keys | Override OpenAI Base URL: https:/ |
OpenAI API Key |
| Cline | OpenAI | API Provider: OpenAI Compatible | https:/ |
API Key |
| Continue | OpenAI | ~/ |
apiBase: https:/ with provider: openai |
apiKey |
| OpenClaw | OpenAI | ~/ |
baseUrl: "https:/ with api: "openai-completions" |
apiKey |
| Hermes Agent | OpenAI | ~/ |
base_ with provider: custom |
api_ |
Each tool has a full guide under /integrations.
Claude Code
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.yunshurouter.com",
"ANTHROPIC_AUTH_TOKEN": "tq-...",
"ANTHROPIC_MODEL": "deepseek-v4-pro",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k3",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4.1-flash"
}
}
- No
/v1inANTHROPIC_BASE_URL. ANTHROPIC_AUTH_TOKENis sent asAuthorization: Bearer, which we accept.ANTHROPIC_API_KEYis sent asx-api-key, which we also accept.
Codex CLI
# export YUNSHU_API_KEY="tq-..."
model = "deepseek-v4-pro"
model_provider = "yunshu"
[model_providers.yunshu]
name = "Yunshu Router"
base_url = "https://api.yunshurouter.com/v1"
env_key = "YUNSHU_API_KEY"
wire_api = "responses"
Checking your setup
List models with the same base URL and key your tool uses:
# OpenAI-format tools
curl https://api.yunshurouter.com/v1/models -H "Authorization: Bearer $YUNSHU_API_KEY"
# Anthropic-format tools: same path, Anthropic header
curl https://api.yunshurouter.com/v1/models -H "x-api-key: $YUNSHU_API_KEY"
| Result | Meaning |
|---|---|
| A list of models | The key works |
401 authentication_ |
Wrong or revoked key, or the key was not sent |
404 not_ |
Wrong path. Recheck / |
402 insufficient_ on a completion |
The setup is right; top up |
Your tool’s model name must be an ID from that list, for example deepseek-v4-pro, not a name from
another provider’s API.