Native API Calls (SDK Examples)
Replace {baseUrl} with your platform API root, without a trailing / or /v1, and sk-your-api-key with your model API key. Select models supported by your token's group.
Python (OpenAI SDK)
pip install openai
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="{baseUrl}/v1",
)
resp = client.chat.completions.create(
model="gpt-5.2",
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain intelligent routing in one sentence."},
],
)
print(resp.choices[0].message.content)
Streaming
stream = client.chat.completions.create(
model="gpt-5.2",
messages=[{"role": "user", "content": "Write a four-line poem about a tree."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
Node.js (openai package)
npm install openai
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-your-api-key",
baseURL: "{baseUrl}/v1",
});
const resp = await client.chat.completions.create({
model: "gpt-5.2",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);
Anthropic SDK
pip install anthropic
from anthropic import Anthropic
client = Anthropic(
api_key="sk-your-api-key",
base_url="{baseUrl}", # Do not append /v1
)
msg = client.messages.create(
model="claude-sonnet-4-5-20250929",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)
Google GenAI SDK (native Gemini)
pip install google-genai
from google import genai
client = genai.Client(
api_key="sk-your-api-key",
http_options={"base_url": "{baseUrl}"},
)
resp = client.models.generate_content(
model="gemini-2.5-pro",
contents="Hello",
)
print(resp.text)
Image and video generation
For the OpenAI-compatible image endpoint, create an OpenAI client:
from openai import OpenAI
client = OpenAI(api_key="sk-your-api-key", base_url="{baseUrl}/v1")
resp = client.images.generate(
model="gemini-3-pro-image",
prompt="A red fox standing in the snow, photorealistic",
size="1024x1024",
)
print(resp.data[0].url)
Video generation uses asynchronous tasks: submit a request, save the returned task_id, and poll for results. The platform provides shared video generation and task-query endpoints as well as provider-specific endpoints for Kling, Sora, Jimeng, and Volcengine. See the video generation API for parameters.
MiniMax H3/H3-Max, H3 2K upgrades, and Context-IR use native asynchronous /v2 endpoints. See the MiniMax H3 integration guide. The returned task_id is a platform task ID; read task.content.url for video or task.content.prompt for Context-IR.
Endpoint reference
| Endpoint | Method | Purpose |
|---|---|---|
/v1/models | GET | List available models |
/v1/chat/completions | POST | Chat completions |
/v1/responses | POST | Responses API |
/v1/messages | POST | Native Anthropic messages |
/v1/embeddings | POST | Text embeddings |
/v1/audio/speech | POST | Text to speech |
/v2/video_generation | POST | MiniMax H3/H3-Max video generation |
/v2/video_regeneration | POST | H3 2K upgrade |
/v2/h3_context_ir | POST | Context-IR prompt generation |
/v2/query/video_generation/{task_id} | GET | Query MiniMax H3 tasks |
/v1beta/models | GET | Native Gemini model list |
/api/user/self | GET | Account information; requires a management access token |
/api/log/self | GET | Request logs; requires a management access token |