跳转到内容

Grok Voice

集成

模型 id xai/grok-voice
# 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/xai/grok-voice?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"
  }'

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

每次运行最高 $1.494 按实际用量计费,剩余部分退款 在此页面运行

获取 API 密钥
xAI 音频 #xai#grok#voice#agent

语音代理,聆听录制的音频片段后以语音回复,并返回转写文本

xAI · 音频

你的第一个结果将在此显示

在下方构建请求,并使用你的 API 密钥运行。输出会复制到我们的存储中,可永久保存或免费保存 7 天。

构建请求

控件根据模型架构生成。更改控件时,代码和价格会同步更新。

0 / 20000

可选的系统指令,用于提供对话上下文并指定 persona,以替代 Grok 的默认设置;省略后将保留默认 persona。

•必填 audio_url
拖放文件,或

用户语音的音频 URL,限制为 10 分钟和 50 MB。可提供最常见的音频格式;Grok 接收音频前,会将其转换为单声道 PCM,采样位深为 16-bit,采样率为 24 kHz。智能体会以语音回应录音内容。

高级 voice · enable_safety_checker · tools

选择内置 xAI 语音,以覆盖 Grok 为智能体回复设置的默认语音;不设置则保留默认语音。

默认 {"mcp_servers":[],"we...

用于服务端的智能体工具配置。由于 ZDR,从类型化配置中排除 file_search/collections。所有工具初始均处于禁用状态;支持的选项包括远程 MCP 工具、网页工具和 X 工具。

POST /run/xai/grok-voice?wait=20 报价 → $1.494
# 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/xai/grok-voice?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"
  }'

# 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 密钥

关于 Grok Voice

通过 `audio_url` 发送录音,代理会以语音回复,返回 24 kHz 单声道 WAV、时长以及可用时的转写文本。可选的 `prompt`(最多 20000 个字符)用于设置角色和上下文,`voice` 用于选择内置声音。`tools` 对象可启用网页搜索、X 搜索或远程 MCP 服务器,默认全部关闭。

参数

发送规范名称或原生名称之一,不要同时发送两者。 规范名称

名称类型 默认值允许值 描述
audio_url必填 audio
类型url · audio
用户语音的音频 URL,限制为 10 分钟和 50 MB。可提供最常见的音频格式;Grok 接收音频前,会将其转换为单声道 PCM,采样位深为 16-bit,采样率为 24 kHz。智能体会以语音回应录音内容。
prompt可选
类型string | null
≤ 20,000 个字符
可选的系统指令,用于提供对话上下文并指定 persona,以替代 Grok 的默认设置;省略后将保留默认 persona。
voice可选
类型enum
carinazaganhelixorionlunairisaltairzenithperseusheliosluxkeplerrigelcosmocelesteursa
另外 12 个siriuslumencastornakshatlasauroralioraaraeveleorexsal
选择内置 xAI 语音,以覆盖 Grok 为智能体回复设置的默认语音;不设置则保留默认语音。
tools可选
类型object
默认值{"mcp_servers":[],"web_search":{"enabled":false},"x_search":{"enabled":false}}
用于服务端的智能体工具配置。由于 ZDR,从类型化配置中排除 file_search/collections。所有工具初始均处于禁用状态;支持的选项包括远程 MCP 工具、网页工具和 X 工具。
tools.mcp_servers可选
类型object[]
模型提供商连接以执行工具的远程 MCP 服务器。
tools.mcp_servers[].allowed_tools可选
类型string[]
≥ 1 items
用于指定此服务器公开哪些工具名称的可选列表。
tools.mcp_servers[].authorization可选
类型string | null
仅发送给模型提供商的敏感授权值。
tools.mcp_servers[].enabled可选
类型boolean
默认值true
服务器包含标志;false 表示排除该服务器。
tools.mcp_servers[].headers可选
类型object | null
MCP 请求使用的敏感标头,仅发送给模型提供商。
tools.mcp_servers[].server_description可选
类型string | null
≤ 2000 characters
概述此服务器提供功能的描述。
tools.mcp_servers[].server_label必填
类型string
1 – 128 characters
模型提供商用于识别其工具并为工具名称添加前缀的服务器标签。
tools.mcp_servers[].server_url必填
类型string
≥ 1 characters
调用方为 MCP 服务器提供的 HTTP(S) 地址,Grok 通过 Streaming HTTP/SSE 传输方式远程连接该服务器。
tools.web_search.allowed_domains可选
类型string[]
1 – 5 items
搜索结果的域名限制:最多指定五个域名,省略协议和路径。
tools.web_search.enable_image_understanding可选
类型boolean | null
允许智能体检查通过网页搜索发现的图像。
tools.web_search.enabled可选
类型boolean
默认值false
智能体的网页搜索访问权限:true 会将 web_search 添加到 session.tools 并允许网页搜索;默认值为禁用。
tools.web_search.excluded_domains可选
类型string[]
1 – 5 items
要从搜索结果中排除的域名,最多五个条目,省略协议和路径。
tools.web_search.location可选
类型object
用于按地理位置定制搜索结果的可选位置。
tools.x_search.allowed_x_handles可选
类型string[]
1 – 20 items
其帖子可能出现在结果中的 X 账号句柄,最多 20 个。
tools.x_search.enable_image_understanding可选
类型boolean | null
允许智能体检查在 X 上发现的图像。
tools.x_search.enable_video_understanding可选
类型boolean | null
允许智能体检查在 X 上发现的视频。
tools.x_search.enabled可选
类型boolean
默认值false
通过搜索访问 X 帖子:true 会将 x_search 添加到 session.tools,使智能体能够搜索这些帖子;默认值为禁用。
tools.x_search.excluded_x_handles可选
类型string[]
1 – 20 items
要排除其帖子的 X 账号句柄,最多 20 个。
tools.x_search.from_date可选
类型string | null
帖子的最早日期,使用 ISO 格式 YYYY-MM-DD 表示。
tools.x_search.to_date可选
类型string | null
帖子的最晚日期,使用 ISO 格式 YYYY-MM-DD 表示。
enable_safety_checker可选
类型boolean
默认值true
调用方获得授权后,可将其设置为 false 以放宽审核。
必填 规范名称,也可接受

文件参数接受公开的 https:// URL、最大 10 MB 的 data: URI,或上传文件的 file_url。 文件

输出

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "xai/grok-voice",
  "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": 1494,
    "usd": "1.494",
    "charged": 1494,
    "refunded": 0
  },
  "input": {
    "audio_url": "https://content.doitong.com/audio/showcase/v3/tools/dub_es.mp3"
  },
  "output": {
    "audio": {
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp3",
      "content_type": "audio/mpeg",
      "file_name": "0-output.mp3",
      "file_size": 1843200
    },
    "text": "",
    "duration": 5
  },
  "outputs": [
    {
      "type": "audio",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp3",
      "content_type": "audio/mpeg",
      "file_size": 1843200,
      "duration": 12,
      "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 是模型自身的结果对象。
输出字段
audio
object {url, content_type, file_name, file_size}Grok 智能体生成的语音回复,以 24 kHz 单声道 WAV 格式传送。
text
string伴随智能体语音的文本:空字符串表示 Grok 未提供转录文本;否则,其中包含转录文本。
duration
number生成音频的时长,单位为秒。

更多模型:音频

对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh/developers/models/xai/grok-voice.md. 所有模型和指南: https://doitong.com/developers/llms.txt