OpenAI 兼容接口
超智云创 API 使用 OpenAI 兼容格式,适配大多数 SDK、插件和客户端。
Base URL
text
https://api.chaozhi.chat/v1鉴权方式
所有请求使用 Bearer Token:
http
Authorization: Bearer sk-你的APIKeyChat Completions
bash
curl https://api.chaozhi.chat/v1/chat/completions \
-H "Authorization: Bearer sk-你的APIKey" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{"role": "system", "content": "你是一个简洁可靠的助手。"},
{"role": "user", "content": "写一句欢迎语"}
],
"temperature": 0.7
}'Python 示例
python
from openai import OpenAI
client = OpenAI(
api_key="sk-你的APIKey",
base_url="https://api.chaozhi.chat/v1",
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "user", "content": "你好"}
],
)
print(resp.choices[0].message.content)Node.js 示例
js
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-你的APIKey",
baseURL: "https://api.chaozhi.chat/v1",
});
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [
{ role: "user", content: "你好" },
],
});
console.log(resp.choices[0].message.content);模型列表
bash
curl https://api.chaozhi.chat/v1/models \
-H "Authorization: Bearer sk-你的APIKey"