视觉 — 请求中的图像
通过 image_url 或 base64 将图片发送到 /v1/chat/completions。支持 Claude 和 GPT-5.6。提供 curl、Python 和 Node.js 示例。
将图像与文本请求一起发送到 /v1/chat/completions:模型会描述图像内容、回答有关图像的问题或分析屏幕截图。支持 URL 和 base64。
支持的模型
| 参数 | 类型 | 描述 |
|---|---|---|
claude-opus-5.5 / claude-sonnet-5.5 | Claude | 完整的视觉支持,支持 URL 和 base64。 |
gpt-6.1-sol | GPT | URL 和 base64。最适合文档和图表。 |
图像必须可通过 URL 公开访问,也可以使用 base64 传递。私有 URL(已签名的 S3、内部网络)应使用 base64 传递。
请求格式
content 字段会变成由以下内容组成的数组:text 和 image_url。
curl https://getvibeapi.com/v1/chat/completions \
-H "Authorization: Bearer $GETVIBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-5.5",
"max_tokens": 256,
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What is in the picture? Describe it briefly."},
{"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}
]
}]
}'Base64 — 不带公共 URL
对于私有图片,请将文件编码为 base64,并将其作为 data URL 传递:
# base64 — for private images without a public URL
curl https://getvibeapi.com/v1/chat/completions \
-H "Authorization: Bearer $GETVIBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"max_tokens": 256,
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What is in the picture?"},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,/9j/4AAQ..."}}
]
}]
}'image_url parameters
| 参数 | 类型 | 描述 |
|---|---|---|
urlreq. | string | 公共图片 URL,或用于 base64 的 data:image/jpeg;base64,…。 |
detail | "auto" | "low" | "high" | 分析详细程度(仅 GPT)。默认为 "auto"。"high":使用更多 token,质量更高。 |