OpenRouter [Audio]
集成
模型 id
openrouter/router/audio
# 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/audio?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"audio": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "google/gemini-3.8-flash"
}'
# 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/audio?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"audio": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "google/gemini-3.8-flash"
}),
});
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 = {
"audio": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "google/gemini-3.8-flash",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/openrouter/router/audio", 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-CN/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/audio",
"input": {
"audio": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "google/gemini-3.8-flash"
}
}
通过 Doitong API 调用 OpenRouter [Audio] 模型(openrouter/router/audio)。智能体文档:https://doitong.com/zh-CN/developers/models/openrouter/router/audio.md
POST https://api.doitong.com/v1/run/openrouter/router/audio?wait=20
Authorization: Bearer $DOITONG_API_KEY
Content-Type: application/json
{
"audio": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "google/gemini-3.8-flash"
}
如果响应状态为 "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/audio,可在运行前返回确切价格。
每次运行最高 $1.858 按实际用量收费,剩余部分退款 在此页面运行
你的新 API 密钥。 它只会在此时显示,并且已填入下方的代码和 API 密钥字段中。请妥善保管:切勿将其放入在浏览器中运行的代码里。
构建请求
控件根据模型架构生成。修改控件时,代码和价格会同步更新。
POST
/run/openrouter/router/audio?wait=20
报价 → $1.858
# 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/audio?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"audio": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "google/gemini-3.8-flash"
}'
# 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/audio?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"audio": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "google/gemini-3.8-flash"
}),
});
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 = {
"audio": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "google/gemini-3.8-flash",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/openrouter/router/audio", 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/audio",
"input": {
"audio": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"model": "google/gemini-3.8-flash"
},
"wait_seconds": 20
}
}
}
关于 OpenRouter [Audio]
通过 `audio_url` 接收音频文件,同时需要提供 `prompt` 和必需的 `model`。列出的格式包括 wav、mp3、aiff、aac、ogg、flac 和 m4a。可选使用 `system_prompt`、`temperature`、`max_tokens`、`reasoning` 和网页搜索设置。返回文本输出和 Token 用量。
参数
发送规范名称或原生名称之一,不要同时发送两者。 规范名称
名称类型
默认值允许值
描述
audio_url必填
audio
类型url · audio
用于处理的音频输入,通过 URL 或数据 URI 指定。接受的格式包括 m4a、flac、ogg、aac、aiff、mp3 和 wav。
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
Web 访问开关,使模型可以决定是否以及何时搜索,并支持在一次请求中进行多次搜索。搜索使用 OpenRouter 的服务端 Web 搜索工具获取实时信息。
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'。
必填
规范名称,也可接受
文件参数接受公开的 https:// URL、最大 10 MB 的 data: URI,或上传文件的 file_url。 文件
输出
GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "openrouter/router/audio",
"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": 1858,
"usd": "1.858",
"charged": 1858,
"refunded": 0
},
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
"audio_url": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3",
"model": "google/gemini-3.8-flash"
},
"output": {
"output": "The audio contains a conversation between two people discussing the weather forecast for the upcoming week.",
"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-CN/developers/models/openrouter/router/audio.md. 所有模型和指南: https://doitong.com/developers/llms.txt