{"componentChunkName":"component---src-templates-acg-portal-new-template-tsx","path":"/xmw03avls","result":{"data":{"markdownRemark":{"html":"<h2 id=\"接口描述\"><a href=\"#%E6%8E%A5%E5%8F%A3%E6%8F%8F%E8%BF%B0\" aria-label=\"接口描述 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>接口描述</h2>\n<p>通过HTTP请求，将短文本文本合成语音音频。采用 application/json 请求，合成成功返回二进制音频流，失败返回 JSON 错误信息。</p>\n<h2 id=\"请求说明\"><a href=\"#%E8%AF%B7%E6%B1%82%E8%AF%B4%E6%98%8E\" aria-label=\"请求说明 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>请求说明</h2>\n<p>语音合成接口支持POST请求方式。</p>\n<p>请求地址：<a href=\"https://aip.baidubce.com/rest/2.0/speech/publiccloudspeech/v1/tts\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://aip.baidubce.com/rest/2.0/speech/publiccloudspeech/v1/tts</a></p>\n<p>Content-Type：application/json</p>\n<ul>\n<li>请求标识 <code>sn</code>（可选）：通过 query 参数传入，用于问题排查；不传则由服务端自动生成，并在失败响应中回传。</li>\n<li>请求体大小：不超过 64KB，文本不超过120 GBK字节，即约60个汉字或者字母数字记为1次请求。每超过120个GBK字节则多记1次计费调用。</li>\n</ul>\n<p>如需合成更长文本，推荐使用<a href=\"https://cloud.baidu.com/doc/SPEECH/s/ulbxh8rbu\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">长文本在线合成</a>。长文本在线合成可将10万字以内文本一次性合成，异步返回音频。支持多种优质音库，将超长文本快速转换 成稳定流畅、饱满真实的音频。适用于阅读听书、新闻播报等客户。</p>\n<h3 id=\"鉴权参数\"><a href=\"#%E9%89%B4%E6%9D%83%E5%8F%82%E6%95%B0\" aria-label=\"鉴权参数 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>鉴权参数</h3>\n<p>以下两种方式任选其一，均未提供时返回鉴权失败（错误码 100020）</p>\n<table>\n<thead>\n<tr>\n<th><div style=\"width: 80pt\">属性</div></th>\n<th>参数名称</th>\n<th>类型</th>\n<th>是否必填</th>\n<th>说明</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>access_token</td>\n<td>string</td>\n<td>query</td>\n<td>鉴权方式二选一</td>\n<td><a href=\"https://cloud.baidu.com/doc/AI_REFERENCE/s/Km3zhy5t7\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">鉴权令牌</a></td>\n</tr>\n<tr>\n<td>Authorization</td>\n<td>string</td>\n<td>header</td>\n<td>鉴权方式二选一</td>\n<td><a href=\"https://cloud.baidu.com/doc/AI_REFERENCE/s/Hm5us339w\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">鉴权API Key</a></td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"body参数\"><a href=\"#body%E5%8F%82%E6%95%B0\" aria-label=\"body参数 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Body参数</h3>\n<table>\n<thead>\n<tr>\n<th><div style=\"width: 60pt\">属性</div></th>\n<th>参数名称</th>\n<th>类型</th>\n<th>是否必填</th>\n<th>说明</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>合成文本</td>\n<td>text</td>\n<td>string</td>\n<td>必填</td>\n<td>合成文本应小于1024GBK 字节，1个中文字、英文字母、数字或符号均算作1个字符</td>\n</tr>\n<tr>\n<td>音色</td>\n<td>voice</td>\n<td>string</td>\n<td>必填</td>\n<td>具体取值范围见<a href=\"https://cloud.baidu.com/doc/SPEECH/s/Rluv3uq3d\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">音色列表</a></td>\n</tr>\n<tr>\n<td>合成语言</td>\n<td>lang</td>\n<td>string</td>\n<td>可选</td>\n<td>当前仅支持中英文，默认为zh</td>\n</tr>\n<tr>\n<td>音频格式</td>\n<td>format</td>\n<td>string</td>\n<td>可选</td>\n<td>输出文件格式，支持mp3、pcm、wav，默认为mp3格式</td>\n</tr>\n<tr>\n<td>采样率</td>\n<td>sample_rate</td>\n<td>int</td>\n<td>可选</td>\n<td>支持8000、16000、24000，默认为16000。</td>\n</tr>\n<tr>\n<td>音调</td>\n<td>pitch</td>\n<td>float</td>\n<td>可选</td>\n<td>音调，取值范围[-12, 12]，默认为0。</br>取值越大音调约高。音调参数每增加1相当于升调一个单位半音，增加12则升一个八度，降调同理。</td>\n</tr>\n<tr>\n<td>音量</td>\n<td>volume</td>\n<td>float</td>\n<td>可选</td>\n<td>音量，取值范围[0.5, 2.0]，默认为1。</br>取值越大，音量越大。0.5代表0.5倍音量，2.0代表2倍音量，默认不调整音量。</td>\n</tr>\n<tr>\n<td>语速</td>\n<td>speed</td>\n<td>float</td>\n<td>可选</td>\n<td>语速，取值范围[0.5, 2.0]，默认为1。</br>取值越大，语速越快。0.5代表0.5倍语速，2.0代表2倍语速，默认不调整语速。</td>\n</tr>\n<tr>\n<td>合成情感</td>\n<td>emotion</td>\n<td>string</td>\n<td>可选</td>\n<td>待合成语音的情感，支持以下情感：</br>中性：neutral;</br>高兴：happy;</br>悲伤：down；</br>惊讶：surprise;</br>愤怒：angry;</br>恐惧：fear；</br> 只有大模型多情感音色支持选择合成情感，支持音色详见<a href=\"https://cloud.baidu.com/doc/SPEECH/s/Rluv3uq3d\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">音色列表</a></td>\n</tr>\n<tr>\n<td>元数据标识</td>\n<td>metadata</td>\n<td>object</td>\n<td>可选</td>\n<td>AIGC元数据标识，仅 mp3 输出时生效。详细字段见下</td>\n</tr>\n<tr>\n<td></td>\n<td>metadata.ContentPropagator</td>\n<td>string</td>\n<td>可选</td>\n<td>内容传播服务提供者</td>\n</tr>\n<tr>\n<td></td>\n<td>metadata.PropagateID</td>\n<td>string</td>\n<td>可选</td>\n<td>内容传播编号</td>\n</tr>\n</tbody>\n</table>\n</br>\n<h4 id=\"format-与-sample_rate-支持的组合\"><a href=\"#format-%E4%B8%8E-sample_rate-%E6%94%AF%E6%8C%81%E7%9A%84%E7%BB%84%E5%90%88\" aria-label=\"format 与 sample_rate 支持的组合 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>format 与 sample_rate 支持的组合</h4>\n<table>\n<thead>\n<tr>\n<th align=\"left\">format</th>\n<th align=\"left\">sample_rate</th>\n<th align=\"left\">输出</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td align=\"left\">mp3</td>\n<td align=\"left\">16000 / 24000</td>\n<td align=\"left\">mp3</td>\n</tr>\n<tr>\n<td align=\"left\">pcm</td>\n<td align=\"left\">16000 / 24000</td>\n<td align=\"left\">pcm</td>\n</tr>\n<tr>\n<td align=\"left\">pcm</td>\n<td align=\"left\">8000</td>\n<td align=\"left\">pcm</td>\n</tr>\n<tr>\n<td align=\"left\">wav</td>\n<td align=\"left\">16000 / 24000</td>\n<td align=\"left\">wav</td>\n</tr>\n</tbody>\n</table>\n<p>若传输的组合不在上表中（如 mp3+8000、wav+8000），接口将返回参数错误。</p>\n<h4 id=\"metadata-说明\"><a href=\"#metadata-%E8%AF%B4%E6%98%8E\" aria-label=\"metadata 说明 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>metadata 说明</h4>\n<ul>\n<li>两个字段都不传：不添加任何元数据标识。</li>\n<li>同时传入 <code>ContentPropagator</code> 与 <code>PropagateID</code>：音频中将写入 AIGC 元数据标识（仅 mp3 格式生效）。</li>\n<li>只传其中一个无效，需成对传入。</li>\n</ul>\n</br>\n<h2 id=\"请求示例\"><a href=\"#%E8%AF%B7%E6%B1%82%E7%A4%BA%E4%BE%8B\" aria-label=\"请求示例 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>请求示例</h2>\n\n    <div class=\"code-block-wrapper\">\n        <div class=\"code-block\">\n            <div class=\"code-block-header\">\n                <span class=\"code-block-name\">Bash</span>\n                <button class=\"code-copy-btn\" data-tooltip-text=\"\">\n                    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\"> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.57894 3.45614C5.57894 3.38832 5.63392 3.33333 5.70175 3.33333H12.5439C12.6117 3.33333 12.6667 3.38832 12.6667 3.45614V10.2982C12.6667 10.3661 12.6117 10.4211 12.5439 10.4211H11.7544V5.70175C11.7544 4.89754 11.1025 4.24561 10.2982 4.24561H5.57894V3.45614ZM4.24561 4.24561V3.45614C4.24561 2.65194 4.89754 2 5.70175 2H12.5439C13.3481 2 14 2.65194 14 3.45614V10.2982C14 11.1025 13.3481 11.7544 12.5439 11.7544H11.7544V12.5439C11.7544 13.3481 11.1025 14 10.2982 14H3.45614C2.65194 14 2 13.3481 2 12.5439V5.70175C2 4.89754 2.65194 4.24561 3.45614 4.24561H4.24561ZM3.33333 5.70175C3.33333 5.63392 3.38832 5.57894 3.45614 5.57894H10.2982C10.3661 5.57894 10.4211 5.63392 10.4211 5.70175V12.5439C10.4211 12.6117 10.3661 12.6667 10.2982 12.6667H3.45614C3.38832 12.6667 3.33333 12.6117 3.33333 12.5439V5.70175Z\" fill=\"currentColor\"></path> </svg>\n                    复制\n                </button>\n            </div>\n            <div class=\"code-block-content\">\n                <pre class=\"language-bash\"><code><span class=\"line-number\">1</span><span class=\"token function\">curl</span> -X POST <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">2</span>  <span class=\"token string\">'https://&lt;host>/rest/2.0/speech/publiccloudspeech/v1/tts?access_token=&lt;ACCESS_TOKEN>'</span> <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">3</span>  -H <span class=\"token string\">'Content-Type: application/json'</span> <span class=\"token punctuation\">\\</span>\n<span class=\"line-number\">4</span>  -d <span class=\"token string\">'{\n<span class=\"line-number\">5</span>    \"text\": \"百度你好，这里是短文本语音合成接口\",\n<span class=\"line-number\">6</span>    \"voice\": \"5003\",\n<span class=\"line-number\">7</span>    \"lang\": \"zh\",\n<span class=\"line-number\">8</span>    \"format\": \"mp3\",\n<span class=\"line-number\">9</span>    \"sample_rate\": 16000,\n<span class=\"line-number\">10</span>    \"speed\": 1,\n<span class=\"line-number\">11</span>    \"pitch\": 0,\n<span class=\"line-number\">12</span>    \"volume\": 1,\n<span class=\"line-number\">13</span>    \"emotion\": \"neutral\",\n<span class=\"line-number\">14</span>    \"metadata\": {\n<span class=\"line-number\">15</span>      \"ContentPropagator\": \"xxxxx\",\n<span class=\"line-number\">16</span>      \"PropagateID\": \"xxxxx\"\n<span class=\"line-number\">17</span>    }\n<span class=\"line-number\">18</span>  }'</span></code></pre>\n            </div>\n        </div>\n    </div>\n  \n</br>\n<h2 id=\"返回说明\"><a href=\"#%E8%BF%94%E5%9B%9E%E8%AF%B4%E6%98%8E\" aria-label=\"返回说明 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>返回说明</h2>\n<p><strong>需要根据 Content-Type的头部来确定是否服务端合成成功。</strong></p>\n<h3 id=\"合成成功\"><a href=\"#%E5%90%88%E6%88%90%E6%88%90%E5%8A%9F\" aria-label=\"合成成功 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>合成成功</h3>\n<p>若合成成功，返回二进制音频流，<code>Content-Type</code> 按 <code>format</code> / <code>sample_rate</code> 返回：</p>\n<ul>\n<li>返回为二进制mp3文件，具体header信息 Content-Type: audio/mp3；</li>\n<li>返回为二进制pcm（16k/24k）文件，具体header信息 Content-Type:audio/basic;codec=pcm;rate=16000/24000;channel=1</li>\n<li>返回为二进制pcm（8k）文件，具体header信息 Content-Type:audio/basic;codec=pcm;rate=8000;channel=1</li>\n<li>返回为二进制wav文件，具体header信息 Content-Type: audio/wav；</li>\n</ul>\n<h3 id=\"合成失败\"><a href=\"#%E5%90%88%E6%88%90%E5%A4%B1%E8%B4%A5\" aria-label=\"合成失败 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>合成失败</h3>\n<p>若合成失败，HTTP 状态码固定返回 <strong>200</strong>，错误信息由响应 body 的 <code>code</code> 表示，<code>Content-Type: application/json</code>：</p>\n\n    <div class=\"code-block-wrapper\">\n        <div class=\"code-block\">\n            <div class=\"code-block-header\">\n                <span class=\"code-block-name\">JSON</span>\n                <button class=\"code-copy-btn\" data-tooltip-text=\"\">\n                    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\"> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.57894 3.45614C5.57894 3.38832 5.63392 3.33333 5.70175 3.33333H12.5439C12.6117 3.33333 12.6667 3.38832 12.6667 3.45614V10.2982C12.6667 10.3661 12.6117 10.4211 12.5439 10.4211H11.7544V5.70175C11.7544 4.89754 11.1025 4.24561 10.2982 4.24561H5.57894V3.45614ZM4.24561 4.24561V3.45614C4.24561 2.65194 4.89754 2 5.70175 2H12.5439C13.3481 2 14 2.65194 14 3.45614V10.2982C14 11.1025 13.3481 11.7544 12.5439 11.7544H11.7544V12.5439C11.7544 13.3481 11.1025 14 10.2982 14H3.45614C2.65194 14 2 13.3481 2 12.5439V5.70175C2 4.89754 2.65194 4.24561 3.45614 4.24561H4.24561ZM3.33333 5.70175C3.33333 5.63392 3.38832 5.57894 3.45614 5.57894H10.2982C10.3661 5.57894 10.4211 5.63392 10.4211 5.70175V12.5439C10.4211 12.6117 10.3661 12.6667 10.2982 12.6667H3.45614C3.38832 12.6667 3.33333 12.6117 3.33333 12.5439V5.70175Z\" fill=\"currentColor\"></path> </svg>\n                    复制\n                </button>\n            </div>\n            <div class=\"code-block-content\">\n                <pre class=\"language-json\"><code><span class=\"line-number\">1</span><span class=\"token punctuation\">{</span>\n<span class=\"line-number\">2</span>  <span class=\"token property\">\"code\"</span><span class=\"token operator\">:</span> <span class=\"token number\">100002</span><span class=\"token punctuation\">,</span>\n<span class=\"line-number\">3</span>  <span class=\"token property\">\"message\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Invalid parameter.\"</span><span class=\"token punctuation\">,</span>\n<span class=\"line-number\">4</span>  <span class=\"token property\">\"sn\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"49a6b25b-6e2a-11ec-xxxx\"</span>\n<span class=\"line-number\">5</span><span class=\"token punctuation\">}</span></code></pre>\n            </div>\n        </div>\n    </div>\n  \n<ul>\n<li><code>code</code> / <code>message</code>：错误码与描述（见下表）。</li>\n<li><code>sn</code>：请求唯一标识，便于排查。</li>\n</ul>\n</br>\n<h2 id=\"错误码\"><a href=\"#%E9%94%99%E8%AF%AF%E7%A0%81\" aria-label=\"错误码 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>错误码</h2>\n<table>\n<thead>\n<tr>\n<th>错误码</th>\n<th>含义</th>\n<th>说明</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>100001</td>\n<td>服务端错误</td>\n<td>合成服务处理失败，<code>message</code> 返回具体原因</td>\n</tr>\n<tr>\n<td>100002</td>\n<td>参数不合法</td>\n<td>参数类错误统一使用此码，<code>message</code> 区分具体原因：缺少必填参数(text/voice)、文本超长、format 与 sample_rate 组合不支持、emotion 不合法、speed/pitch/volume 超范围、voice 不合法、请求体超限等</td>\n</tr>\n<tr>\n<td>100020</td>\n<td>鉴权失败</td>\n<td><code>access_token</code> 与 <code>Authorization</code> 均缺失或鉴权不通过</td>\n</tr>\n<tr>\n<td>100021</td>\n<td>无权限或额度不足</td>\n<td>发音人无访问权限或账户额度不足</td>\n</tr>\n<tr>\n<td>100030</td>\n<td>服务内部错误</td>\n<td>其它未归类的服务端异常</td>\n</tr>\n</tbody>\n</table>","fields":{"slug":"xmw03avls","title":"同步语音合成","date":"2026-11-04","extractedHeadings":[]},"headings":[{"value":"接口描述","depth":2},{"value":"请求说明","depth":2},{"value":"鉴权参数","depth":3},{"value":"Body参数","depth":3},{"value":"format 与 sample_rate 支持的组合","depth":4},{"value":"metadata 说明","depth":4},{"value":"请求示例","depth":2},{"value":"返回说明","depth":2},{"value":"合成成功","depth":3},{"value":"合成失败","depth":3},{"value":"错误码","depth":2}]}},"pageContext":{"isCreatedByStatefulCreatePages":false,"slug":"xmw03avls","prev":{"id":"Rluv3uq3d","name":"音色列表","path":"Rluv3uq3d","filePath":"API文档/语音合成/音色列表.md","seo":null,"parentIds":["zlwrj8t73","Xlwrjj6ze"],"parents":[{"id":"zlwrj8t73","documentId":"f171917c-da32-43e5-b97f-db982e03534b","name":"API文档","repoName":"SPEECH","filePath":"API文档","disabled":false,"path":"zlwrj8t73","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null,"solutionTag":null,"solutionColor":null},{"id":"Xlwrjj6ze","documentId":"570acf37-e750-4949-b03d-8dddd22b3d53","name":"语音合成","repoName":"SPEECH","filePath":"API文档/语音合成","disabled":false,"path":"Xlwrjj6ze","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null,"solutionTag":null,"solutionColor":null}]},"next":{"id":"ulbxh8rbu","name":"长文本在线合成","path":"ulbxh8rbu","filePath":"API文档/语音合成/长文本在线合成API.md","seo":{"title":"","keywords":"","description":"","serviceType":null},"parentIds":["zlwrj8t73","Xlwrjj6ze"],"parents":[{"id":"zlwrj8t73","documentId":"f171917c-da32-43e5-b97f-db982e03534b","name":"API文档","repoName":"SPEECH","filePath":"API文档","disabled":false,"path":"zlwrj8t73","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null,"solutionTag":null,"solutionColor":null},{"id":"Xlwrjj6ze","documentId":"570acf37-e750-4949-b03d-8dddd22b3d53","name":"语音合成","repoName":"SPEECH","filePath":"API文档/语音合成","disabled":false,"path":"Xlwrjj6ze","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null,"solutionTag":null,"solutionColor":null}]},"parents":[{"id":"zlwrj8t73","documentId":"f171917c-da32-43e5-b97f-db982e03534b","name":"API文档","repoName":"SPEECH","filePath":"API文档","disabled":false,"path":"zlwrj8t73","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null,"solutionTag":null,"solutionColor":null},{"id":"Xlwrjj6ze","documentId":"570acf37-e750-4949-b03d-8dddd22b3d53","name":"语音合成","repoName":"SPEECH","filePath":"API文档/语音合成","disabled":false,"path":"Xlwrjj6ze","lastMergeTime":null,"isApiDoc":null,"httpMethod":null,"seo":null,"sourceOrgName":null,"sourceRepoName":null,"sourceDocumentId":null,"solutionTag":null,"solutionColor":null}],"specificSeo":null}}}