chanjing-avatar

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Chanjing 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.
  1. Obtain an
    access_token
    , which is required for all subsequent API calls
  2. Upload your video/audio files using the File Management API to get
    file_id
  3. Create a lip-syncing task with video and audio/text using these
    file_id
    values
  4. Poll the Query Task Detail API or use Task List API to check status
  5. Download the generated video using the url in response when status is completed
需要调用多个API,所有API的域名均为:"https://open-api.chanjing.cc"。 所有请求均使用JSON格式通信。 在整个任务过程中,您需要使用utf-8编码和解码文本。
  1. 获取
    access_token
    ,这是后续所有API调用的必填项
  2. 使用文件管理API上传您的视频/音频文件,获取
    file_id
  3. 使用这些
    file_id
    ,结合视频和音频/文本创建唇形同步任务
  4. 调用查询任务详情API或任务列表API检查状态
  5. 当状态为完成时,使用响应中的URL下载生成的视频

Obtain AccessToken

获取AccessToken

http
POST /open/v1/access_token
Content-Type: application/json
Use 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 FieldSecond-level FieldDescription
codeResponse status code
msgResponse message
dataResponse data
access_tokenValid for one day, previous token will be invalidated
expire_inToken expiration time
Response Status Code Description
CodeDescription
0Success
400Invalid parameter format
40000Parameter error
50000System 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
file_id
values.
The 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:
KeyExampleDescription
servicelip_sync_video / lip_sync_audioFile usage purpose. Use
lip_sync_video
for driving video,
lip_sync_audio
for audio (if audio-driven).
name1.mp4Original file name including extension
You will get a response containing
sign_url
,
mime_type
, and
file_id
. Use the
sign_url
with HTTP
PUT
to upload the file, setting
Content-Type
to the returned
mime_type
. After the upload succeeds, keep the returned
file_id
; this is what you pass as
video_file_id
/
audio_file_id
below.
Note: 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}}
查询参数:
示例说明
servicelip_sync_video / lip_sync_audio文件使用场景。驱动视频使用
lip_sync_video
,音频驱动时音频文件使用
lip_sync_audio
name1.mp4包含扩展名的原始文件名
您将收到包含
sign_url
mime_type
file_id
的响应。使用
sign_url
通过HTTP
PUT
方法上传文件,并将
Content-Type
设置为返回的
mime_type
。上传成功后,请保存返回的
file_id
;后续将其作为
video_file_id
/
audio_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/json
Request 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 NameTypeRequiredDescription
video_file_idstringYesVideo file ID from File Management (
data.file_id
). Supports mp4, mov, webm
screen_widthintNoScreen width, default 1080
screen_heightintNoScreen height, default 1920
backwayintNoPlayback order when reaching end: 1-normal, 2-reverse. Default 1
drive_modestringNoDrive mode: ""-normal, "random"-random frame. Default ""
callbackstringNoCallback URL for async notification
modelintNoModel version: 0-basic, 1-high quality. Default 0
audio_typestringNoAudio type: "tts"-text driven, "audio"-audio driven. Default "tts"
tts_configobjectYes (for tts)TTS configuration when audio_type="tts"
tts_config.textstringYes (for tts)Text to synthesize
tts_config.audio_man_idstringYes (for tts)Voice ID
tts_config.speednumberNoSpeech speed: 0.5-2, default 1
tts_config.pitchnumberNoPitch, default 1
audio_file_idstringYes (for audio)Audio file ID from File Management (
data.file_id
) when
audio_type="audio"
. Supports mp3, m4a, wav
volumeintNoVolume: 1-100, default 100
Response example:
json
{
  "trace_id": "8d10659438827bd4d59eaa2696f9d391",
  "code": 0,
  "msg": "success",
  "data": "9499ed79995c4bdb95f0d66ca84419fd"
}
Response field description:
FieldDescription
codeResponse status code
msgResponse message
dataVideo 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_idstring文件管理API返回的视频文件ID(
data.file_id
)。支持mp4、mov、webm格式
screen_widthint屏幕宽度,默认值1080
screen_heightint屏幕高度,默认值1920
backwayint播放到结尾时的播放顺序:1-正常,2-反向。默认值1
drive_modestring驱动模式:""-正常,"random"-随机帧。默认值""
callbackstring异步通知的回调URL
modelint模型版本:0-基础版,1-高品质版。默认值0
audio_typestring音频类型:"tts"-文本驱动,"audio"-音频驱动。默认值"tts"
tts_configobject是(当audio_type为tts时)当audio_type="tts"时的TTS配置
tts_config.textstring是(当audio_type为tts时)待合成的文本
tts_config.audio_man_idstring是(当audio_type为tts时)语音ID
tts_config.speednumber语速:0.5-2,默认值1
tts_config.pitchnumber音调,默认值1
audio_file_idstring是(当audio_type为audio时)
audio_type="audio"
时,文件管理API返回的音频文件ID(
data.file_id
)。支持mp3、m4a、wav格式
volumeint音量: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/json
Request body:
json
{
  "page": 1,
  "page_size": 10
}
Request field description:
ParameterTypeRequiredDescription
pageintNoPage number, default 1
page_sizeintNoPage 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 FieldSecond-level FieldDescription
codeResponse status code
msgResponse message
dataResponse data
listTask 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_infoPagination info
获取唇形同步任务列表。
http
POST /open/v1/video_lip_sync/list
access_token: {{access_token}}
Content-Type: application/json
请求体:
json
{
  "page": 1,
  "page_size": 10
}
请求字段说明:
参数类型是否必填说明
pageint页码,默认值1
page_sizeint每页数量,默认值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:
ParameterDescription
idVideo ID
Example:
GET /open/v1/video_lip_sync/detail?id=9499ed79995c4bdb95f0d66ca84419fd
Response 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 FieldSecond-level FieldDescription
codeResponse status code
msgResponse message
dataResponse data
idVideo ID
statusTask status: 0-pending, 10-generating, 20-success, 30-failed
progressProgress 0-100
msgTask message
video_urlVideo download URL
preview_urlCover image URL
durationVideo duration in ms
create_timeCreation 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

响应状态码说明

CodeDescription
0Response successful
10400AccessToken verification failed
40000Parameter error
40001Exceeds RPM/QPS limit
50000System internal error
状态码说明
0响应成功
10400AccessToken验证失败
40000参数错误
40001超出RPM/QPS限制
50000系统内部错误