Base URLs & Auth
All APIs are accessed through a unified gateway address. The mainstream path is the OpenAI-compatible protocol + Bearer token auth; the Anthropic / Gemini native endpoints are extended compatibility, covered below.
Base URL (BASE_URL)
OpenAI-compatible endpoints:
TIP
With the official OpenAI SDKs, set base_url to https://api-model.shuntianchuang.cn/v1 (with /v1 — the SDK appends the rest of the path); when sending raw HTTP requests, use the full URLs in the table above.
The base URLs can also be viewed and copied from the API Info card on the console's "Overview" page, which additionally offers a "Test latency" entry.
Authentication
Different protocol endpoints use different auth headers — first figure out which kind of endpoint you're calling:
API Keys are created on the console's "API Keys" page — see API Key Management. The OpenAI-compatible endpoints match the official OpenAI API in both paths and request/response formats — with an SDK, just swap base_url for this site's address and api_key for a site token; no other code changes. Three common ways to set it up:
# Attach the Authorization header to every request
curl https://api-model.shuntianchuang.cn/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "deepseek-v4-flash",
"messages": [{ "role": "user", "content": "Hello" }]
}'
# Or store it in a variable for reuse
export SHUNTIANCHUANG_API_KEY=sk-your-token
curl https://api-model.shuntianchuang.cn/v1/chat/completions \
-H "Authorization: Bearer $SHUNTIANCHUANG_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "deepseek-v4-flash", "messages": [{ "role": "user", "content": "Hello" }] }'
import os
from openai import OpenAI
# Environment variables are recommended, to keep the token out of code
client = OpenAI(
api_key=os.environ.get("SHUNTIANCHUANG_API_KEY", "sk-your-token"),
base_url="https://api-model.shuntianchuang.cn/v1",
)
import OpenAI from 'openai';
// Environment variables are recommended, to keep the token out of code
const client = new OpenAI({
apiKey: process.env.SHUNTIANCHUANG_API_KEY || 'sk-your-token',
baseURL: 'https://api-model.shuntianchuang.cn/v1',
});
Extended Compatibility: Anthropic / Gemini
For some models, the site also exposes Anthropic and Gemini native endpoints so the corresponding official SDKs and clients can connect directly (auth headers in Authentication above; already included in the SDK examples):
NOTE
Only some models support the multi-protocol endpoints — see Models for the supported list. On both endpoints, use a site model name (e.g. glm-5.2); the platform does not host Anthropic / Google official model names.
Anthropic SDK
Set base_url to the site root (without /v1 — the SDK appends /v1/messages) and authenticate with api_key (the SDK sends the x-api-key and anthropic-version headers automatically):
curl https://api-model.shuntianchuang.cn/v1/messages \
-H "x-api-key: sk-your-token" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.2",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "Hello" }]
}'
import os
from anthropic import Anthropic
client = Anthropic(
base_url="https://api-model.shuntianchuang.cn",
api_key=os.environ.get("SHUNTIANCHUANG_API_KEY", "sk-your-token"),
)
message = client.messages.create(
model="glm-5.2",
max_tokens=1024,
messages=[{ "role": "user", "content": "Hello" }],
)
print(message.content[0].text)
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
baseURL: 'https://api-model.shuntianchuang.cn',
apiKey: process.env.SHUNTIANCHUANG_API_KEY || 'sk-your-token',
});
const message = await client.messages.create({
model: 'glm-5.2',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello' }],
});
console.log(message.content[0].text);
Gemini SDK
Likewise set base_url to the site root (without /v1beta — the SDK appends the rest of the path); pass the token via api_key (mapped to the x-goog-api-key header):
# The model name is part of the URL, right before :generateContent
curl -X POST "https://api-model.shuntianchuang.cn/v1beta/models/glm-5.2:generateContent" \
-H "x-goog-api-key: sk-your-token" \
-H "Content-Type: application/json" \
-d '{
"contents": [{ "role": "user", "parts": [{ "text": "Hello" }] }]
}'
import os
from google import genai
client = genai.Client(
api_key=os.environ.get("SHUNTIANCHUANG_API_KEY", "sk-your-token"),
http_options={"base_url": "https://api-model.shuntianchuang.cn"},
)
response = client.models.generate_content(
model="glm-5.2",
contents="Hello",
)
print(response.text)
import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({
apiKey: process.env.SHUNTIANCHUANG_API_KEY || 'sk-your-token',
httpOptions: { baseUrl: 'https://api-model.shuntianchuang.cn' },
});
const response = await ai.models.generateContent({
model: 'glm-5.2',
contents: 'Hello',
});
console.log(response.text);
For full configuration guides to client tools like Claude Code and Codex, see App Integration.
Common Auth Problems
See Error Codes & Troubleshooting for the full error reference. For your first call, start with Quick Start.