Sozdai LogoDocs

快速开始

几分钟接入:接口与 OpenAI 完全兼容,只需改一个 base_url。

#概览

接口与 OpenAI 完全兼容。用任意 OpenAI SDK 或工具,把 base_url 指向下面的地址、在请求头带上你的密钥,即可调用所有可用模型。

Base URL:https://api.sozdai.ai/v1

#3-Step Quickstart Guide

1

Get your API key

Create a secure API key in the console to authorize requests. Keep your key confidential.

API Keys

API keys are created inside the **API 密钥 (API Keys)** section. All keys start with `sk-corr-`.
2

Configure authorization headers

Include the API key in the request headers for authorization:

http
Authorization: Bearer sk-corr-...
3

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] 结尾。

python
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 字段同样支持:

参数类型说明
streamboolean是否流式返回(SSE)
max_tokensinteger最大生成 token 数
temperaturenumber采样温度,0–2
toolsarray函数调用(tools)
stopstring[]停止序列
reasoning_effortstring开启思考:low / medium / high

#错误码

出错时返回标准错误结构(error 对象含 message 与 type 字段)。常见状态码:

状态码含义
401密钥无效或缺失
402余额不足,请充值
404请求的模型不存在或不可用
429触发限流,请稍后重试
502服务暂时不可用,请稍后重试