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"
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?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": "anthropic/claude-opus-5.5"
}),
});
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": "anthropic/claude-opus-5.5",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/openrouter/router", 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/ja/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",
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "anthropic/claude-opus-5.5"
}
}
Doitong APIを通じてOpenRouterモデル(openrouter/router)を呼び出します。エージェント向けドキュメント: https://doitong.com/ja/developers/models/openrouter/router.md
POST https://api.doitong.com/v1/run/openrouter/router?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": "anthropic/claude-opus-5.5"
}
レスポンスのステータスが"queued"または"running"の場合、"succeeded"になるまでGET https://api.doitong.com/v1/requests/REQUEST_ID?wait=20をポーリングしてください。ファイルはoutputs[].urlにあります。同じボディでPOST https://api.doitong.com/v1/quote/openrouter/routerを実行すると、実行前の正確な価格が返されます。
1 回の実行につき最大 $5.138 実際の使用量に応じて課金され、残額は返金されます このページで実行
新しいAPIキーです。 これは今だけ表示され、コードと下記のAPIキー欄にすでに入力されています。秘密にしてください。ブラウザで実行されるコードに決して含めないでください。
OpenRouter · テキスト
最初の結果がここに表示されます
以下でリクエストを作成し、APIキーで実行してください。出力はストレージにコピーされ、永久保存または無料で7日保存されます。
リクエストを作成
コントロールはモデルスキーマから生成されます。値を変更するとコードと価格が更新されます。
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"
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?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": "anthropic/claude-opus-5.5"
}),
});
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": "anthropic/claude-opus-5.5",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/openrouter/router", 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",
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "anthropic/claude-opus-5.5"
},
"wait_seconds": 20
}
}
}
OpenRouterについて
必須の`model`パラメータで選択した言語モデルに`prompt`を送信します。任意入力として、`system_prompt`、0~2の`temperature`、`max_tokens`、`reasoning`フラグ、`enable_web_search`によるWeb検索を指定できます。出力には生成テキスト、任意の推論、トークン使用量が含まれます。
パラメータ
名前型
デフォルト許可される値
説明
prompt必須
型string
チャット補完に指定するプロンプト。
system_prompt任意
型string | null
モデルに指示やコンテキストを与えるシステムプロンプト。
model必須
型string
実行するモデルを識別する名前。
reasoning任意
型boolean
デフォルトfalse
最終レスポンスに推論を含めるかどうか。
temperature任意
型number
デフォルト1
0 – 2
レスポンスの変動性を制御する値。入力が同じ場合、0では同一の回答が保証されます。値を増やすと、予測しやすい典型的な回答から離れ、より多様で一般的でない回答になります。
max_tokens任意
型integer | null
≥ 1
生成するレスポンスのトークン数を、コンテキスト長からプロンプト長を引いた値以下に制限します。生成は指定した上限を超えません。
enable_web_search任意
型boolean
デフォルトfalse
モデルが検索するかどうか、また検索時期を選択できるウェブアクセス切り替え。1つのリクエスト内で複数回検索できます。検索にはOpenRouterのサーバー側ウェブ検索ツールを使用し、リアルタイム情報を取得します。
web_search_options任意
型object
検索エンジンの選択、結果数の上限、ドメインフィルタリングを含むウェブ検索設定。enable_web_searchがtrueの場合のみ使用されます。
web_search_options.engine任意
型enum
デフォルトauto
autonativeexa
検索エンジンの選択。native検索が利用できない場合、'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
リクエストごとの検索上限。native検索ではAnthropicに渡されますが、他のnativeプロバイダーでは無視されます。上限を超える呼び出しはエラー結果を返し、実行されません。
web_search_options.max_total_results任意
型integer | null
≥ 1
1つのリクエスト内のすべての検索に対する合計結果数の上限。
web_search_options.search_context_size任意
型enum
lowmediumhigh
Exaの結果ごとの取得量。両方を指定した場合はmax_charactersが優先され、native検索では無視されます。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文字の正確な最大値を設定できます。native検索では無視されます。
web_search_options.allowed_domains任意
型string[]
Exaおよびほとんどのnative検索プロバイダーのドメイン許可リスト。結果を指定ドメインに制限します。Googleのnative検索には対応していません。
web_search_options.excluded_domains任意
型string[]
Exa検索および対応するnativeプロバイダーのドメイン除外リスト。GoogleとOpenAIのnative検索には適用できません。指定ドメイン由来の結果は除外されます。
web_search_options.user_location任意
型object
native検索結果に地理的な偏りを与える、おおよそのユーザー所在地。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
2文字で表す国識別子。例:'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はストレージ上のコピーです。アカウント設定または?storage=により、永久保存(GB・月単位で有料)または無料で7日保存できます。
すべてのモデルで同じ形式画像、動画、音声のいずれでも、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} | nullトークン消費量の詳細。
その他のOpenRouter Routerバリアント
その他のモデル: LLM
AIエージェント向け:このページのMarkdown版はこちらです: https://doitong.com/ja/developers/models/openrouter/router.md. すべてのモデルとガイド: https://doitong.com/developers/llms.txt