Skip to content

千问视觉理解

千问视觉理解通过 OpenAI 兼容的 Chat Completions 接口调用。图片、视频和文字放在同一个 messages[].content 数组中,客户端只需要请求 Cubicspaces 的 /v1/chat/completions

请求地址

http
POST /v1/chat/completions

支持模型

模型输入输出适合场景
qwen3.6-plus文本、图像、视频文本图像与视频理解、文字提取、复杂视觉推理

实际可用模型以账户权限和平台配置为准。qwen3.6-plus 支持长上下文,适合多图、多页文档、长视频分析和需要推理过程的视觉任务。

图像与视频理解

单图理解

bash
curl https://cubicspaces.cloud/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.6-plus",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "image_url",
            "image_url": {
              "url": "https://example.com/product.jpg"
            }
          },
          {
            "type": "text",
            "text": "请描述这张图中的主体、场景和可能的用途。"
          }
        ]
      }
    ]
  }'

多图对比

bash
curl https://cubicspaces.cloud/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.6-plus",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "image_url", "image_url": { "url": "https://example.com/before.jpg" } },
          { "type": "image_url", "image_url": { "url": "https://example.com/after.jpg" } },
          { "type": "text", "text": "对比两张图片,列出主要变化。" }
        ]
      }
    ]
  }'

视频理解

视频可以传公网可访问的 URL,也可以传抽帧后的图片 URL 列表。长视频建议使用流式输出,避免客户端等待时间过长。

bash
curl https://cubicspaces.cloud/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.6-plus",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "video",
            "video": "https://example.com/demo.mp4"
          },
          {
            "type": "text",
            "text": "请按时间顺序总结视频中的关键事件,并输出 JSON 数组,字段为 start_time、end_time、event。"
          }
        ]
      }
    ],
    "stream": true,
    "stream_options": {
      "include_usage": true
    }
  }'

如果客户端已经完成抽帧,也可以传图片帧数组:

json
{
  "type": "video",
  "video": [
    "https://example.com/frame-001.jpg",
    "https://example.com/frame-002.jpg",
    "https://example.com/frame-003.jpg"
  ],
  "fps": 2
}

文字提取

通用图片、截图、票据和表格可以直接用 qwen3.6-plus 提取文字或结构化字段。需要稳定的机器可读结果时,建议在提示词里明确输出 JSON,并说明缺失字段如何处理。

bash
curl https://cubicspaces.cloud/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.6-plus",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "image_url",
            "image_url": {
              "url": "https://example.com/invoice.jpg"
            }
          },
          {
            "type": "text",
            "text": "请从图片中提取发票代码、发票号码、日期、金额和购买方名称,以 JSON 输出;无法识别的字段填 null。"
          }
        ]
      }
    ],
    "enable_thinking": false,
    "response_format": {
      "type": "json_object"
    }
  }'

视觉推理

qwen3.6-plus 支持视觉推理。复杂题目、图表分析、物体关系判断或视频事件归因场景建议开启流式输出,并通过 enable_thinking 控制是否返回推理过程。

bash
curl https://cubicspaces.cloud/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.6-plus",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "image_url",
            "image_url": {
              "url": "https://example.com/chart.png"
            }
          },
          {
            "type": "text",
            "text": "分析图表中的趋势,指出最可能的原因,并给出结论。"
          }
        ]
      }
    ],
    "enable_thinking": true,
    "stream": true
  }'

流式响应中,普通回答通常从 choices[0].delta.content 读取;如果模型返回推理过程,可从 choices[0].delta.reasoning_content 读取。

SDK 示例

python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://cubicspaces.cloud/v1"
)

response = client.chat.completions.create(
    model="qwen3.6-plus",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://example.com/screenshot.png"
                    },
                },
                {
                    "type": "text",
                    "text": "请识别截图中的文字,并整理成要点。"
                },
            ],
        }
    ],
    extra_body={
        "enable_thinking": False
    },
)

print(response.choices[0].message.content)
js
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://cubicspaces.cloud/v1"
});

const response = await client.chat.completions.create({
  model: "qwen3.6-plus",
  messages: [
    {
      role: "user",
      content: [
        {
          type: "image_url",
          image_url: {
            url: "https://example.com/screenshot.png"
          }
        },
        {
          type: "text",
          text: "请识别截图中的文字,并整理成要点。"
        }
      ]
    }
  ],
  enable_thinking: false
});

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

注意事项

  • 图片、视频 URL 必须能被平台服务端直接访问,不要使用需要登录、会跳转到 HTML 页面、或限制防盗链的地址。
  • 图片越大、视频越长,输入占用越多;生产环境建议按任务需要压缩图片、裁剪视频或先抽取关键帧。
  • enable_thinking 不是 OpenAI 标准参数。使用 OpenAI Python SDK 时请通过 extra_body 传入;直接 HTTP 请求可以放在 JSON 顶层。
  • 需要 JSON 输出时,尽量关闭思考模式,并在提示词里给出字段名、类型和缺失值规则。