Skip to content

Docs / Base URL cheat sheet

Base URL cheat sheet

Which Yunshu Router base URL each SDK and coding tool needs, with or without /v1. Fix the most common setup error in one look.

Get an API key

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://api.yunshurouter.com/v1 /v1/chat/completions, /v1/responses, /v1/models
Anthropic https://api.yunshurouter.com /v1/messages, /v1/messages/count_tokens

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/messages to the base URL. So the base URL must not end in /v1.
You set The tool calls Result
OpenAI tool, https://api.yunshurouter.com/v1 /v1/chat/completions Works
OpenAI tool, https://api.yunshurouter.com /chat/completions 404 not_found
Anthropic tool, https://api.yunshurouter.com /v1/messages Works
Anthropic tool, https://api.yunshurouter.com/v1 /v1/v1/messages 404 not_found

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_url=...) or OPENAI_BASE_URL https://api.yunshurouter.com/v1
OpenAI Node / TypeScript new OpenAI({ baseURL }) or OPENAI_BASE_URL https://api.yunshurouter.com/v1
Anthropic Python Anthropic(base_url=...) or ANTHROPIC_BASE_URL https://api.yunshurouter.com
Anthropic TypeScript new Anthropic({ baseURL }) or ANTHROPIC_BASE_URL https://api.yunshurouter.com
LangChain ChatOpenAI base_url https://api.yunshurouter.com/v1
curl full URL https://api.yunshurouter.com/v1/chat/completions or /v1/messages
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 ~/.claude/settings.json → env, or shell ANTHROPIC_BASE_URL=https://api.yunshurouter.com ANTHROPIC_AUTH_TOKEN
Codex CLI OpenAI Responses ~/.codex/config.toml base_url = "https://api.yunshurouter.com/v1" with wire_api = "responses" env_key names your key variable
Cursor OpenAI Settings → Models → API Keys Override OpenAI Base URL: https://api.yunshurouter.com/v1 OpenAI API Key
Cline OpenAI API Provider: OpenAI Compatible https://api.yunshurouter.com/v1 API Key
Continue OpenAI ~/.continue/config.yaml apiBase: https://api.yunshurouter.com/v1 with provider: openai apiKey
OpenClaw OpenAI ~/.openclaw/openclaw.json baseUrl: "https://api.yunshurouter.com/v1" with api: "openai-completions" apiKey
Hermes Agent OpenAI ~/.hermes/config.yaml base_url: https://api.yunshurouter.com/v1 with provider: custom api_key

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 /v1 in ANTHROPIC_BASE_URL.
  • ANTHROPIC_AUTH_TOKEN is sent as Authorization: Bearer, which we accept. ANTHROPIC_API_KEY is sent as x-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_failed Wrong or revoked key, or the key was not sent
404 not_found Wrong path. Recheck /v1
402 insufficient_balance 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.