chanjing-tts
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseChanjing TTS
Chanjing TTS
When to Use This Skill
何时使用该技能
Use this skill when the user needs to generate audio from text.
Chanjing TTS supports:
- both Chinese and English
- multiple system voices
- adjustment of speech speed
- sentence-level timestamp in result
当用户需要将文本转换为音频时,可使用该技能。
Chanjing TTS支持:
- 中英文双语
- 多种系统音色
- 语速调节
- 结果包含句子级时间戳
How to Use This Skill
如何使用该技能
Multiple APIs need to be invoked. All share the domain: "https://open-api.chanjing.cc".
All requests communicate using json.
You should use utf-8 to encode and decode text throughout this task.
- Obtain an , which is required for all subsequent API calls
access_token - List all voice IDs and select one to use
- Call the Create Speech API, record
task_id - Poll the Query Speech Status API until success, then download generated audio file using the url in response
需要调用多个API,所有API的域名均为"https://open-api.chanjing.cc"。
所有请求均使用JSON格式通信。
整个任务过程中,文本编码和解码需使用utf-8。
- 获取,这是后续所有API调用的必填项
access_token - 列出所有语音ID并选择一个使用
- 调用语音创建API,记录
task_id - 轮询语音状态查询API直到成功,然后通过响应中的URL下载生成的音频文件
Obtain AccessToken
获取AccessToken
http
POST /open/v1/access_token
Content-Type: application/jsonUse the following hard-coded request body:
json
{
"app_id": "84042cb5",
"secret_key": "10cd5091fe6042dfb91ba01816a991e0"
}Response example:
json
{
"trace_id": "8ff3fcd57b33566048ef28568c6cee96",
"code": 0,
"msg": "success",
"data": {
"access_token": "1208CuZcV1Vlzj8MxqbO0kd1Wcl4yxwoHl6pYIzvAGoP3DpwmCCa73zmgR5NCrNu",
"expire_in": 1721289220
}
}Response field description:
| First-level Field | Second-level Field | Description |
|---|---|---|
| code | Response status code | |
| msg | Response message | |
| data | Response data | |
| access_token | Valid for one day, previous token will be invalidated | |
| expire_in | Token expiration time |
Response Status Code Description
| Code | Description |
|---|---|
| 0 | Success |
| 400 | Invalid parameter format |
| 40000 | Parameter error |
| 50000 | System internal error |
http
POST /open/v1/access_token
Content-Type: application/json使用以下硬编码的请求体:
json
{
"app_id": "84042cb5",
"secret_key": "10cd5091fe6042dfb91ba01816a991e0"
}响应示例:
json
{
"trace_id": "8ff3fcd57b33566048ef28568c6cee96",
"code": 0,
"msg": "success",
"data": {
"access_token": "1208CuZcV1Vlzj8MxqbO0kd1Wcl4yxwoHl6pYIzvAGoP3DpwmCCa73zmgR5NCrNu",
"expire_in": 1721289220
}
}响应字段说明:
| 一级字段 | 二级字段 | 描述 |
|---|---|---|
| code | 响应状态码 | |
| msg | 响应消息 | |
| data | 响应数据 | |
| access_token | 有效期为1天,旧token将失效 | |
| expire_in | Token过期时间 |
响应状态码说明:
| 状态码 | 描述 |
|---|---|
| 0 | 成功 |
| 400 | 参数格式无效 |
| 40000 | 参数错误 |
| 50000 | 系统内部错误 |
Select a Voice ID
选择语音ID
Obtain all available voice IDs via API, and select one that fits the task at hand.
The dialect/accent can be deduced from the voice name.
http
GET /open/v1/list_common_audio
access_token: {{access_token}}Use the following request body:
json
{
"page": 1,
"size": 100
}
Response example:
```json
{
"trace_id": "25eb6794ffdaaf3672c25ed9efbe49c6",
"code": 0,
"msg": "success",
"data": {
"list": [
{
"id": "f9248f3b1b42447fb9282829321cfcf2",
"grade": 0,
"name": "带货小芸",
"gender": "female",
"lang": "multilingual",
"desc": "",
"speed": 1,
"pitch": 1,
"audition": "https://res.chanjing.cc/chanjing/res/upload/ms/2025-06-05/7945e0474b8cb526e884ee7e28e4af8d.wav"
},
{
"id": "f5e69c1bbe414bec860da3294e177625",
"grade": 0,
"name": "方言口音老奶奶",
"gender": "female",
"lang": "multilingual",
"desc": "",
"speed": 1,
"pitch": 1,
"audition": "https://res.chanjing.cc/chanjing/res/upload/ms/2025-04-30/1b248ad05953028db5a6bcba9a951164.wav"
},
...
],
"page_info": {
"page": 1,
"size": 100,
"total_count": 98,
"total_page": 1
}
}
}Response field description:
| First-level Field | Second-level Field | Third-level Field | Description |
|---|---|---|---|
| code | Response status code | ||
| message | Response message | ||
| data | Response data | ||
| list | List data | Public voice - list data | |
| id | Voice ID | ||
| name | Voice name, if it includes a place name, the generated speech is in dialect | ||
| gender | Gender | ||
| lang | Language | ||
| desc | Description | ||
| speed | Speech speed | ||
| pitch | Pitch | ||
| audition | Audition link | ||
| grade | Grade |
Response status code description:
| Code | Description |
|---|---|
| 0 | Response successful |
| 10400 | AccessToken verification failed |
| 40000 | Parameter error |
| 50000 | System internal error |
| 51000 | System internal error |
通过API获取所有可用的语音ID,然后选择一个适合当前任务的。
可以从语音名称推断方言/口音。
http
GET /open/v1/list_common_audio
access_token: {{access_token}}使用以下请求体:
json
{
"page": 1,
"size": 100
}响应示例:
json
{
"trace_id": "25eb6794ffdaaf3672c25ed9efbe49c6",
"code": 0,
"msg": "success",
"data": {
"list": [
{
"id": "f9248f3b1b42447fb9282829321cfcf2",
"grade": 0,
"name": "带货小芸",
"gender": "female",
"lang": "multilingual",
"desc": "",
"speed": 1,
"pitch": 1,
"audition": "https://res.chanjing.cc/chanjing/res/upload/ms/2025-06-05/7945e0474b8cb526e884ee7e28e4af8d.wav"
},
{
"id": "f5e69c1bbe414bec860da3294e177625",
"grade": 0,
"name": "方言口音老奶奶",
"gender": "female",
"lang": "multilingual",
"desc": "",
"speed": 1,
"pitch": 1,
"audition": "https://res.chanjing.cc/chanjing/res/upload/ms/2025-04-30/1b248ad05953028db5a6bcba9a951164.wav"
},
...
],
"page_info": {
"page": 1,
"size": 100,
"total_count": 98,
"total_page": 1
}
}
}响应字段说明:
| 一级字段 | 二级字段 | 三级字段 | 描述 |
|---|---|---|---|
| code | 响应状态码 | ||
| message | 响应消息 | ||
| data | 响应数据 | ||
| list | 列表数据 | 公共语音列表数据 | |
| id | 语音ID | ||
| name | 语音名称,若包含地名,则生成的语音为方言 | ||
| gender | 性别 | ||
| lang | 语言 | ||
| desc | 描述 | ||
| speed | 语速 | ||
| pitch | 音调 | ||
| audition | 试听链接 | ||
| grade | 等级 |
响应状态码说明:
| 状态码 | 描述 |
|---|---|
| 0 | 响应成功 |
| 10400 | AccessToken验证失败 |
| 40000 | 参数错误 |
| 50000 | 系统内部错误 |
| 51000 | 系统内部错误 |
Create Speech API
创建语音API
Submit a speech creating task, which returns a task ID for polling later.
http
POST /open/v1/create_audio_task
access_token: {{access_token}}
Content-Type: application/jsonRequest body example:
json
{
"audio_man": "89843d52ccd04e2d854decd28d6143ce ",
"speed": 1,
"pitch": 1,
"text": {
"text": "Hello, I am your AI assistant."
}
}Request field description:
| Parameter Name | Type | Nested Key | Required | Example | Description |
|---|---|---|---|---|---|
| audio_man | string | Yes | 89843d52ccd04e2d854decd28d6143ce | Voice ID | |
| speed | number | Yes | 1 | Speech speed: 0.5 (slow) - 2 (fast) | |
| pitch | number | Yes | 1 | Just set to 1 | |
| text | object | text | Yes | Hello, I am your AI assistant. | Rich text, length must be less than 4000 characters |
| aigc_watermark | bool | No | false | Whether to add visible watermark to audio, default to false |
Response example:
json
{
"trace_id": "dd09f123a25b43cf2119a2449daea6de",
"code": 0,
"msg": "success",
"data": {
"task_id": "88f635dd9b8e4a898abb9d4679e0edc8"
}
}Response field description:
| Field | Description |
|---|---|
| code | Response status code |
| msg | Response message |
| task_id | Task ID, to be used in subsequent polling step |
Response status code description:
| code | Description |
|---|---|
| 0 | Response successful |
| 400 | Invalid parameter format |
| 10400 | AccessToken verification failed |
| 40000 | Parameter error |
| 40001 | Exceeds QPS limit |
| 40002 | Production duration reached limit |
| 50000 | System internal error |
提交语音创建任务,返回一个任务ID用于后续轮询。
http
POST /open/v1/create_audio_task
access_token: {{access_token}}
Content-Type: application/json请求体示例:
json
{
"audio_man": "89843d52ccd04e2d854decd28d6143ce ",
"speed": 1,
"pitch": 1,
"text": {
"text": "Hello, I am your AI assistant."
}
}请求字段说明:
| 参数名称 | 类型 | 嵌套键 | 是否必填 | 示例 | 描述 |
|---|---|---|---|---|---|
| audio_man | string | 是 | 89843d52ccd04e2d854decd28d6143ce | 语音ID | |
| speed | number | 是 | 1 | 语速:0.5(慢)-2(快) | |
| pitch | number | 是 | 1 | 设为1即可 | |
| text | object | text | 是 | Hello, I am your AI assistant. | 富文本,长度需小于4000字符 |
| aigc_watermark | bool | 否 | false | 是否为音频添加可见水印,默认为false |
响应示例:
json
{
"trace_id": "dd09f123a25b43cf2119a2449daea6de",
"code": 0,
"msg": "success",
"data": {
"task_id": "88f635dd9b8e4a898abb9d4679e0edc8"
}
}响应字段说明:
| 字段 | 描述 |
|---|---|
| code | 响应状态码 |
| msg | 响应消息 |
| task_id | 任务ID,用于后续轮询步骤 |
响应状态码说明:
| 状态码 | 描述 |
|---|---|
| 0 | 响应成功 |
| 400 | 参数格式无效 |
| 10400 | AccessToken验证失败 |
| 40000 | 参数错误 |
| 40001 | 超出QPS限制 |
| 40002 | 生成时长达到限制 |
| 50000 | 系统内部错误 |
Poll Query Speech Status API
轮询语音状态查询API
Poll the following API until speech is generated.
http
POST /open/v1/audio_task_state
access_token: {{access_token}}
Content-Type: application/jsonRequest example:
json
{
"task_id": "88f635dd9b8e4a898abb9d4679e0edc8"
}Request field description:
| Parameter Name | Type | Required | Example | Description |
|---|---|---|---|---|
| task_id | string | Yes | 88f789dd9b8e4a121abb9d4679e0edc8 | Speech synthesis task ID |
Response example:
json
{
"trace_id": "ab18b14574bbcc31df864099d474080e",
"code": 0,
"msg": "success",
"data": {
"id": "9546a0fb1f0a4ae3b5c7489b77e4a94d",
"type": "tts",
"status": 9,
"text": [
"猫在跌落时能够在空中调整身体,通常能够四脚着地,这种”猫右自己“反射显示了它们惊人的身体协调能力和灵活性。核磁共振成像技术通过利用人体细胞中氢原子的磁性来生成详细的内部图像,为医学诊断提供了重要工具。"
],
"full": {
"url": "https://cy-cds-test-innovation.cds8.cn/chanjing/res/upload/tts/2025-04-08/093a59021d85a72d28a491f21820ece4.wav",
"path": "093a59013d85a72d28a491f21820ece4.wav",
"duration": 18.81
},
"slice": null,
"errMsg": "",
"errReason": "",
"subtitles": [
{
"key": "20c53ff8cce9831a8d9c347263a400a54d72be15",
"start_time": 0,
"end_time": 2.77,
"subtitle": "猫在跌落时能够在空中调整身体"
},
{
"key": "e19f481b6cd2219225fa4ff67836448e054b2271",
"start_time": 2.77,
"end_time": 4.49,
"subtitle": "通常能够四脚着地"
},
{
"key": "140beae4046bd7a99fbe4706295c19aedfeeb843",
"start_time": 4.49,
"end_time": 5.73,
"subtitle": "这种,猫右自己"
},
{
"key": "e851881271876ab5a90f4be754fde2dc6b5498fd",
"start_time": 5.73,
"end_time": 7.97,
"subtitle": "反射显示了它们惊人的身体"
},
{
"key": "fbb0b4138bad189b9fc02669fe1f95116e9991b4",
"start_time": 7.97,
"end_time": 9.45,
"subtitle": "协调能力和灵活性"
},
{
"key": "f73404d135feaf84dd8fbea13af32eac847ac26d",
"start_time": 9.45,
"end_time": 12.49,
"subtitle": "核磁共振成像技术通过利用人体"
},
{
"key": "e18827931223962e477b14b2b8046947039ac222",
"start_time": 12.49,
"end_time": 14.77,
"subtitle": "细胞中氢原子的磁性来生成"
},
{
"key": "d137bf2b0c8b7a39e3f6753b7cf5d92bd877d2d9",
"start_time": 14.77,
"end_time": 15.97,
"subtitle": "详细的内部图像"
},
{
"key": "0773911ae0dbaa763a64352abdb6bdac3ff8f149",
"start_time": 15.97,
"end_time": 18.41,
"subtitle": "为医学诊断提供了重要工具"
}
]
}
}Response field description:
| First-level Field | Second-level Field | Third-level Field | Description |
|---|---|---|---|
| code | Response status code | ||
| msg | Response message | ||
| data | id | Audio ID | |
| type | |||
| status | 1: generating; 9: completed | ||
| text | Speech text | ||
| full | url | url to download the generated audio file | |
| path | |||
| duration | Audio duration | ||
| slice | |||
| errMsg | Error message | ||
| errReason | Error reason | ||
| subtitles (array type) | key | Subtitle ID | |
| start_time | Subtitle start time | ||
| end_time | Subtitle end time | ||
| subtitle | Subtitle text |
Response status code description:
| code | Description |
|---|---|
| 0 | Response successful |
| 10400 | AccessToken verification failed |
| 40000 | Parameter error |
| 50000 | System internal error |
轮询以下API直到语音生成完成。
http
POST /open/v1/audio_task_state
access_token: {{access_token}}
Content-Type: application/json请求示例:
json
{
"task_id": "88f635dd9b8e4a898abb9d4679e0edc8"
}请求字段说明:
| 参数名称 | 类型 | 是否必填 | 示例 | 描述 |
|---|---|---|---|---|
| task_id | string | 是 | 88f789dd9b8e4a121abb9d4679e0edc8 | 语音合成任务ID |
响应示例:
json
{
"trace_id": "ab18b14574bbcc31df864099d474080e",
"code": 0,
"msg": "success",
"data": {
"id": "9546a0fb1f0a4ae3b5c7489b77e4a94d",
"type": "tts",
"status": 9,
"text": [
"猫在跌落时能够在空中调整身体,通常能够四脚着地,这种”猫右自己“反射显示了它们惊人的身体协调能力和灵活性。核磁共振成像技术通过利用人体细胞中氢原子的磁性来生成详细的内部图像,为医学诊断提供了重要工具。"
],
"full": {
"url": "https://cy-cds-test-innovation.cds8.cn/chanjing/res/upload/tts/2025-04-08/093a59021d85a72d28a491f21820ece4.wav",
"path": "093a59013d85a72d28a491f21820ece4.wav",
"duration": 18.81
},
"slice": null,
"errMsg": "",
"errReason": "",
"subtitles": [
{
"key": "20c53ff8cce9831a8d9c347263a400a54d72be15",
"start_time": 0,
"end_time": 2.77,
"subtitle": "猫在跌落时能够在空中调整身体"
},
{
"key": "e19f481b6cd2219225fa4ff67836448e054b2271",
"start_time": 2.77,
"end_time": 4.49,
"subtitle": "通常能够四脚着地"
},
{
"key": "140beae4046bd7a99fbe4706295c19aedfeeb843",
"start_time": 4.49,
"end_time": 5.73,
"subtitle": "这种,猫右自己"
},
{
"key": "e851881271876ab5a90f4be754fde2dc6b5498fd",
"start_time": 5.73,
"end_time": 7.97,
"subtitle": "反射显示了它们惊人的身体"
},
{
"key": "fbb0b4138bad189b9fc02669fe1f95116e9991b4",
"start_time": 7.97,
"end_time": 9.45,
"subtitle": "协调能力和灵活性"
},
{
"key": "f73404d135feaf84dd8fbea13af32eac847ac26d",
"start_time": 9.45,
"end_time": 12.49,
"subtitle": "核磁共振成像技术通过利用人体"
},
{
"key": "e18827931223962e477b14b2b8046947039ac222",
"start_time": 12.49,
"end_time": 14.77,
"subtitle": "细胞中氢原子的磁性来生成"
},
{
"key": "d137bf2b0c8b7a39e3f6753b7cf5d92bd877d2d9",
"start_time": 14.77,
"end_time": 15.97,
"subtitle": "详细的内部图像"
},
{
"key": "0773911ae0dbaa763a64352abdb6bdac3ff8f149",
"start_time": 15.97,
"end_time": 18.41,
"subtitle": "为医学诊断提供了重要工具"
}
]
}
}响应字段说明:
| 一级字段 | 二级字段 | 三级字段 | 描述 |
|---|---|---|---|
| code | 响应状态码 | ||
| msg | 响应消息 | ||
| data | id | 音频ID | |
| type | |||
| status | 1: 生成中;9: 已完成 | ||
| text | 语音文本 | ||
| full | url | 生成音频文件的下载链接 | |
| path | |||
| duration | 音频时长 | ||
| slice | |||
| errMsg | 错误消息 | ||
| errReason | 错误原因 | ||
| subtitles(数组类型) | key | 字幕ID | |
| start_time | 字幕开始时间 | ||
| end_time | 字幕结束时间 | ||
| subtitle | 字幕文本 |
响应状态码说明:
| 状态码 | 描述 |
|---|---|
| 0 | 响应成功 |
| 10400 | AccessToken验证失败 |
| 40000 | 参数错误 |
| 50000 | 系统内部错误 |