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-TW/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-TW/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
網路存取開關,允許模型選擇是否及何時搜尋,包括在單一請求中進行多次搜尋。搜尋使用 OpenRouter 的伺服器端網路搜尋工具取得即時資訊。
web_search_options選填
類型object
網路搜尋設定,包括引擎選擇、結果上限和網域篩選。僅在 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-TW/developers/models/openrouter/router/vision.md. 所有模型與指南: https://doitong.com/developers/llms.txt