SDK Integration

Applicable role: Developer Last updated: 2026-08-06

The platform is compatible with official SDKs in OpenAI and Messages compatible formats. No need to switch SDKs — just change two lines of configuration (Base URL + API Key) to point your existing code to the platform.

You can find the platform API endpoint in the console. The OpenAI Compatible route prefix is /v1, and authentication uses Authorization: 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",           # ← Change to your platform Key
    base_url="https://<your-api-endpoint>"   # ← Use the domain root URL
)
 
resp = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "你好"}]
)
print(resp.choices[0].message.content)

Installation: pip install openai


2. OpenAI Node.js SDK

import OpenAI from "openai";
 
const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://<your-api-endpoint>",
});
 
const resp = await client.chat.completions.create({
  model: "deepseek-v4-flash",
  messages: [{ role: "user", content: "你好" }],
});
 
console.log(resp.choices[0].message.content);

Installation: npm install openai


3. Messages Compatible SDK (anthropic Package)

If you are using the Messages compatible SDK, change base_url to point to the platform:

from anthropic import Anthropic
 
client = Anthropic(
    api_key="YOUR_API_KEY",
    base_url="https://<your-api-endpoint>"  # Anthropic SDK uses the domain root URL
)
 
resp = client.messages.create(
    model="deepseek-v4-flash",
    max_tokens=1024,
    messages=[{"role": "user", "content": "你好"}]
)
print(resp.content[0].text)

Installation: pip install anthropic

The Anthropic SDK uses the /v1/messages endpoint, and max_tokens is a required parameter.


4. Other Languages / General Pattern

The platform provides a standard HTTP API, so any language capable of sending HTTP requests can integrate with it.

Go

// Use the OpenAI compatible endpoint with a custom BaseURL
config := openai.DefaultConfig("YOUR_API_KEY")
config.BaseURL = "https://<your-api-endpoint>"
client := openai.NewClientWithConfig(config)

Generic curl (Any Environment)

curl https://<your-api-endpoint>/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"你好"}]}'

5. Integration Checklist

When migrating to the platform, verify each item:

  • base_url / baseURL points to the platform
  • api_key has been replaced with your platform Key (starts with sk-)
  • The model field contains the model name (e.g., deepseek-v4-flash, which you can find in the "Call Guide" or "Model Plaza"); if the admin user has enabled group identifier routing, you can also use the call name with group identifier shown on the call guide page
  • The target group / model is within your account's available scope
  • The rest of your business code requires no changes

By default, simply use the model name in the model field. For the difference between model name and group identifier formats, see Call Guide and Routing (group identifier routing is an advanced feature and is disabled by default).


Next Steps