ChatCompletions Format
Create model responses based on conversation history. Supports both streaming and non-streaming responses.
Compatible with OpenAI Chat Completions API.
Multimodal Description
messages[].content can accept an array of content. The item structure supports text, image_url, input_audio, file, video_url, and the actual available modalities depend on the selected model and channel capabilities.
curl "$BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $NODEKEY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Describe the selling points of the product in this image"},
{"type": "image_url", "image_url": {"url": "https://example.com/product.jpg"}}
]
}]
}'Gemini native multimodal calls use /v1beta/models/{model}:generateContent. The Gemini image generation model can also be called using the OpenAI chat format of this interface.
Authorization
BearerAuth
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
In: header
Request Body
application/json
模型 ID
对话消息列表
采样温度
10 <= value <= 2核采样参数
10 <= value <= 1生成数量
11 <= value是否流式响应
false停止序列
最大生成 Token 数
最大补全 Token 数
0-2 <= value <= 20-2 <= value <= 2推理强度 (用于支持推理的模型)
"low" | "medium" | "high"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