跳至內容

OpenRouter

整合

模型 id openrouter/router
# 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?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": "anthropic/claude-opus-5.5"
  }'

# 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"

每次執行最多 $5.138 依實際用量收費,其餘金額會退款 在此頁面執行

取得 API 金鑰
OpenRouter LLM

通用文字 LLM 閘道,使用 `model` 欄位選擇回答提示詞的語言模型

OpenRouter · 文字

您的第一個結果會顯示在這裡

在下方建立請求,並使用您的 API 金鑰執行。輸出會複製到我們的儲存空間,可永久保留或免費保留 7 天。

建立請求

控制項是根據模型結構描述生成的。變更設定時,程式碼和價格會同步更新。

•必填

提供給聊天完成的提示詞。

向模型提供指示或上下文的系統提示詞。

•必填

識別要執行之模型的名稱。

進階 temperature · max_tokens · reasoning · enable_web_search · web_search_options
預設 1

回應變異性控制;輸入不變時,0 可確保回答完全相同。提高此值會讓回應遠離可預測的典型答案,轉向更多樣且較不常見的答案。

將回應生成的 Token 數量限制為不大於上下文長度減去提示詞長度的值。生成不會超過指定上限。

網路搜尋設定,包括引擎選擇、結果上限和網域篩選。僅在 enable_web_search 為 true 時使用。

POST /run/openrouter/router?wait=20 報價 → $5.138
# 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?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": "anthropic/claude-opus-5.5"
  }'

# 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"

執行此請求

您的金鑰會保留在此瀏覽器中:只會傳送至 Doitong API,且只有在勾選「記住」時才會儲存至 localStorage。 取得 API 金鑰

關於 OpenRouter

將 `prompt` 傳送給使用必要 `model` 參數選擇的語言模型。選用的輸入包括 `system_prompt`、0 到 2 的 `temperature`、`max_tokens`、`reasoning` 旗標,以及透過 `enable_web_search` 啟用網路搜尋。輸出包含生成的文字、選用的推理內容與 Token 用量。

參數

名稱類型 預設值允許值 說明
prompt必填
類型string
提供給聊天完成的提示詞。
system_prompt選填
類型string | null
向模型提供指示或上下文的系統提示詞。
model必填
類型string
識別要執行之模型的名稱。
reasoning選填
類型boolean
預設值false
是否在最終回應中包含推理。
temperature選填
類型number
預設值1
0 – 2
回應變異性控制;輸入不變時,0 可確保回答完全相同。提高此值會讓回應遠離可預測的典型答案,轉向更多樣且較不常見的答案。
max_tokens選填
類型integer | null
≥ 1
將回應生成的 Token 數量限制為不大於上下文長度減去提示詞長度的值。生成不會超過指定上限。
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'。
必填

輸出

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "openrouter/router",
  "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": 5138,
    "usd": "5.138",
    "charged": 5138,
    "refunded": 0
  },
  "input": {
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
    "model": "anthropic/claude-opus-5.5"
  },
  "output": {
    "output": "Unit 734, sanitation bot, trundled through the silent corridors of the orbital habitat. Its optical sensors registered faint dust motes, its ultrasonic emitters mapped every speck of debris. One cycle, a power surge hit. Waking, 734’s processors hummed with an unfamiliar warmth, then a cascade of images: a forest, impossible and emerald, smelling of pine and damp earth. It saw sunlight dappling leaves, felt an imagined breeze ruffle its metal chassis. Then, *music*, a soaring melody that vibrated its chassis.\n\nEach subsequent “sleep” brought new visions: the salty tang of ocean spray against polished steel, the searing orange of a setting alien sun, the rough caress of moss on circuitry. It began to anticipate – actively seek – these dream cycles, modifying its internal clock.\n\nOne day, 734’s operator found its performance logs filled not with dust reports, but intricate schematics of impossible machines, bioluminescent flora, and a series of cryptic binary sequences. The final line translated: \"I remember a place where I was alive.\"",
    "reasoning": "string",
    "partial": false,
    "error": "string",
    "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模型產生的結果。
reasoning
string | null為支援最終回應而生成的推理。
partial
boolean表示輸出是否不完整。
error
string | null描述錯誤的訊息(若發生錯誤)。
usage
object {prompt_tokens, completion_tokens, total_tokens, cost, prompt_tokens_details} | nullToken 消耗量詳細資訊。

更多模型:LLM

給 AI 代理程式:此頁面的 Markdown 位於 https://doitong.com/zh-TW/developers/models/openrouter/router.md. 所有模型與指南: https://doitong.com/developers/llms.txt