SDK Integration
Applies to: Developers Updated: 2026-07-14
The platform is compatible with the official OpenAI and Anthropic SDKs. There's no need to switch SDKs — just change two lines of configuration (Base URL + API Key) to move your existing code onto the platform.
The API address is
YOUR_API_BASE_URL, the route prefix is/v1, and authentication usesAuthorization: Bearer sk-xxx.
1. OpenAI Python SDK
The most common integration method. If you already have OpenAI code, just change two lines:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY", # ← 改成平台的 Key
base_url="YOUR_API_BASE_URL" # ← 加这一行
)
resp = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "你好"}]
)
print(resp.choices[0].message.content)Install: pip install openai
2. OpenAI Node.js SDK
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "YOUR_API_BASE_URL",
});
const resp = await client.chat.completions.create({
model: "claude-sonnet-4-6",
messages: [{ role: "user", content: "你好" }],
});
console.log(resp.choices[0].message.content);Install: npm install openai
3. Anthropic SDK
If you use the native Claude SDK, change base_url to point to the platform:
from anthropic import Anthropic
client = Anthropic(
api_key="YOUR_API_KEY",
base_url="YOUR_API_BASE_URL"
)
resp = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "你好"}]
)
print(resp.content[0].text)Install: pip install anthropic
The Anthropic SDK uses the
/v1/messagesendpoint, andmax_tokensis a required parameter.
4. Other Languages / General Pattern
The platform is a standard HTTP API, so any language capable of sending HTTP requests can integrate with it.
Go
// 使用 OpenAI 兼容端点,设置自定义 BaseURL
config := openai.DefaultConfig("YOUR_API_KEY")
config.BaseURL = "YOUR_API_BASE_URL"
client := openai.NewClientWithConfig(config)Universal curl (any environment)
curl YOUR_API_BASE_URL/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-4-6","messages":[{"role":"user","content":"你好"}]}'5. Integration Checklist
When migrating to the platform, verify each item:
-
base_url/baseURLnow points to the platform -
api_keyhas been replaced with the platform's Key (starting withsk-) - The
modelfield contains the model name (e.g.claude-sonnet-4-6, which you can find in the "Usage Guide" or "Model Marketplace"); if your organization has group-identifier routing enabled, you can also use the group-identifier call name from the Usage Guide page - The target group / model is within the available range of your account
- The rest of your business code requires no changes
By default, the
modelfield can simply use the model name. For the difference between the model-name and group-identifier formats, see Usage Guide and Routing (group-identifier routing is an advanced feature and is disabled by default).
Next Steps
- Understand how to write the
modelfield and the routing rules → Usage Guide and Routing - Integrate Claude Code / Cursor / frameworks → Third-Party Tool Integration
- Handle errors → Error Codes and Troubleshooting
