> ## Documentation Index
> Fetch the complete documentation index at: https://docs.venice.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 视觉

> 通过与 OpenAI 兼容的聊天补全 API，使用多模态消息内容和 Venice 具备视觉能力的聊天模型分析图片。

视觉模型可以在处理文本提示的同时分析图片。可用于图像理解、信息提取、分类、视觉问答以及多模态推理。

Venice 支持与 OpenAI 兼容的多模态聊天消息。将文本块和图片块放入同一条用户消息中，然后把请求发送给具备视觉能力的模型即可。

## 基本用法

<CodeGroup>
  ```python Python theme={"system"}
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["VENICE_API_KEY"],
      base_url="https://api.venice.ai/api/v1",
  )

  response = client.chat.completions.create(
      model="qwen3-vl-235b-a22b",
      messages=[
          {
              "role": "user",
              "content": [
                  {"type": "text", "text": "Describe this image in three bullets."},
                  {
                      "type": "image_url",
                      "image_url": {
                          "url": "https://www.gstatic.com/webp/gallery/1.jpg"
                      },
                  },
              ],
          }
      ],
  )

  print(response.choices[0].message.content)
  ```

  ```javascript Node.js theme={"system"}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: "https://api.venice.ai/api/v1",
  });

  const response = await client.chat.completions.create({
    model: "qwen3-vl-235b-a22b",
    messages: [
      {
        role: "user",
        content: [
          { type: "text", text: "Describe this image in three bullets." },
          {
            type: "image_url",
            image_url: {
              url: "https://www.gstatic.com/webp/gallery/1.jpg",
            },
          },
        ],
      },
    ],
  });

  console.log(response.choices[0].message.content);
  ```

  ```bash cURL theme={"system"}
  curl https://api.venice.ai/api/v1/chat/completions \
    -H "Authorization: Bearer $VENICE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "qwen3-vl-235b-a22b",
      "messages": [
        {
          "role": "user",
          "content": [
            {"type": "text", "text": "Describe this image in three bullets."},
            {
              "type": "image_url",
              "image_url": {
                "url": "https://www.gstatic.com/webp/gallery/1.jpg"
              }
            }
          ]
        }
      ]
    }'
  ```
</CodeGroup>

## 使用 Base64 图片

当图片位于本地或属于私有内容时，你也可以传入 base64 数据 URL：

```json theme={"system"}
{
  "type": "image_url",
  "image_url": {
    "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
  }
}
```

## 选择视觉模型

可在 [文本模型](/models/text) 页面或通过 [Models API](/api-reference/endpoint/models/list) 查找支持视觉的模型。模型能力列表中会标明其是否支持视觉。

<Tip>
  对于类文档类的输入，如果希望 Venice 从文件中提取文本，请使用 [文件输入](/guides/features/file-inputs)。当视觉版式或图像内容本身很重要时，才使用视觉能力。
</Tip>

## 提示词建议

* 明确告诉模型关注的重点：物体、文字、版式、安全性、缺陷或差异等。
* 如果你的应用需要可解析的字段，请要求模型给出结构化输出。
* 保证图片 URL 对 API 可访问，或对私有图片使用 base64 数据 URL。
* 若图片会与较长指令一起使用，请选择具有足够上下文长度的模型。

## 相关资源

* [Chat Completions API](/api-reference/endpoint/chat/completions)
* [文本模型](/models/text)
* [文件输入指南](/guides/features/file-inputs)
* [结构化响应指南](/guides/features/structured-responses)
