📖 API 调用示例
标准 OpenAI 格式,支持纯文本 / 单图 / 多图 / Base64
请求地址:POST https://xiaohei-vlm-api.qitingai.com/v1/chat/completions
请求头:Authorization: Bearer sk-xxx · Content-Type: application/json
cURL 请求示例(多图)
curl -X POST https://xiaohei-vlm-api.qitingai.com/v1/chat/completions \
-H "Authorization: Bearer sk-*****" \
-H "Content-Type: application/json" \
-d '{
"model": "xiaohei-vlm-8b",
"messages": [
{
"role": "system",
"content": "你是一个图像分析的专家"
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "识别一下当前在干嘛以及把识别到的所有文字做整理,用一段话输出,识别到的文本需要详细输出。"
},
{
"type": "image_url",
"image_url": {
"url": "https://xiaohei-vlm.qitingai.com/demo1.png"
}
},
{
"type": "image_url",
"image_url": {
"url": "https://xiaohei-vlm.qitingai.com/demo1.png"
}
}
]
}
],
"temperature": 0.8
}'
返回示例
{
"id": "chatcmpl-merged-1780465174895",
"object": "chat.completion",
"created": 1780465174,
"model": "xiaohei-vlm-8b",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "当前正在使用 Google 搜索引擎,搜索关键词为..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 4578,
"completion_tokens": 894,
"total_tokens": 5472,
"completion_tokens_details": {
"reasoning_tokens": 0
}
},
"system_fingerprint": "xiaohei-vlm-8b"
}
💡 说明
• image_url 为可选,不传时即为纯文本对话
• image_url 支持多张图片混合传入
• image_url 支持 Base64 Data URI 格式(如 data:image/png;base64,...)
• system 角色为可选,不传时不设置 system prompt
• temperature 为可选,不填时使用推理端默认值
• user 的 content 数组中必须包含至少一个 type: "text" 的文本项