跳转到内容

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.ru/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.ru/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 位、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.ru/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.ru/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 位、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
调用方提供的 HTTP(S) 地址,用于 Grok 通过 Streaming HTTP/SSE 传输连接远程 MCP 服务器。
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.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.ru/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-CN/developers/models/xai/grok-voice.md. 所有模型和指南: https://doitong.com/developers/llms.txt