OpenRouter [Vision]
集成
模型 id
openrouter/router/vision
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/openrouter/router/vision?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "openai/gpt-6-sol"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/openrouter/router/vision?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "openai/gpt-6-sol"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "openai/gpt-6-sol",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/openrouter/router/vision", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
# 1. Connect once (Claude Code; Cursor, VS Code, Claude Desktop: https://doitong.com/zh/developers/docs/mcp)
claude mcp add --transport http doitong-models https://api.doitong.com/v1/mcp \
--header "Authorization: Bearer $DOITONG_API_KEY"
# 2. Your agent calls the "run" tool with:
{
"model_id": "openrouter/router/vision",
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "openai/gpt-6-sol"
}
}
通过 Doitong API 调用 OpenRouter [Vision] 模型(openrouter/router/vision)。智能体文档:https://doitong.com/zh/developers/models/openrouter/router/vision.md
POST https://api.doitong.com/v1/run/openrouter/router/vision?wait=20
Authorization: Bearer $DOITONG_API_KEY
Content-Type: application/json
{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "openai/gpt-6-sol"
}
如果响应状态为 "queued" 或 "running",请轮询 GET https://api.doitong.com/v1/requests/REQUEST_ID?wait=20,直到状态变为 "succeeded";文件位于 outputs[].url。使用相同请求体 POST https://api.doitong.com/v1/quote/openrouter/router/vision,可在运行前返回确切价格。
每次运行最高 $14.34 按实际用量计费,剩余部分退款 在此页面运行
你的新 API 密钥。 它仅在此时显示,并且已填入下方的代码和 API 密钥字段中。请妥善保密:切勿将其放入在浏览器中运行的代码。
构建请求
控件根据模型架构生成。更改控件时,代码和价格会同步更新。
POST
/run/openrouter/router/vision?wait=20
报价 → $14.34
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/openrouter/router/vision?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "openai/gpt-6-sol"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/openrouter/router/vision?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "openai/gpt-6-sol"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "openai/gpt-6-sol",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/openrouter/router/vision", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run",
"arguments": {
"model_id": "openrouter/router/vision",
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "openai/gpt-6-sol"
},
"wait_seconds": 20
}
}
}
关于 OpenRouter [Vision]
接收 `prompt` 以及 `model` 中支持视觉能力的语言模型名称,然后返回文本答案。通过 `image_urls` 附加图片,通过 `pdf_urls` 附加文档,后者只接受 PDF 文件。还支持 `system_prompt`、0 到 2 的 `temperature`、`max_tokens`、可选的推理输出和网页搜索。
参数
发送规范名称或原生名称之一,不要同时发送两者。 规范名称
名称类型
默认值允许值
描述
image_urls可选
images
类型url[] · image
用于处理的图像 URL。
pdf_urls可选
类型string[]
以列表形式提供文档位置,且仅包含 PDF:指向 .pdf 文件的 http(s) URL,或格式为 data:application/pdf;base64,... 的数据 URI。当模型无法原生处理 PDF 时,OpenRouter 的文档解析器会处理这些文件。
prompt必填
类型string
应用于图像的提示词。
system_prompt可选
类型string | null
向模型提供指令或上下文的系统提示词。
model必填
类型string
标识要运行模型的名称。
reasoning可选
类型boolean
默认值false
是否在最终回答中包含推理。
temperature可选
类型number
默认值1
0 – 2
回答变化程度控制;输入不变时,0 可保证回答完全相同。增大该值会使回答偏离可预测的典型答案,趋向更多样且不常见的回答。
max_tokens可选
类型integer | null
≥ 1
将回答生成的 token 数量限制为不超过上下文长度减提示词长度的值。生成不能超过指定上限。
enable_web_search可选
类型boolean
默认值false
Web 访问开关,使模型可以选择是否以及何时搜索,包括在一次请求中进行多次搜索。搜索使用 OpenRouter 的服务端 Web 搜索工具获取实时信息。
web_search_options可选
类型object
Web 搜索配置,包括引擎选择、结果上限和域名过滤。仅当 enable_web_search 为 true 时使用。
web_search_options.engine可选
类型enum
默认值auto
autonativeexa
搜索引擎选择:当原生搜索不可用时,'auto' 和 'native' 都会回退到 Exa。'auto' 使用可用的提供商原生搜索;'native' 优先使用 OpenAI、Anthropic、Google、xAI 或 Perplexity 的内置搜索。若仅使用 Exa 的搜索 API,请选择 'exa'。
web_search_options.max_results可选
类型integer | null
1 – 25
每次 Exa 搜索调用的结果上限,范围为 1 到 25,默认值为 5。提供商原生搜索会忽略此设置。
web_search_options.max_uses可选
类型integer | null
≥ 1
每次请求的搜索上限;传递给 Anthropic 的原生搜索,但其他原生提供商会忽略。超过上限的调用会收到错误结果且不会运行。
web_search_options.max_total_results可选
类型integer | null
≥ 1
一次请求中所有搜索的合计结果上限。
web_search_options.search_context_size可选
类型enum
lowmediumhigh
Exa 每条结果的检索量;同时提供时由 max_characters 覆盖,提供商原生搜索会忽略。选择 low 获取 5K 个字符、medium 获取 15K 个字符或 high 获取 30K 个字符;不指定时,Exa 会将每条结果的数量自适应为约 2–4K 个字符。
web_search_options.max_characters可选
类型integer | null
1 – 100,000
Exa 每条结果的内容字符上限;同时提供时覆盖 search_context_size。设置 1 到 100,000 个字符的精确上限;提供商原生搜索会忽略此设置。
web_search_options.allowed_domains可选
类型string[]
Exa 和大多数提供商原生搜索的域名允许列表,将结果限制为列出的域名。Google 原生搜索不支持此设置。
web_search_options.excluded_domains可选
类型string[]
Exa 搜索及兼容的提供商原生搜索的域名排除列表;Google 和 OpenAI 原生搜索无法应用此列表。来自列出域名的结果会被排除。
web_search_options.user_location可选
类型object
大致用户位置,用于对提供商原生搜索结果进行地理偏置;Exa 不使用此信息。
web_search_options.user_location.type可选
类型string
默认值approximate
位置分类;唯一支持的值是 'approximate'。
web_search_options.user_location.city可选
类型string | null
城市名称,例如 'San Francisco'。
web_search_options.user_location.region可选
类型string | null
州或地区名称,例如 'California'。
web_search_options.user_location.country可选
类型string | null
以两个字母表示的国家标识符,例如 'US'。
web_search_options.user_location.timezone可选
类型string | null
采用 IANA 表示法的时区标识符,例如 'America/Los_Angeles'。
必填
规范名称,也可接受
文件参数接受公开的 https:// URL、最大 10 MB 的 data: URI,或上传文件的 file_url。 文件
输出
GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "openrouter/router/vision",
"status": "succeeded",
"created_at": "2026-10-20T12:00:00Z",
"started_at": "2026-10-20T12:00:02Z",
"completed_at": "2026-10-20T12:00:09Z",
"queue_position": null,
"cost": {
"credits": 14340,
"usd": "14.34",
"charged": 14340,
"refunded": 0
},
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "openai/gpt-6-sol"
},
"output": {
"output": "A close-up of a tiger's face focusing on its bright orange iris and the area around its eye, with white fur eyebrows and a contrasting black and rich orange striped fur pattern. The word \"FLUX\" is overlaid in bold, white, brush-stroke styled text across the tiger's face.",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 0,
"cost": 1.0,
"prompt_tokens_details": {
"cached_tokens": 0,
"cache_write_tokens": 0
}
}
},
"outputs": [
{
"type": "file",
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_size": 1843200,
"stored": true
}
],
"error": null,
"metrics": {
"inference_seconds": 6.8
},
"urls": {
"self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
"cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
}
}
你的文件,由你选择每个 outputs[].url 都是存储中的副本:可永久保存(按 GB-月付费),也可免费保存 7 天,由账户设置或 ?storage= 决定。
每个模型的结构相同图像、视频和音频均包含 type、url、content_type、width、height 和 duration。output 是模型自身的结果对象。
输出字段
- output
- string模型生成的结果。
- usage
- object {prompt_tokens, completion_tokens, total_tokens, cost, prompt_tokens_details} | nulltoken 消耗详情。
其他 OpenRouter Router 变体
更多模型:LLM
对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh/developers/models/openrouter/router/vision.md. 所有模型和指南: https://doitong.com/developers/llms.txt