chanjing-avatar
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseChanjing Avatar (Lip-Syncing)
Chanjing Avatar(唇形同步)
When to Use This Skill
何时使用该技能
Use this skill when the user needs to create lip-syncing videos (digital avatar videos) with synchronized mouth movements.
Chanjing Avatar supports:
- Text-driven or audio-driven lip-syncing
- Multiple system voices for TTS
- Video resolution customization
- Task status polling and callback
当用户需要创建嘴部动作同步的唇形同步视频(数字人视频)时,可以使用该技能。
Chanjing Avatar支持:
- 文本驱动或音频驱动的唇形同步
- 多种系统语音的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 - Upload your video/audio files using the File Management API to get
file_id - Create a lip-syncing task with video and audio/text using these values
file_id - Poll the Query Task Detail API or use Task List API to check status
- Download the generated video using the url in response when status is completed
需要调用多个API,所有API的域名均为:"https://open-api.chanjing.cc"。
所有请求均使用JSON格式通信。
在整个任务过程中,您需要使用utf-8编码和解码文本。
- 获取,这是后续所有API调用的必填项
access_token - 使用文件管理API上传您的视频/音频文件,获取
file_id - 使用这些,结合视频和音频/文本创建唇形同步任务
file_id - 调用查询任务详情API或任务列表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 | 有效期为一天,旧令牌将失效 | |
| expire_in | 令牌过期时间 |
响应状态码说明
| 状态码 | 说明 |
|---|---|
| 0 | 成功 |
| 400 | 参数格式无效 |
| 40000 | 参数错误 |
| 50000 | 系统内部错误 |
Upload Media Files (File Management)
上传媒体文件(文件管理)
Before creating a lip-syncing task, you must upload your video (and optional audio) files using the File Management API to obtain values.
file_idThe full documentation is here: .
[File Management](https://doc.chanjing.cc/api/file/file-management.html)在创建唇形同步任务之前,您必须使用文件管理API上传您的视频(可选音频)文件,以获取。
file_id完整文档请参考:。
[文件管理](https://doc.chanjing.cc/api/file/file-management.html)Step 1: Get upload URL
步骤1:获取上传URL
http
GET /open/v1/common/create_upload_url
access_token: {{access_token}}Query params:
| Key | Example | Description |
|---|---|---|
| service | lip_sync_video / lip_sync_audio | File usage purpose. Use |
| name | 1.mp4 | Original file name including extension |
You will get a response containing , , and . Use the with HTTP to upload the file, setting to the returned . After the upload succeeds, keep the returned ; this is what you pass as / below.
sign_urlmime_typefile_idsign_urlPUTContent-Typemime_typefile_idvideo_file_idaudio_file_idNote: Newly uploaded files may take up to about 1 minute before they become fully available.
http
GET /open/v1/common/create_upload_url
access_token: {{access_token}}查询参数:
| 键 | 示例 | 说明 |
|---|---|---|
| service | lip_sync_video / lip_sync_audio | 文件使用场景。驱动视频使用 |
| name | 1.mp4 | 包含扩展名的原始文件名 |
您将收到包含、和的响应。使用通过HTTP 方法上传文件,并将设置为返回的。上传成功后,请保存返回的;后续将其作为 / 传入。
sign_urlmime_typefile_idsign_urlPUTContent-Typemime_typefile_idvideo_file_idaudio_file_id注意: 新上传的文件可能需要最多约1分钟才能完全可用。
Create Lip-Syncing Task
创建唇形同步任务
Submit a lip-syncing video creation task, which returns a video ID for polling later.
http
POST /open/v1/video_lip_sync/create
access_token: {{access_token}}
Content-Type: application/jsonRequest body example (TTS-driven):
json
{
"video_file_id": "e284db4d95de4220afe78132158156b5",
"screen_width": 1080,
"screen_height": 1920,
"callback": "https://example.com/openapi/callback",
"model": 0,
"audio_type": "tts",
"tts_config": {
"text": "君不见黄河之水天上来,奔流到海不复回。",
"audio_man_id": "C-f2429d07554749839849497589199916",
"speed": 1,
"pitch": 1
}
}Request body example (Audio-driven):
json
{
"video_file_id": "e284db4d95de4220afe78132158156b5",
"screen_width": 1080,
"screen_height": 1920,
"model": 0,
"audio_type": "audio",
"audio_file_id": "audio_file_id_from_file_management"
}Request field description:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| video_file_id | string | Yes | Video file ID from File Management ( |
| screen_width | int | No | Screen width, default 1080 |
| screen_height | int | No | Screen height, default 1920 |
| backway | int | No | Playback order when reaching end: 1-normal, 2-reverse. Default 1 |
| drive_mode | string | No | Drive mode: ""-normal, "random"-random frame. Default "" |
| callback | string | No | Callback URL for async notification |
| model | int | No | Model version: 0-basic, 1-high quality. Default 0 |
| audio_type | string | No | Audio type: "tts"-text driven, "audio"-audio driven. Default "tts" |
| tts_config | object | Yes (for tts) | TTS configuration when audio_type="tts" |
| tts_config.text | string | Yes (for tts) | Text to synthesize |
| tts_config.audio_man_id | string | Yes (for tts) | Voice ID |
| tts_config.speed | number | No | Speech speed: 0.5-2, default 1 |
| tts_config.pitch | number | No | Pitch, default 1 |
| audio_file_id | string | Yes (for audio) | Audio file ID from File Management ( |
| volume | int | No | Volume: 1-100, default 100 |
Response example:
json
{
"trace_id": "8d10659438827bd4d59eaa2696f9d391",
"code": 0,
"msg": "success",
"data": "9499ed79995c4bdb95f0d66ca84419fd"
}Response field description:
| Field | Description |
|---|---|
| code | Response status code |
| msg | Response message |
| data | Video ID for subsequent polling |
提交唇形同步视频创建任务,将返回一个视频ID用于后续轮询。
http
POST /open/v1/video_lip_sync/create
access_token: {{access_token}}
Content-Type: application/json请求体示例(TTS驱动):
json
{
"video_file_id": "e284db4d95de4220afe78132158156b5",
"screen_width": 1080,
"screen_height": 1920,
"callback": "https://example.com/openapi/callback",
"model": 0,
"audio_type": "tts",
"tts_config": {
"text": "君不见黄河之水天上来,奔流到海不复回。",
"audio_man_id": "C-f2429d07554749839849497589199916",
"speed": 1,
"pitch": 1
}
}请求体示例(音频驱动):
json
{
"video_file_id": "e284db4d95de4220afe78132158156b5",
"screen_width": 1080,
"screen_height": 1920,
"model": 0,
"audio_type": "audio",
"audio_file_id": "audio_file_id_from_file_management"
}请求字段说明:
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| video_file_id | string | 是 | 文件管理API返回的视频文件ID( |
| screen_width | int | 否 | 屏幕宽度,默认值1080 |
| screen_height | int | 否 | 屏幕高度,默认值1920 |
| backway | int | 否 | 播放到结尾时的播放顺序:1-正常,2-反向。默认值1 |
| drive_mode | string | 否 | 驱动模式:""-正常,"random"-随机帧。默认值"" |
| callback | string | 否 | 异步通知的回调URL |
| model | int | 否 | 模型版本:0-基础版,1-高品质版。默认值0 |
| audio_type | string | 否 | 音频类型:"tts"-文本驱动,"audio"-音频驱动。默认值"tts" |
| tts_config | object | 是(当audio_type为tts时) | 当audio_type="tts"时的TTS配置 |
| tts_config.text | string | 是(当audio_type为tts时) | 待合成的文本 |
| tts_config.audio_man_id | string | 是(当audio_type为tts时) | 语音ID |
| tts_config.speed | number | 否 | 语速:0.5-2,默认值1 |
| tts_config.pitch | number | 否 | 音调,默认值1 |
| audio_file_id | string | 是(当audio_type为audio时) | 当 |
| volume | int | 否 | 音量:1-100,默认值100 |
响应示例:
json
{
"trace_id": "8d10659438827bd4d59eaa2696f9d391",
"code": 0,
"msg": "success",
"data": "9499ed79995c4bdb95f0d66ca84419fd"
}响应字段说明:
| 字段 | 说明 |
|---|---|
| code | 响应状态码 |
| msg | 响应消息 |
| data | 用于后续轮询的视频ID |
Query Task List
查询任务列表
Get a list of lip-syncing tasks.
http
POST /open/v1/video_lip_sync/list
access_token: {{access_token}}
Content-Type: application/jsonRequest body:
json
{
"page": 1,
"page_size": 10
}Request field description:
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | int | No | Page number, default 1 |
| page_size | int | No | Page size, default 10 |
Response example:
json
{
"trace_id": "8d10659438827bd4d59eaa2696f9d391",
"code": 0,
"msg": "success",
"data": {
"list": [
{
"id": "9499ed79995c4bdb95f0d66ca84419fd",
"status": 20,
"progress": 100,
"msg": "success",
"video_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.mp4",
"preview_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.jpg",
"duration": 300,
"create_time": 1738636800
}
],
"page_info": {
"page": 1,
"size": 10,
"total_count": 1,
"total_page": 1
}
}
}Response field description:
| First-level Field | Second-level Field | Description |
|---|---|---|
| code | Response status code | |
| msg | Response message | |
| data | Response data | |
| list | Task list | |
| id: Video ID | ||
| status: Task status (0-pending, 10-generating, 20-success, 30-failed) | ||
| progress: Progress 0-100 | ||
| msg: Task message | ||
| video_url: Video download URL | ||
| preview_url: Cover image URL | ||
| duration: Video duration in ms | ||
| create_time: Creation time (unix timestamp) | ||
| page_info | Pagination info |
获取唇形同步任务列表。
http
POST /open/v1/video_lip_sync/list
access_token: {{access_token}}
Content-Type: application/json请求体:
json
{
"page": 1,
"page_size": 10
}请求字段说明:
| 参数 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| page | int | 否 | 页码,默认值1 |
| page_size | int | 否 | 每页数量,默认值10 |
响应示例:
json
{
"trace_id": "8d10659438827bd4d59eaa2696f9d391",
"code": 0,
"msg": "success",
"data": {
"list": [
{
"id": "9499ed79995c4bdb95f0d66ca84419fd",
"status": 20,
"progress": 100,
"msg": "success",
"video_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.mp4",
"preview_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.jpg",
"duration": 300,
"create_time": 1738636800
}
],
"page_info": {
"page": 1,
"size": 10,
"total_count": 1,
"total_page": 1
}
}
}响应字段说明:
| 一级字段 | 二级字段 | 说明 |
|---|---|---|
| code | 响应状态码 | |
| msg | 响应消息 | |
| data | 响应数据 | |
| list | 任务列表 | |
| id: 视频ID | ||
| status: 任务状态(0-待处理,10-生成中,20-成功,30-失败) | ||
| progress: 进度0-100 | ||
| msg: 任务消息 | ||
| video_url: 视频下载URL | ||
| preview_url: 封面图片URL | ||
| duration: 视频时长(毫秒) | ||
| create_time: 创建时间(Unix时间戳) | ||
| page_info | 分页信息 |
Query Task Detail
查询任务详情
Poll the following API to check task status until completed.
http
GET /open/v1/video_lip_sync/detail
access_token: {{access_token}}Query params:
| Parameter | Description |
|---|---|
| id | Video ID |
Example:
GET /open/v1/video_lip_sync/detail?id=9499ed79995c4bdb95f0d66ca84419fdResponse example:
json
{
"trace_id": "8d10659438827bd4d59eaa2696f9d391",
"code": 0,
"msg": "success",
"data": {
"id": "9499ed79995c4bdb95f0d66ca84419fd",
"status": 20,
"progress": 100,
"msg": "success",
"video_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.mp4",
"preview_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.jpg",
"duration": 300,
"create_time": 1738636800
}
}Response field description:
| First-level Field | Second-level Field | Description |
|---|---|---|
| code | Response status code | |
| msg | Response message | |
| data | Response data | |
| id | Video ID | |
| status | Task status: 0-pending, 10-generating, 20-success, 30-failed | |
| progress | Progress 0-100 | |
| msg | Task message | |
| video_url | Video download URL | |
| preview_url | Cover image URL | |
| duration | Video duration in ms | |
| create_time | Creation time (unix timestamp) |
轮询以下API检查任务状态,直到任务完成。
http
GET /open/v1/video_lip_sync/detail
access_token: {{access_token}}查询参数:
| 参数 | 说明 |
|---|---|
| id | 视频ID |
示例:
GET /open/v1/video_lip_sync/detail?id=9499ed79995c4bdb95f0d66ca84419fd响应示例:
json
{
"trace_id": "8d10659438827bd4d59eaa2696f9d391",
"code": 0,
"msg": "success",
"data": {
"id": "9499ed79995c4bdb95f0d66ca84419fd",
"status": 20,
"progress": 100,
"msg": "success",
"video_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.mp4",
"preview_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.jpg",
"duration": 300,
"create_time": 1738636800
}
}响应字段说明:
| 一级字段 | 二级字段 | 说明 |
|---|---|---|
| code | 响应状态码 | |
| msg | 响应消息 | |
| data | 响应数据 | |
| id | 视频ID | |
| status | 任务状态:0-待处理,10-生成中,20-成功,30-失败 | |
| progress | 进度0-100 | |
| msg | 任务消息 | |
| video_url | 视频下载URL | |
| preview_url | 封面图片URL | |
| duration | 视频时长(毫秒) | |
| create_time | 创建时间(Unix时间戳) |
Callback Notification
回调通知
When a callback URL is provided, the system will send a POST request when the task completes:
json
{
"trace_id": "8d10659438827bd4d59eaa2696f9d391",
"code": 0,
"msg": "success",
"data": {
"id": "9499ed79995c4bdb95f0d66ca84419fd",
"status": 20,
"progress": 100,
"msg": "success",
"video_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.mp4",
"preview_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.jpg",
"duration": 300,
"create_time": 1738636800
}
}当提供回调URL时,系统会在任务完成时发送POST请求:
json
{
"trace_id": "8d10659438827bd4d59eaa2696f9d391",
"code": 0,
"msg": "success",
"data": {
"id": "9499ed79995c4bdb95f0d66ca84419fd",
"status": 20,
"progress": 100,
"msg": "success",
"video_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.mp4",
"preview_url": "https://res.chanjing.cc/xxx/lip-sync/9499ed79995c4bdb95f0d66ca84419fd.jpg",
"duration": 300,
"create_time": 1738636800
}
}Response Status Code Description
响应状态码说明
| Code | Description |
|---|---|
| 0 | Response successful |
| 10400 | AccessToken verification failed |
| 40000 | Parameter error |
| 40001 | Exceeds RPM/QPS limit |
| 50000 | System internal error |
| 状态码 | 说明 |
|---|---|
| 0 | 响应成功 |
| 10400 | AccessToken验证失败 |
| 40000 | 参数错误 |
| 40001 | 超出RPM/QPS限制 |
| 50000 | 系统内部错误 |