快速开始
几分钟接入:接口与 OpenAI 完全兼容,只需改一个 base_url。
LLM Chat completions
Call leading models like Claude, GPT-4, and DeepSeek via a single OpenAI-compatible API endpoint.
Media generation
Submit asynchronous media generation tasks for image, video, and music models with simple polling.
Prompt caching
Save up to 90% in token pricing on supported models by caching long, static context sequences.
Deep thinking models
Control reasoning effort (low/medium/high) for models like o1/o3 and DeepSeek-R1 natively.
#概览
接口与 OpenAI 完全兼容。用任意 OpenAI SDK 或工具,把 base_url 指向下面的地址、在请求头带上你的密钥,即可调用所有可用模型。
https://api.sozdai.ai/v1#3-Step Quickstart Guide
Get your API key
Create a secure API key in the console to authorize requests. Keep your key confidential.
API Keys
Configure authorization headers
Include the API key in the request headers for authorization:
Authorization: Bearer sk-corr-...Send your first request
Point the API client to the Base URL and invoke the completion endpoint:
curl https://api.sozdai.ai/v1/chat/completions \
-H "Authorization: Bearer $CORRY_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [{"role": "user", "content": "Hello"}]
}'#流式输出
设置 stream: true 即可逐 token 接收,格式与 OpenAI 一致,以 data: [DONE] 结尾。
resp = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Hello"}],
stream=True,
)
for chunk in resp:
print(chunk.choices[0].delta.content or "", end="")#支持的参数
请求体与 OpenAI 一致。常用参数如下,其余 OpenAI 字段同样支持:
| 参数 | 类型 | 说明 |
|---|---|---|
stream | boolean | 是否流式返回(SSE) |
max_tokens | integer | 最大生成 token 数 |
temperature | number | 采样温度,0–2 |
tools | array | 函数调用(tools) |
stop | string[] | 停止序列 |
reasoning_effort | string | 开启思考:low / medium / high |
#错误码
出错时返回标准错误结构(error 对象含 message 与 type 字段)。常见状态码:
| 状态码 | 含义 |
|---|---|
401 | 密钥无效或缺失 |
402 | 余额不足,请充值 |
404 | 请求的模型不存在或不可用 |
429 | 触发限流,请稍后重试 |
502 | 服务暂时不可用,请稍后重试 |