OpenRouter
इंटीग्रेट करें
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/hi/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"
}
}
OpenRouter मॉडल (openrouter/router) को Doitong API के ज़रिए कॉल करें। एजेंट के लिए दस्तावेज़: https://doitong.com/hi/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" है, तो GET https://api.doitong.com/v1/requests/REQUEST_ID?wait=20 को तब तक पोल करें जब तक यह "succeeded" न हो जाए; फ़ाइलें outputs[].url में हैं। उसी बॉडी के साथ POST https://api.doitong.com/v1/quote/openrouter/router चलाने से रन से पहले सटीक कीमत मिलती है।
प्रति रन अधिकतम $5.138 तक वास्तविक उपयोग के अनुसार शुल्क लिया जाता है, बाकी रिफंड किया जाता है इसे इस पेज पर चलाएँ
आपकी नई API कुंजी। यह केवल अभी दिखाया गया है और कोड तथा नीचे दिए गए API कुंजी फ़ील्ड में पहले से मौजूद है। इसे गुप्त रखें: इसे कभी भी ब्राउज़र में चलने वाले कोड में न डालें।
आपका पहला परिणाम यहाँ आएगा
नीचे एक अनुरोध बनाएँ और उसे अपनी API कुंजी से चलाएँ। आउटपुट हमारे स्टोरेज में कॉपी किए जाते हैं और हमेशा के लिए या 7 दिन तक मुफ़्त में रखे जाते हैं।
अनुरोध बनाएँ
कंट्रोल मॉडल स्कीमा से जनरेट होते हैं। इन्हें बदलने पर कोड और कीमत अपडेट होती है।
/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
}
}
}
यह अनुरोध चलाएँ
आपकी key इसी ब्राउज़र में रहती है: इसे केवल Doitong API को भेजा जाता है और केवल तभी (localStorage) में सेव किया जाता है जब आप Remember चुनते हैं। API कुंजी प्राप्त करें
OpenRouter के बारे में
`prompt` को आवश्यक `model` पैरामीटर से चुने गए भाषा मॉडल को भेजता है। वैकल्पिक इनपुट में `system_prompt`, 0 से 2 तक का `temperature`, `max_tokens`, `reasoning` फ़्लैग और `enable_web_search` के ज़रिए वेब सर्च शामिल हैं। आउटपुट में जनरेट किया गया टेक्स्ट, वैकल्पिक रीजनिंग और टोकन उपयोग होता है।
पैरामीटर
promptआवश्यक
system_promptवैकल्पिक
modelआवश्यक
reasoningवैकल्पिक
temperatureवैकल्पिक
max_tokensवैकल्पिक
enable_web_searchवैकल्पिक
web_search_optionsवैकल्पिक
web_search_options.engineवैकल्पिक
web_search_options.max_resultsवैकल्पिक
web_search_options.max_usesवैकल्पिक
web_search_options.max_total_resultsवैकल्पिक
web_search_options.search_context_sizeवैकल्पिक
web_search_options.max_charactersवैकल्पिक
web_search_options.allowed_domainsवैकल्पिक
web_search_options.excluded_domainsवैकल्पिक
web_search_options.user_locationवैकल्पिक
web_search_options.user_location.typeवैकल्पिक
web_search_options.user_location.cityवैकल्पिक
web_search_options.user_location.regionवैकल्पिक
web_search_options.user_location.countryवैकल्पिक
web_search_options.user_location.timezoneवैकल्पिक
आउटपुट
{
"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"
}
}
आउटपुट के फ़ील्ड
- 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/hi/developers/models/openrouter/router.md. सभी मॉडल और गाइड: https://doitong.com/developers/llms.txt