| Vidu S provide Capability: | localized example text | Description | Method |
|---|---|---|---|
| when | input image and, can when /video | HTTP will+ WebSocket localized example text+ RTC Video | |
| localized example text | RTC and Capability, and RTC | HTTP will+ WebSocket (PCM audio) | |
| localized example text | input image+ audio (or ), video file | HTTP task+ Polling / localized example text | |
| when Video Editing | video when,,, | HTTP will+ WebSocket localized example text+ RTC Video |
with endpoint in/vidu first, endpointPath, Request/field and WebSocket Vidu S.complete, Base URL and API Key can.
Base URL: https://mm-internal-cn.leonecloud.com/vidu
WebSocket Base URL: will Base URLhttps:// localized example textwss://, localized example textwss://mm-internal-cn.leonecloud.com/vidu
Authentication
HTTP and WebSocket inAuthorization API Key, etc.:```
Authorization: Token {YOUR_API_KEY}
Authorization: Bearer {YOUR_API_KEY}
Authorization: {YOUR_API_KEY}
> when Video Editing first Key ( number ), can use.
no WebSocket Request when, can will in return`client_secret` as query Parameter, WebSocket.
> in, App etc. API Key.will etc. HTTP Request, use`client_secret`.
---
## localized example text| localized example text| localized example text|
|----|------|
| dataFormat | Requestand as JSON, field use snake_case (`call_mode`, `live_id`) |
| ID and when| `live_id`, `task_id`, `created_at`, `token_expire_at` etc. int64 fieldrecommended first characters, JavaScript|
| not field| will / taskRequest Body in, not**field will** |
| Request Bodysize| HTTP Request Body 32 MB; base64 asset when recommended URL or ID|
| WebSocket localized example text|, as 16 MiB|
| asset| image / audiosupported URL, base64 ( MIME first,`data:image/png;base64,...`), ID (`ssupload:?id=<id>`)localized example text|
| localized example text|,,,, upload a file, API Key; will|
---
## endpointlocalized example text| Method | Path (Base URL)| localized example text|
|--------|------|------|
| POST | `/live/s_avatar/realtime` | when: create will|
| POST | `/live/s_avatar/component` |: create will|
| POST | `/live/s_editing/realtime` | when Video Editing: create will|
| GET | `/live/v1/lives/{live_id}` | query will Status and Duration|
| GET | `/live/v1/lives` | query will list|
| GET | `/live/v1/lives/{live_id}/recording` | query when file|
| WebSocket | `/live/ws/live/connect` | when / when Video Editing:|
| WebSocket | `/live/v1/external-lives/{live_id}/stream` |:+ PCM Audio |
| POST | `/ent/s_avatar/offline` |:Create Task|
| GET | `/ent/v2/tasks/{task_id}/creations` |:Query Task|
| POST | `/live/v1/voices/clone` | localized example text|
| GET | `/live/v1/voices` | query list|
| DELETE | `/live/v1/voices/{voice}` | localized example text|
| POST | `/live/v1/memories` | create|
| POST | `/live/v1/memories/search` | localized example text|
| POST | `/live/v1/memories/list` | list|
| DELETE | `/live/v1/memories?user_id=...` | localized example text|
| POST / GET | `/live/v1/knowledge-bases` | create /|
| GET / DELETE | `/live/v1/knowledge-bases/{id}` | query /|
| POST / GET | `/live/v1/knowledge-bases/{id}/documents` | /|
| GET / DELETE | `/live/v1/knowledge-bases/{id}/documents/{document_id}` | query /|
| POST / GET | `/live/v1/action-libraries` | create /|
| GET / PATCH / DELETE | `/live/v1/action-libraries/{id}` | query / /|
| POST / GET | `/live/v1/action-libraries/{id}/actions` | /|
| GET / PATCH / DELETE | `/live/v1/action-libraries/{id}/actions/{action_id}` | query / /|
| POST / PUT | `/tools/v2/files/uploads` | imagelocalized example text|
---
## Quick Start (when )**1. create will**
```bashcurl -X POST "https://mm-internal-cn.leonecloud.com/vidu/live/s_avatar/realtime" \
-H "Authorization: Token your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "vidu-s2",
"call_mode": "video",
"avatar": {
"persona": "Tina",
"image_uri": "https://example.com/avatar.png",
"voice": "Tina"
}
}'
in the`live.id` (after`live_id`)and`rtc` will.
**2. WebSocket and conn_init**
wss://mm-internal-cn.leonecloud.com/vidu/live/ws/live/connect?live_id={live_id}&conn_id={conn_id}
Authorization: Token your_api_key_here
after:```json
{
"type": 1,
"live_id": "1234567890",
"conn_id": "app-conn-1",
"seq_id": 1,
"payload": { "conn_init": { "version": 1 } }
}localized example textconn_init_ack.success=true ().
3. RTC
usertc.app_id / rtc.channel_id / rtc.user_id / rtc.token AliRTC SDKjoinChannel will, (video ), video.
4. localized example text
localized example textcall_hangup (type=5)after WebSocket, RTC SDKleaveChannel().will after canGET /live/v1/lives/{live_id} localized example textbilled_seconds.
##, when### 1.1 create willPOST /live/s_avatar/realtime
Request Example
{
"model": "vidu-s2",
"call_mode": "video",
"avatar": {
"persona": "Tina,",
"image_uri": "https://example.com/avatar.png",
"voice": "Tina"
},
"action": { "enabled": true, "library_id": "<action_library_id>" },
"enable_recording": true,
"audio": { "enable_transcription": true },
"vad": { "type": "server", "threshold": 0.5, "silence_duration_ms": 400 },
"llm": { "temperature": 0.7, "top_p": 0.8, "max_tokens": 50 },
"idle_timeout_seconds": 7200,
"memory_retrieval": {
"enabled": true,
"provider": "vidu",
"user_id": "customer-user-001",
"enable_write": true
},
"knowledge_retrieval": {
"enabled": true,
"provider": "vidu",
"knowledge_base_id": "<knowledge_base_id>"
}
}field
| field | Type | Description |
|---|---|---|
| model | string | localized example textvidu-s2 (default, can If omitted); return 400 |
| call_mode | string | video (default, video)/audio (only) |
| avatar.persona | string | Required., 50000 |
| avatar.image_uri | string | andavatar.id localized example text.image, supported URL / base64 / ID; only supported image, PNG / JPG / JPEG / WEBP,≤ 50MB |
| avatar.id | string | andavatar.image_uri localized example text.imagereturn ID |
| avatar.voice | string | ,Tina.can or |
| avatar.greeting_instruction | string | Prompt,≤ 200 localized example text |
| avatar.farewell_enabled | bool | when secondsvideo, default false |
| avatar.persona_enhance | bool | , default false |
| enable_recording | bool | , default false.after will can query endpoint |
| idle_timeout_seconds | int | no input when, default 7200, range 10~ 7200 seconds |
| voice_model (when Model, create after can ) | field | Type | Description |
|---|---|---|---|
| voice_model.provider | string | qwen_omni (default)/ doubao | |
| voice_model.qwen | object | provider=qwen_omni when:voice, language () | |
| voice_model.doubao | object | provider=doubao when, field |
and provider.: voice> avatar.voice > provider defaultlocalized example text.and when provider, provider will.
localized example text
| field | Type | Description |
|---|---|---|
| audio.enable_transcription | bool | after WebSocket type=9 () and type=10 () |
| vad.type | string | server (default, and /)/semantic () |
| vad.threshold | float | default 0.5, range [0, 1.0], only type=server localized example text |
| vad.silence_duration_ms | int | default 400, range [200, 6000], only type=server localized example text |
| vad.idle_timeout_ms | int | after, 0 or[500, 30000], default 0 localized example text |
| idle_motion | object | :enabled, source (default / custom / mixed), recommend (random / intelligent), motions[] (name / content / weight / description), scheduling (motion_interval / rest_after_motion) |
| action.enabled | bool | when, default false |
| action.library_id | string | ID,"0" or as default.as create |
| llm.temperature | float | default 0.7, range [0.0, 2.0) |
| llm.top_p | float | default 0.8, range (0.0, 1.0] |
| llm.top_k | int | default 20, range [0, 100] |
| llm.frequency_penalty | float | default 1.0 (),> 1 localized example text |
| llm.presence_penalty | float | default 0.3, range [0, 2] |
| llm.seed | int | default -1 (), range 0~ 2³¹-1 |
| llm.max_tokens | int | default 50, range 1 ~ 64K |
knowledge_retrieval / memory_retrieval
| field | Type | Description |
|---|---|---|
| enabled | bool | , default false |
| provider | string | self (default, HTTP )/vidu (/ ) |
| endpoint | string | provider=self when Required, http(s) |
| authorization | string | provider=self when Required, as Authorization |
| timeout_ms | int | only provider=self, default 3000, maximum 30000 |
| tool_instruction | string | in after,≤ 2000 localized example text |
| knowledge_base_id | string | knowledge_retrieval localized example text.provider=vidu when Required, as create |
| force_search | bool | knowledge_retrieval localized example text., default false |
| user_id | string | memory_retrieval localized example text.,1 ~ 54 characters, localized example text |
| agent_id | string | memory_retrieval localized example text.,≤ 64 characters |
| enable_write | bool | memory_retrieval localized example text.only provider=vidu valid, true when |
provider=self when, willendpoint/authorization, Request Bodylive_id,query,reason,memory_types/knowledge_types,time_hint,max_results; return{"memories": [...]}or{"knowledge": [...]}, no returned when applicable.
Response Example
{
"live": {
"id": "123456789",
"status": "waiting",
"live_duration": 600,
"call_mode": "video",
"voice_model": { "provider": "qwen_omni" }
},
"recording": { "enabled": true, "video_url": "" },
"rtc": {
"app_id": "xxxx",
"channel_id": "live-user-123456789",
"user_id": "live-user-1001-123456789",
"token": "base64-token...",
"token_expire_at": "1750003600"
}
}| field | Description |
|---|---|
| live.id | will ID (live_id), after with |
| live.status | when aswaiting, not |
| live.live_duration | will maximum Duration (seconds), when |
| rtc.* | RTC will,token default 1 hoursvalid, create will |
| client_secret | in, can WebSocket when use, validity periodrtc.token_expire_at |
video will Success create, WebSocket and conn_init,conn_init_ack localized example text.1.2 query will**GET** /live/v1/lives/{live_id}
as{"live": {...}}, field: | field | Description |
|---|---|---|
| live.status | waiting / prepared / on_live / ending / ended | |
| live.created_at / start_time / end_time | create / / when (Unix seconds) | |
| live.trace_id | ID, when | |
| live.billed_seconds | seconds, (on_live) | |
| live.voice_model | create when Model |
query create will, will return 404.endpoint when.
1.3 will list**GET** /live/v1/lives?pager.page=0&pager.pagesz=10
| Parameter | Description |
|---|---|
| pager.page | , 0 |
| pager.pagesz | ,≤ 0 10,> 100 100 |
{
"total": 12,
"lives": [
{ "id": "1234567890", "status": "ended", "call_mode": "video", "billed_seconds": 120 }
],
"next_page_token": ""
}onlyreturn will, Created Time;next_page_token as field, as.1.4 query file**GET** /live/v1/lives/{live_id}/recording
create will whenenable_recording: true.file in will after, Usually 2 minutes can, MP4 Format, 24 hoursvalid.
{
"recording": {
"enabled": true,
"video_url": "<file>",
"error_code": "unspecified",
"error_message": ""
}
}error_code:unspecified (no Failure)/start_failed / stop_failed / query_failed / transfer_failed.
1.5 WebSocket,, and, If omittedvideo.
wss://mm-internal-cn.leonecloud.com/vidu/live/ws/live/connect?live_id={live_id}&conn_id={conn_id}
Authorization: Token {YOUR_API_KEY}| Query Parameter | Description |
|---|---|
| live_id | Required, will returnlive.id |
| conn_id | Optional, ID; If omitted.localized example text |
| client_secret | Scenario can use,Authorization localized example text |
Format
{
"type": 1,
"live_id": "1234567890",
"conn_id": "app-conn-1",
"seq_id": 1,
"payload": {}
}| type | localized example text | localized example text | Description |
|---|---|---|---|
| 1 | conn_init | localized example text→ localized example text | after must |
| 2 | conn_init_ack | localized example text→ localized example text | ,success=true,localized example text |
| 5 | call_hangup | localized example text→ localized example text | ,payload.hangup.hangup_reason localized example textuser_end |
| 6 | force_hangup | localized example text→ localized example text | ( when,, Insufficient balance etc. ) |
| 7 | audio_interrupted | localized example text→ localized example text | first output |
| 9 / 10 | localized example text | localized example text→ localized example text | localized example textaudio.enable_transcription after |
| 11 / 12 | prompt_operation / ack | localized example text | in / Reference image (only vidu-s2) |
| 97 / 98 | session_update / ack | localized example text | in will |
| 99 | text_msg | localized example text→ localized example text | localized example text |
conn_init / conn_init_ack
{ "type": 1, "live_id": "1234567890", "conn_id": "app-conn-1", "seq_id": 1, "payload": { "conn_init": { "version": 1 } } }{
"type": 2,
"live_id": "1234567890",
"conn_id": "app-conn-1",
"seq_id": 2,
"payload": {
"conn_init_ack": { "success": true, "error_code": "", "error_msg": "", "server_timestamp": 1710000000 }
}
}video can returnerror_code: "NOT_READY",: etc. 2~ 3 secondsafter conn_init ( can ), will.
text_msg (type=99)
{
"type": 99,
"live_id": "1234567890",
"conn_id": "app-conn-1",
"seq_id": 10,
"payload": {
"text_msg": { "msg_id": "client-msg-1", "content": ",", "timestamp": 1710000000000 }
}
}call_hangup / force_hangup
{ "type": 5, "live_id": "1234567890", "conn_id": "app-conn-1", "seq_id": 12, "payload": { "hangup": { "hangup_reason": "user_end" } } }{ "type": 6, "live_id": "1234567890", "conn_id": "app-conn-1", "payload": { "hangup": { "hangup_reason": "timeout" } } }| hangup_reason | Scenario |
|---|---|
| user_end | localized example text |
| timeout | will when |
| audit_violation | localized example text |
| credit_insufficient | Insufficient balance |
| client_reconnect_timeout | after exceeds width not |
| localized example text | sip_closed, provider_closed, sip_reconnect_timeout, ai_output_closed, external etc. |
type=6, WebSocket close / error.
session_update (type=97)
{
"type": 97,
"live_id": "1234567890",
"conn_id": "app-conn-1",
"seq_id": 20,
"payload": {
"session_update": {
"avatar": { "voice": "Tina" },
"vad": { "type": "server", "threshold": 0.5, "silence_duration_ms": 400 },
"llm": { "temperature": 0.7, "top_p": 0.8, "max_tokens": 50 }
}
}
}can field:avatar.voice, avatar.persona, vad., knowledge_retrieval., memory_retrieval. (),llm., value rangewill., field, type=98 session_update_ack.
prompt_operation (type=11, only vidu-s2)
{
"type": 11,
"live_id": "1234567890",
"conn_id": "app-conn-1",
"seq_id": 1,
"payload": {
"prompt_operation": {
"op_type": "switch",
"images": [
{ "image_uri": "https://example.com/mug.png", "image_id": "mug-001", "kind": "object", "user_text": "character" }
]
}
}
}| field | Description |
|---|---|
| op_type | switch (default)/ remove |
| images | 1 ~ 3 images Reference image;remove when can ( first ) orimage_id localized example text |
| images[].image_uri | URL / base64 / ID |
| images[].image_id | Required, 1 ~ 128 characters, can |
| images[].kind | Optional:object / garment / background, If omittedlocalized example text |
| images[].user_text | Optional, localized example text |
after type=12 prompt_operation_ack, Failure error_code:PROMPT_OP_PARAM_INVALID / PROMPT_OP_MODEL_NOT_SUPPORTED / PROMPT_OP_LIVE_NOT_ACTIVE / PROMPT_OP_IMAGE_TRANSFER_FAILED / PROMPT_OP_SIP_NOT_CONNECTED / PROMPT_OP_FAILED.
in ID as file, ( ack,success=false).and
- 5 seconds ping, and when pong; 15 seconds no as.
- after, can in widthlocalized example text
live_idandconn_id, after conn_init; exceeds width not, will and. - when can close code
1012, Method can. - will maximum 7200 seconds,.
1.6 RTC will
WebSocket, AliRTC video, and, can.use will returnrtc.app_id / rtc.channel_id / rtc.user_id / rtc.token AliRTC SDKjoinChannel:
- audio (video video);
- video;
- in
rtc.token_expire_atfirst will, create will.
##,RTC and when CapabilityScenario:, and after video RTC; WebSocket audio (PCM) and.
2.1 create will**POST** /live/s_avatar/component
{
"model": "vidu-s2",
"image_uri": "https://example.com/avatar.jpg",
"rtc_info": {
"provider": "artc",
"app_id": "your-rtc-app-id",
"channel_id": "your-channel-id",
"user_id": "uid-123",
"token": "your-rtc-token"
}
}| field | Type | Description |
|---|---|---|
| model | string | localized example textvidu-s2 (default, can If omitted); return 400 |
| image_uri | string | andavatar_id localized example text.image, URL / base64 / ID, only supported image,≤ 50MB |
| avatar_id | string | andimage_uri localized example text.imagereturn ID |
| rtc_info.provider | string | Required, RTC Type:artc / trtc / agora / volcengine |
| rtc_info.app_id | string | RTC ID (provider=artc when can ) |
| rtc_info.channel_id | string | RTC ID, token in when can |
| rtc_info.user_id | string | ID, token in when can |
| rtc_info.token | string | Required, RTC token |
Response Example
{
"live": {
"id": "1234567890",
"status": "waiting",
"call_mode": "video",
"created_at": "1710000000",
"trace_id": "abc123"
},
"client_secret": "vls_xxxxxxxx"
}| field | Description |
|---|---|
| live.id | will ID |
| live.status | waiting / prepared / on_live / ending / ended |
| client_secret | WebSocket,24 hoursvalid |
query will use1.2 query will endpoint.
2.2 WebSocket localized example text``` wss://mm-internal-cn.leonecloud.com/vidu/live/v1/external-lives/{live_id}/stream?conn_id={conn_id}&client_secret={client_secret}
Scenario`client_secret` query Parameter, Scenario`Authorization`,; when provide when must, return 403.
| localized example text| Description |
|-----|------|
| localized example text| JSON,≤ 16 MiB |
| localized example text| PCM audio,≤ 16 MiB |
| first frame| mustconn_init; Success first PCM audio, audio_interrupted, prompt_operation will|
| localized example text| 5 seconds ping, 15 seconds no pong (data)|
**Type**
| type | localized example text| localized example text| Description |
|------|------|------|------|
| 1 | conn_init | localized example text→ localized example text| mustas first frame|
| 2 | conn_init_ack | localized example text→ localized example text|,`success=true` localized example text|
| 5 | call_hangup | localized example text→ localized example text|, WebSocket etc.|
| 6 | force_hangup | localized example text→ localized example text|, after|
| 7 | audio_interrupted | localized example text→ localized example text| first, recommended in VAD when|
| 9 | input_transcription | localized example text→ localized example text| / ASR|
| 10 | output_transcription | localized example text→ localized example text| LLM|
```json{ "type": 1, "seq_id": 1, "payload": { "conn_init": { "version": 1 } } }
```json{
"type": 9,
"seq_id": 10,
"payload": { "text_msg": { "msg_id": "msg-001", "content": "localized example text", "timestamp": 1710000000000 } }
}
```json{
"type": 10,
"seq_id": 11,
"payload": { "text_msg": { "msg_id": "msg-002", "content": "height", "timestamp": 1710000001000 } }
}
```json{ "type": 5, "seq_id": 13, "payload": { "hangup": { "hangup_reason": "client_hangup" } } }
**audiolocalized example text**:BinaryMessage PCM, JSON.
| Parameter | localized example text|
|-----|------|
| encoded | PCM 16-bit with (s16le)|
| localized example text| 24000 Hz |
| localized example text| localized example text|
| localized example text| 48 / seconds|
| recommendedlocalized example text| 20 ms (960 ) or 100 ms (4800 )|
**Failure** (HTTP Status Code return )| Status Code | Scenario |
|-------|------|
| 401 | `Authorization` and`client_secret`, or`client_secret` no /|
| 403 | will first|
| 400 | will, will or`live_id` no|
| 409 | will in|
conn_init_ack Failure `error_code`:`NOT_READY` (not, after conn_init,**no**)/ `LIVE_ENDED` (will, create )/`LIVE_CONN_INIT_FAILED` (Failure).
---
##, when Video Editing
Model video, when output after video; in can when Reference image or Scenario, in videolocalized example text.
| editing_type | Scenario | Reference imagelocalized example text|
|--------------|------|-------------|
| style_transfer | (default)| provide|
| subject_replacement | localized example text| provide after,, and|
| background_replacement | localized example text| provide after, subject and first image|
| virtual_tryon | localized example text| provide wear, and|
### 3.1 create will**POST** `/live/s_editing/realtime`
```bashcurl -X POST "https://mm-internal-cn.leonecloud.com/vidu/live/s_editing/realtime" \
-H "Authorization: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/reference.png",
"editing_type": "style_transfer",
"rtmp_urls": ["rtmp://push.example.com/live/stream1"]
}'
| Parameter | Type | Description |
|-----|------|------|
| image_url | string | Required.Reference image:ID (`ssupload:?id=...`)/ base64 data URI / http(s) URL |
| editing_type | string | `style_transfer` (default)/ `virtual_tryon` / `subject_replacement` / `background_replacement` |
| rtmp_urls | string[] | RTMP, up to 5,`rtmp://` localized example text≤ 2048 characters; If omittedor|
**Response Example**
```json{
"live": {
"id": "995200676634042368",
"live_duration": 120,
"status": "waiting",
"call_mode": "video",
"created_at": "1789025863",
"trace_id": "d17ab29172bef09b3f093b169c233e67"
},
"rtc": {
"app_id": "xxx",
"channel_id": "xxx",
"user_id": "xxx",
"token": "xxx",
"token_expire_at": "1789033063"
},
"render_uid": "xxx",
"client_secret": "vls_xxxxxxxx"
}
| field | Description |
|-----|------|
| live | will:`id`, `status`, `live_duration` (maximum seconds),`created_at` / `start_time` / `end_time`, `close_reason`, `trace_id` |
| rtc | AliRTC will, input|
| render_uid | ID, will after video as|
| client_secret | WebSocket, validity period`rtc.token_expire_at` |
### 3.2 WebSocket localized example text```
#:client_secret as query Parameter
wss://mm-internal-cn.leonecloud.com/vidu/live/ws/live/connect?live_id=<live_id>&conn_id=<conn_id>&client_secret=<client_secret>
#:Authorization Request
wss://mm-internal-cn.leonecloud.com/vidu/live/ws/live/connect?live_id=<live_id>&conn_id=<conn_id>
Authorization: {YOUR_API_KEY}after will, conn_init (type=1, Formatwhen ).localized example textconn_init_ack.success=true afteron_live and; returnNOT_READY when will in afterSuccess, no.
Reference image / Scenario (type=13)
{
"type": 13,
"live_id": "995200676634042368",
"conn_id": "conn-xxx",
"seq_id": 2,
"payload": {
"switch_prompt": {
"prompts": [{ "type": "image", "content": "https://example.com/new-reference.png" }],
"editing_type": "virtual_tryon"
}
}
}| Parameter | Description |
|---|---|
| prompts | Reference image, up to 1type=image; content Formatlocalized example textimage_url.If omittedReference image |
| editing_type | If omittedScenario |
promptsandediting_typelocalized example text.Successlocalized example text, seconds; Failure type=14 (success=false, localized example texterror_code/error_msg)., will,「localized example text」localized example text.
(type=5)
{ "type": 5, "live_id": "995200676634042368", "conn_id": "conn-xxx", "seq_id": 3, "payload": { "hangup": { "hangup_reason": "user_hangup" } } }WebSocket Error Codes
| error_code | Description |
|---|---|
| NOT_READY | when not (type=2 ) |
| SIP_READY_TIMEOUT | etc., will, create |
| LIVE_ENDED | will |
| LIVE_CONN_INIT_FAILED | not Failure, can after conn_init |
| SWITCH_PROMPT_INVALID | Parameter (image and Scenario, image or Format etc. ) |
| LIVE_NOT_ACTIVE | will not in in |
| RENDER_NOT_READY | not, after |
| SWITCH_PROMPT_EXPIRED | ,seq_id localized example text |
| RENDER_WRITE_FAILED / SWITCH_PROMPT_TIMEOUT | Failure / when, can |
| SWITCH_PROMPT_INTERNAL_ERROR | Error,trace_id localized example text |
3.3 and
-rtc will AliRTC SDKjoinChannel will, or video as input;
-render_uid video, when after; Status assubscribed after;
-rtmp_urls when, after will.will when use, will after 10 seconds; Failure will (live.close_reason).
##,
input images image+ audio ( or ), and video file, and RTC and WebSocket.
4.1 Create Task
POST /ent/s_avatar/offline
audio localized example text
curl -X POST "https://mm-internal-cn.leonecloud.com/vidu/ent/s_avatar/offline" \
-H "Authorization: Token your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "vidu-s2",
"image": "https://example.com/avatar.png",
"audio": "https://example.com/speech.mp3",
"timeline": "{\"actions\":[{\"text\":\"localized example text\",\"time_range\":[2,10]}]}",
"resolution": "720p",
"callback_url": "https://api.example.com/avatar/callback",
"payload": "biz-order-20260903-001"
}'text localized example text
curl -X POST "https://mm-internal-cn.leonecloud.com/vidu/ent/s_avatar/offline" \
-H "Authorization: Token your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"image": "https://example.com/avatar.png",
"text": ","
}'| field | Type | Required | Description |
|---|---|---|---|
| model | string | No | localized example textvidu-s2 (default, can If omitted); return 400 |
| image | string | Yes | image:URL / base64 ( MIME first )/ssupload:?id=<id>, onlysupported image |
| image_recaption | string | No | image,≤ 8192; If omitted |
| audio | string | Condition | audio, URL / base64 / ID.and text, when audio as |
| text | string | Condition | , UTF-8,≤ 10000, (default, supported ) |
| timeline | string | No | when,after JSON characters (Note), If omittedaudio |
| resolution | string | No | 720p (default)/ 1080p / 2K |
| callback_url | string | No | taskCallback URL,4.3 localized example text |
| payload | string | No | Parameter, in query results and in, |
| watermark | bool | No | watermark,, only false |
| wm_position | string | No | 「AI localized example text」Location:top_left / top_right / bottom_left / bottom_right (default) |
| wm_url | string | No | watermark image URL |
| meta_data | string | No | data, JSON Formatcharacters |
timeline Format
| field | Type | Description |
|---|---|---|
| actions | array | list |
| actions[].text | string | , can「localized example text」, can,, Location |
| actions[].time_range | uint32[2] | seconds, must 2; recommended≥ 5 seconds |
Response Example
{
"task_id": "123456789",
"state": "created",
"model": "vidu-s2",
"resolution": "720p",
"created_at": "2026-08-03T03:00:00Z"
}create Successtask,task_id Pollingquery endpoint or etc..4.2 Query Task
GET /ent/v2/tasks/{task_id}/creations
{
"id": "995640066728538112",
"state": "success",
"progress": 100,
"err_code": "",
"err_msg": "",
"duration": 18,
"type": "offline_avatar",
"model": "vidus2",
"resolution": "720p",
"payload": "",
"creations": [
{
"id": "995640297138438144",
"url": "https://.../video.mp4",
"cover_url": "https://.../cover.jpeg",
"watermarked_url": "https://.../watermarked.mp4"
}
]
}| field | Description |
|---|---|
| state | created / queueing / processing (Polling)/success / failed () |
| progress | ,, only, |
| err_code / err_msg | Failure,err_msg field or asset |
| duration | videoDuration (seconds), |
| model | use Model, Note return characters (vidus2) |
| creations[].url | no watermarkvideo,24 hoursvalid |
| creations[].cover_url | , 24 hoursvalid |
| creations[].watermarked_url | watermarkvideo, 24 hoursvalid;watermark=false when as |
Pollingrecommended 3~ 5 seconds, at least 2 seconds; Usually 40 seconds~ 2 minutes, recommendedwhen 5 minutes.and when store.onlyquery create task, return 404TaskNotFound.4.3 task whencallback_url, task(success / failed)after POST, Request Body and query endpoint.Failure will, 4 ( 3s / 5s / 10s).
callback_urlas can http(s), / will,;- Use Callback create API Key.
localized example text (HMAC-SHA256, after )```
signature = base64(HMAC-SHA256(secret_key, signingString))
signingString = http_method + "\n"
+ http_uri + "\n"
+ canonical_query_string + "\n"
+ access_key + "\n"
+ Date + "\n"
+ signed_headers_string
| Parameter | Description |
|-----|------|
| secret_key | Create Taskwhen use API Key|
| http_method | localized example text`POST` |
| http_uri | callback_url path,`/`, path as`/` |
| canonical_query_string | callback_url query, no Parameter when as|
| access_key | localized example text`vidu` |
| Date | RequestDate, GMT Format|
| signed_headers_string | localized example text`X-HMAC-SIGNED-HEADERS` localized example text`Key:Value\n` ()|
| Callback Requestlocalized example text| Description |
|-----------|------|
| Date | GMT when,`Tue, 06 May 2025 12:09:42 GMT` |
| x-request-nonce | localized example text|
| X-HMAC-SIGNED-HEADERS | and,`Date;x-request-nonce` |
| X-HMAC-SIGNATURE | localized example text|
| X-HMAC-ALGORITHM | localized example text`hmac-sha256` |
| X-HMAC-ACCESS-KEY | localized example text`vidu` |
localized example text`http://127.0.0.1:8080/avatar/callback?name=james&age=36` as, as ( with ):```
POST
/avatar/callback
name=james&age=36
vidu
Tue, 06 May 2025 12:09:42 GMT
Date:Tue, 06 May 2025 12:09:42 GMT
x-request-nonce:123e4567-e89b-12d3-a456-426614174000path and query URL callback_url in,.
4.4 taskFailure err_code
| err_code | Description | recommended |
|---|---|---|
| FieldInvalid | ParameterFailure | resolution, timeline etc. field |
| ImageDownloadFailure | imageFailure | image can, no, not |
| ImageFormatInvalid / ImageSizeInvalid | imageFormat / dimensions | PNG / JPG / JPEG / WEBP, dimensions |
| ImageCheckFaceFailed / NoFaceDetected | not | , image |
| ImageCheckBodyJointsFailed / ImageObjectsUndetected | Failure / | can, no image |
| MultiFaceDetected | localized example text | image |
| AuditSubmitIllegal / CreationPolicyViolation | input not / | asset or |
| UserCancelled | localized example text | — |
| InternalServiceFailure | Error | after, Failure task_id |
##,:,, create, return 404 ( will / in return 403).
5.1 localized example text**POST** /live/v1/voices/clone
curl -X POST "https://mm-internal-cn.leonecloud.com/vidu/live/v1/voices/clone" \
-H "Authorization: Token your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"audio_url": "https://example.com/reference.wav",
"voice": "my_voice",
"language": "zh",
"provider": "qwen_omni"
}'| field | Type | Description |
|---|---|---|
| audio_url | string | Required.Reference audio, URL or data URI, 1~ 2048; WAV (16-bit)/ MP3 / M4A, recommended 10 ~ 20 seconds, maximum 60 seconds,< 10MB |
| voice | string | Required., 1~ 16, only,,,can |
| text | string | Reference audio,,≤ 4096 localized example text |
| language | string | Reference audio,zh, en, ja, ko etc., supported in |
| provider | string | when Model:qwen_omni (default)/ doubao.provider will |
Success after,voice can willavatar.voice or providervoice, can use session_update.
query list:GET /live/v1/voices → {"voices": [{"voice": "my_voice"}]}
localized example text:DELETE /live/v1/voices/{voice}
5.2 localized example textmemory_retrieval.provider=vidu use.user_id as (1~ 54 characters), localized example textuser_id; useuser_id localized example text.
create POST /live/v1/memories
{
"user_id": "customer-user-001",
"messages": [
{ "role": "user", "content": "localized example text" },
{ "role": "assistant", "content": "," }
]
}messages (, role and content),user_id Required; agent_id (≤ 64), run_id, metadata Optional.in, can (results as ).
localized example text POST /live/v1/memories/search
{ "query": ", when", "user_id": "customer-user-001", "limit": 5 }list POST /live/v1/memories/list
{ "user_id": "customer-user-001", "page": 1, "page_size": 20 }localized example text DELETE /live/v1/memories?user_id=customer-user-001, canagent_id / run_id range, Success return{}.
field:id, memory (),user_id, agent_id, run_id (when as live_id),metadata, created_at / updated_at, score ().
5.3 localized example textknowledge_retrieval.provider=vidu use.up to 10 (), up to 1000.
| Method | Path | Description |
|---|---|---|
| POST | /live/v1/knowledge-bases | create,name Optional, ≤ 256; complete, 2 seconds |
| GET | /live/v1/knowledge-bases?pager.page=0&pager.pagesz=20 | list, returntotal, items, next_page_token |
| GET | /live/v1/knowledge-bases/{id} | localized example text |
| DELETE | /live/v1/knowledge-bases/{id} | localized example text |
| POST | /live/v1/knowledge-bases/{id}/documents | ,file_uri Required (can file ),name Optional;, Success can |
| GET | /live/v1/knowledge-bases/{id}/documents | list, Parameter |
| GET | /live/v1/knowledge-bases/{id}/documents/{document_id} | , returnfile_uri as when, |
| DELETE | /live/v1/knowledge-bases/{id}/documents/{document_id} | localized example text |
curl -X POST "https://mm-internal-cn.leonecloud.com/vidu/live/v1/knowledge-bases/<knowledge_base_id>/documents" \
-H "Authorization: Token your_api_key_here" \
-H "Content-Type: application/json" \
-d '{ "file_uri": "https://example.com/product-faq.txt", "name": "product-faq.txt" }'
```:`id`, `name`, `status`, `error_msg`, `created_at`, `updated_at`; localized example text`knowledge_base_id`, `file_uri`.Failure, when or no will in will.will in, in with.
5.4 in will whenaction.library_id localized example text.up to 2 (), up to 100.
| Method | Path | Description |
|---|---|---|
| POST | /live/v1/action-libraries | create,name Required (1 ~ 50, can ),description ≤ 200 |
| GET | /live/v1/action-libraries?pager.page=0&pager.pagesz=10 | list, returntotal + items, Created Time |
| GET / PATCH / DELETE | /live/v1/action-libraries/{id} | / name, description / ( and, in the will ) |
| POST | /live/v1/action-libraries/{id}/actions | ,name (1 ~ 20, can ),description (5 ~ 500 )Required; will after, Usuallyseconds |
| GET | /live/v1/action-libraries/{id}/actions[/{action_id}] | list /, can after |
| PATCH | /live/v1/action-libraries/{id}/actions/{action_id} | name; description, Failure |
| DELETE | /live/v1/action-libraries/{id}/actions/{action_id} | localized example text |
curl -X POST "https://mm-internal-cn.leonecloud.com/vidu/live/v1/action-libraries/<id>/actions" \
-H "Authorization: Token your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"name":"localized example text","description":"localized example text"}'5.5 imagelocalized example text**POST / PUT** /tools/v2/files/uploads
complete:
1.:POST /tools/v2/files/uploads, body {"scene": "avatar"}, return{"id": "...", "put_url": "...", "expires_at": "..."};
2. HTTPPUT fileput_url (1 hoursvalid),ETag;
3. complete:PUT /tools/v2/files/uploads/{id}/finish, body {"id": "<id>", "etag": "<ETag>"}, return{"uri": "ssupload:?id=<id>"}.
curl -X PUT "https://mm-internal-cn.leonecloud.com/vidu/tools/v2/files/uploads/<id>/finish" \
-H "Authorization: Token your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"id": "<id>", "etag": "\"760406355B619C6DCEEAD8161BE5B063\""}'complete afterssupload:?id=<id> localized example textavatar.image_uri, image_uri, image_url, localized example textimage / audio, and in the Reference image.asset use when can when.
ID only use, ID will.
Billing
| localized example text | Billing Method |
|---|---|
| when | will seconds,2 seconds (11 seconds 12 seconds) |
| localized example text | will seconds |
| when Video Editing | will seconds; Reference image |
| localized example text | videoDuration (seconds); onlySuccess when, Failure |
| localized example text | , Success when |
| / / / image | localized example text |
when will:
-localized example text:localized example textconn_init_ack.success=true (willon_live),.onlywill, only WebSocket or only RTC; not will.
- and:will when Duration; after Duration.
- Insufficient balance:Failure when,force_hangup (hangup_reason: "credit_insufficient")and will, seconds.
- localized example text:will after seconds, canGET /live/v1/lives/{live_id} localized example textbilled_seconds localized example text.
task when Duration (text, audio Duration), taskSuccess after Duration.
and and| localized example text| defaultlocalized example text| |----|---------| | when in the when will ( when )| 5 /, return 429| | localized example text| 10 / localized example text| | localized example text| 2 / localized example text|,.
ErrorHTTP endpointFailurereturned when applicable HTTP Status Code,:```json { "code": 400, "reason": "BAD_REQUEST", "message": "Invalid parameter", "metadata": {} }
| HTTP Status Code | reason | Scenario|
|------------|--------|---------|
| 400 | BAD_REQUEST etc.| Parameter, Requiredfield, will Status first|
| 400 | CreditInsufficient | Insufficient balance ( or API Key )|
| 401 | UNAUTHORIZED | API Key, FormatError or no;`client_secret` no or|
| 403 | FORBIDDEN | first will,,, or upload a file|
| 404 | NOT_FOUND / TaskNotFound | will, task or in, or first|
| 409 | — | will in WebSocket|
| 429 | TOO_MANY_REQUESTS etc.| and will or Request|
| 500 | INTERNAL_ERROR etc.|, can; Failure`live_id` / `task_id`, `trace_id` and Request when|
| 503 | SERVICE_UNAVAILABLE | can use, or first not|
> HTTP Status Code as,`reason` localized example text.
---
## - will etc. HTTP Request in, API Key; use`client_secret` WebSocket.
- when and when Video Editing when WebSocket () and RTC (), RTC AliRTC SDK.
- video localized example text`NOT_READY`,.
- conn_init, text_msg, audio_interrupted, call_hangup with.
- localized example text`force_hangup`, WebSocket close / error; recommended WebSocket, RTC.
- as task, Polling or;`callback_url` localized example text.
- with,, when as when, and when store.