AI model interfaceChatNative OpenAI format
ChatCompletions Format
Create model responses based on conversation history. Supports both streaming and non-streaming responses.
Compatible with OpenAI Chat Completions API.
Authorization
BearerAuth
AuthorizationBearer <token>
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
In: header
Request Body
application/json
model*string
模型 ID
messages*
对话消息列表
temperature?number
采样温度
Default
1Range
0 <= value <= 2top_p?number
核采样参数
Default
1Range
0 <= value <= 1n?integer
生成数量
Default
1Range
1 <= valuestream?boolean
是否流式响应
Default
falsestream_options?
stop?string|
停止序列
max_tokens?integer
最大生成 Token 数
max_completion_tokens?integer
最大补全 Token 数
presence_penalty?number
Default
0Range
-2 <= value <= 2frequency_penalty?number
Default
0Range
-2 <= value <= 2logit_bias?
user?string
tools?
tool_choice?string|
response_format?
seed?integer
reasoning_effort?string
推理强度 (用于支持推理的模型)
Value in
"low" | "medium" | "high"modalities?array<string>
audio?
Response Body
application/json
application/json
application/json
curl -X POST "https://nodekey.xinghanyun.cn/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "请描述图片中的商品卖点。" }, { "type": "image_url", "image_url": { "url": "https://example.com/product.jpg" } } ] } ], "temperature": 1, "top_p": 1, "n": 1, "stream": false, "stream_options": { "include_usage": false }, "max_tokens": 1, "max_completion_tokens": 1, "presence_penalty": 1, "frequency_penalty": 1, "logit_bias": {}, "tools": [ { "type": "function", "function": { "name": "example-name", "description": "示例描述", "parameters": {} } } ], "response_format": { "type": "text", "json_schema": {} }, "seed": 1, "reasoning_effort": "low", "modalities": [ "text" ], "audio": {} }'{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "string",
"choices": [
{
"index": 0,
"message": {
"role": "system",
"content": "string",
"name": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"tool_call_id": "string",
"reasoning_content": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
},
"system_fingerprint": "string"
}{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}Last updated on