Chat Completions

接口地址

text POST https://seeknode.cn/v1/chat/completions

请求参数

参数类型必填说明
modelstring模型名称,如 gpt-5.4-mini
messagesarray对话消息列表
streamboolean是否流式输出,默认 false
temperaturenumber采样温度,0-2,默认 1
top_pnumber核采样参数,0-1
max_tokensinteger最大输出 token 数
frequency_penaltynumber频率惩罚,-2 到 2
presence_penaltynumber存在惩罚,-2 到 2
seedinteger随机种子
toolsarray工具/函数调用定义

请求示例

基础对话

bash curl https://seeknode.cn/v1/chat/completions \ -H "Authorization: Bearer sk-你的令牌" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.4-mini", "messages": [ {"role": "system", "content": "你是一个有用的助手。"}, {"role": "user", "content": "你好!"} ], "temperature": 0.7, "max_tokens": 1024 }'

流式输出

bash curl https://seeknode.cn/v1/chat/completions \ -H "Authorization: Bearer sk-你的令牌" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.4-mini", "messages": [{"role": "user", "content": "你好"}], "stream": true }'

多轮对话

bash curl https://seeknode.cn/v1/chat/completions \ -H "Authorization: Bearer sk-你的令牌" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.4-mini", "messages": [ {"role": "user", "content": "1+1等于几?"}, {"role": "assistant", "content": "1+1=2"}, {"role": "user", "content": "再加上3呢?"} ] }'

工具调用(Function Calling)

bash curl https://seeknode.cn/v1/chat/completions \ -H "Authorization: Bearer sk-你的令牌" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.4-mini", "messages": [{"role": "user", "content": "北京的天气怎么样?"}], "tools": [{ "type": "function", "function": { "name": "get_weather", "description": "获取指定城市的天气", "parameters": { "type": "object", "properties": { "location": {"type": "string", "description": "城市名称"} }, "required": ["location"] } } }] }'

视觉识别(多模态)

bash curl https://seeknode.cn/v1/chat/completions \ -H "Authorization: Bearer sk-你的令牌" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.4-mini", "messages": [ { "role": "user", "content": [ {"type": "text", "text": "请描述这张图片。"}, { "type": "image_url", "image_url": {"url": "https://example.com/image.jpg"} } ] } ] }'

建议先在 Playground 用 Image URL 验证模型可用,再接入生产。

响应字段

返回结构与 OpenAI Chat Completions 一致,关键字段:

字段说明
id本次响应 ID
model实际响应使用的模型名
choices[].message.content模型输出文本
choices[].message.tool_calls工具调用(如有)
usage.prompt_tokens输入 Token 数
usage.completion_tokens输出 Token 数
usage.total_tokens总 Token 数