跳转到内容

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 数量限制为不超过上下文长度减提示词长度的值。生成不能超过指定上限。

Web 搜索配置,包括引擎选择、结果上限和域名过滤。仅当 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
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'。
必填

输出

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/developers/models/openrouter/router.md. 所有模型和指南: https://doitong.com/developers/llms.txt