概述
视觉理解功能允许 AI 模型分析图像内容,回答相关问题、提取文字(OCR)、识别物体等。
支持的模型
| 模型 | 最大分辨率 | 价格 |
|---|---|---|
gpt-4o | 2048x2048 | ¥0.035 / 1K tokens |
gpt-4-vision | 2048x2048 | ¥0.075 / 1K tokens |
gemini-3-pro | 4096x4096 | ¥0.025 / 1K tokens |
qwen-vl-max | 2048x2048 | ¥0.042 / 1K tokens |
请求示例
curl
curl https://api.lingyuncx.com/v1/chat/completions \
-H "Authorization: Bearer sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "这张图片里有什么?"},
{"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
]
}
]
}'
Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.lingyuncx.com/v1",
api_key="sk-xxxxxxxx"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "这张图片里有什么?"},
{"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
]
}]
)
print(response.choices[0].message.content)
应用场景
- 图像描述:分析图片内容并生成描述
- OCR 文字识别:提取图片中的文字信息
- 图表分析:解读数据图表、流程图等
- 物体识别:识别图片中的物体、场景
- 视觉问答:基于图片内容回答问题
💡 提示
支持 base64 编码和图片 URL 两种方式上传图片。