Video / Vidu

Vidu S and when Video Editing## Overview

Vidu S provide Capability:localized example textDescriptionMethod
wheninput image and, can when /videoHTTP will+ WebSocket localized example text+ RTC Video
localized example textRTC and Capability, and RTCHTTP will+ WebSocket (PCM audio)
localized example textinput image+ audio (or ), video fileHTTP task+ Polling / localized example text
when Video Editingvideo 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**

```bash

curl -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

fieldTypeDescription
modelstringlocalized example textvidu-s2 (default, can If omitted); return 400
call_modestringvideo (default, video)/audio (only)
avatar.personastringRequired., 50000
avatar.image_uristringandavatar.id localized example text.image, supported URL / base64 / ID; only supported image, PNG / JPG / JPEG / WEBP,≤ 50MB
avatar.idstringandavatar.image_uri localized example text.imagereturn ID
avatar.voicestring,Tina.can or
avatar.greeting_instructionstringPrompt,≤ 200 localized example text
avatar.farewell_enabledboolwhen secondsvideo, default false
avatar.persona_enhancebool, default false
enable_recordingbool, default false.after will can query endpoint
idle_timeout_secondsintno input when, default 7200, range 10~ 7200 seconds
voice_model (when Model, create after can )fieldTypeDescription
voice_model.providerstringqwen_omni (default)/ doubao
voice_model.qwenobjectprovider=qwen_omni when:voice, language ()
voice_model.doubaoobjectprovider=doubao when, field
and provider.: voice> avatar.voice > provider defaultlocalized example text.and when provider, provider will.

localized example text

fieldTypeDescription
audio.enable_transcriptionboolafter WebSocket type=9 () and type=10 ()
vad.typestringserver (default, and /)/semantic ()
vad.thresholdfloatdefault 0.5, range [0, 1.0], only type=server localized example text
vad.silence_duration_msintdefault 400, range [200, 6000], only type=server localized example text
vad.idle_timeout_msintafter, 0 or[500, 30000], default 0 localized example text
idle_motionobject:enabled, source (default / custom / mixed), recommend (random / intelligent), motions[] (name / content / weight / description), scheduling (motion_interval / rest_after_motion)
action.enabledboolwhen, default false
action.library_idstringID,"0" or as default.as create
llm.temperaturefloatdefault 0.7, range [0.0, 2.0)
llm.top_pfloatdefault 0.8, range (0.0, 1.0]
llm.top_kintdefault 20, range [0, 100]
llm.frequency_penaltyfloatdefault 1.0 (),> 1 localized example text
llm.presence_penaltyfloatdefault 0.3, range [0, 2]
llm.seedintdefault -1 (), range 0~ 2³¹-1
llm.max_tokensintdefault 50, range 1 ~ 64K

knowledge_retrieval / memory_retrieval

fieldTypeDescription
enabledbool, default false
providerstringself (default, HTTP )/vidu (/ )
endpointstringprovider=self when Required, http(s)
authorizationstringprovider=self when Required, as Authorization
timeout_msintonly provider=self, default 3000, maximum 30000
tool_instructionstringin after,≤ 2000 localized example text
knowledge_base_idstringknowledge_retrieval localized example text.provider=vidu when Required, as create
force_searchboolknowledge_retrieval localized example text., default false
user_idstringmemory_retrieval localized example text.,1 ~ 54 characters, localized example text
agent_idstringmemory_retrieval localized example text.,≤ 64 characters
enable_writeboolmemory_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"
 }
}
fieldDescription
live.idwill ID (live_id), after with
live.statuswhen aswaiting, not
live.live_durationwill maximum Duration (seconds), when
rtc.*RTC will,token default 1 hoursvalid, create will
client_secretin, 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:fieldDescription
live.statuswaiting / prepared / on_live / ending / ended
live.created_at / start_time / end_timecreate / / when (Unix seconds)
live.trace_idID, when
live.billed_secondsseconds, (on_live)
live.voice_modelcreate when Model
query create will, will return 404.endpoint when.

1.3 will list**GET** /live/v1/lives?pager.page=0&pager.pagesz=10

ParameterDescription
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 ParameterDescription
live_idRequired, will returnlive.id
conn_idOptional, ID; If omitted.localized example text
client_secretScenario can use,Authorization localized example text

Format

{
 "type": 1,
 "live_id": "1234567890",
 "conn_id": "app-conn-1",
 "seq_id": 1,
 "payload": {}
}
typelocalized example textlocalized example textDescription
1conn_initlocalized example text→ localized example textafter must
2conn_init_acklocalized example text→ localized example text,success=true,localized example text
5call_hanguplocalized example text→ localized example text,payload.hangup.hangup_reason localized example textuser_end
6force_hanguplocalized example text→ localized example text( when,, Insufficient balance etc. )
7audio_interruptedlocalized example text→ localized example textfirst output
9 / 10localized example textlocalized example text→ localized example textlocalized example textaudio.enable_transcription after
11 / 12prompt_operation / acklocalized example textin / Reference image (only vidu-s2)
97 / 98session_update / acklocalized example textin will
99text_msglocalized example text→ localized example textlocalized 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_reasonScenario
user_endlocalized example text
timeoutwill when
audit_violationlocalized example text
credit_insufficientInsufficient balance
client_reconnect_timeoutafter exceeds width not
localized example textsip_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" }
 ]
 }
 }
}
fieldDescription
op_typeswitch (default)/ remove
images1 ~ 3 images Reference image;remove when can ( first ) orimage_id localized example text
images[].image_uriURL / base64 / ID
images[].image_idRequired, 1 ~ 128 characters, can
images[].kindOptional:object / garment / background, If omittedlocalized example text
images[].user_textOptional, 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 textlive_id andconn_id, after conn_init; exceeds width not, will and.
  • when can close code1012, 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;
  • inrtc.token_expire_at first 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"
 }
}
fieldTypeDescription
modelstringlocalized example textvidu-s2 (default, can If omitted); return 400
image_uristringandavatar_id localized example text.image, URL / base64 / ID, only supported image,≤ 50MB
avatar_idstringandimage_uri localized example text.imagereturn ID
rtc_info.providerstringRequired, RTC Type:artc / trtc / agora / volcengine
rtc_info.app_idstringRTC ID (provider=artc when can )
rtc_info.channel_idstringRTC ID, token in when can
rtc_info.user_idstringID, token in when can
rtc_info.tokenstringRequired, RTC token

Response Example

{
 "live": {
 "id": "1234567890",
 "status": "waiting",
 "call_mode": "video",
 "created_at": "1710000000",
 "trace_id": "abc123"
 },
 "client_secret": "vls_xxxxxxxx"
}
fieldDescription
live.idwill ID
live.statuswaiting / prepared / on_live / ending / ended
client_secretWebSocket,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`

```bash

curl -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"
 }
 }
}
ParameterDescription
promptsReference image, up to 1type=image; content Formatlocalized example textimage_url.If omittedReference image
editing_typeIf omittedScenario
prompts andediting_type localized 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_codeDescription
NOT_READYwhen not (type=2 )
SIP_READY_TIMEOUTetc., will, create
LIVE_ENDEDwill
LIVE_CONN_INIT_FAILEDnot Failure, can after conn_init
SWITCH_PROMPT_INVALIDParameter (image and Scenario, image or Format etc. )
LIVE_NOT_ACTIVEwill not in in
RENDER_NOT_READYnot, after
SWITCH_PROMPT_EXPIRED,seq_id localized example text
RENDER_WRITE_FAILED / SWITCH_PROMPT_TIMEOUTFailure / when, can
SWITCH_PROMPT_INTERNAL_ERRORError,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": ","
 }'
fieldTypeRequiredDescription
modelstringNolocalized example textvidu-s2 (default, can If omitted); return 400
imagestringYesimage:URL / base64 ( MIME first )/ssupload:?id=<id>, onlysupported image
image_recaptionstringNoimage,≤ 8192; If omitted
audiostringConditionaudio, URL / base64 / ID.and text, when audio as
textstringCondition, UTF-8,≤ 10000, (default, supported )
timelinestringNowhen,after JSON characters (Note), If omittedaudio
resolutionstringNo720p (default)/ 1080p / 2K
callback_urlstringNotaskCallback URL,4.3 localized example text
payloadstringNoParameter, in query results and in,
watermarkboolNowatermark,, only false
wm_positionstringNo「AI localized example text」Location:top_left / top_right / bottom_left / bottom_right (default)
wm_urlstringNowatermark image URL
meta_datastringNodata, JSON Formatcharacters

timeline Format

fieldTypeDescription
actionsarraylist
actions[].textstring, can「localized example text」, can,, Location
actions[].time_rangeuint32[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"
 }
 ]
}
fieldDescription
statecreated / queueing / processing (Polling)/success / failed ()
progress,, only,
err_code / err_msgFailure,err_msg field or asset
durationvideoDuration (seconds),
modeluse Model, Note return characters (vidus2)
creations[].urlno watermarkvideo,24 hoursvalid
creations[].cover_url, 24 hoursvalid
creations[].watermarked_urlwatermarkvideo, 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_url as 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-426614174000
path and query URL callback_url in,.

4.4 taskFailure err_code

err_codeDescriptionrecommended
FieldInvalidParameterFailureresolution, timeline etc. field
ImageDownloadFailureimageFailureimage can, no, not
ImageFormatInvalid / ImageSizeInvalidimageFormat / dimensionsPNG / JPG / JPEG / WEBP, dimensions
ImageCheckFaceFailed / NoFaceDetectednot, image
ImageCheckBodyJointsFailed / ImageObjectsUndetectedFailure /can, no image
MultiFaceDetectedlocalized example textimage
AuditSubmitIllegal / CreationPolicyViolationinput not /asset or
UserCancelledlocalized example text—
InternalServiceFailureErrorafter, 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"
 }'
fieldTypeDescription
audio_urlstringRequired.Reference audio, URL or data URI, 1~ 2048; WAV (16-bit)/ MP3 / M4A, recommended 10 ~ 20 seconds, maximum 60 seconds,< 10MB
voicestringRequired., 1~ 16, only,,,can
textstringReference audio,,≤ 4096 localized example text
languagestringReference audio,zh, en, ja, ko etc., supported in
providerstringwhen 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.

MethodPathDescription
POST/live/v1/knowledge-basescreate,name Optional, ≤ 256; complete, 2 seconds
GET/live/v1/knowledge-bases?pager.page=0&pager.pagesz=20list, 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}/documentslist, 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.

MethodPathDescription
POST/live/v1/action-librariescreate,name Required (1 ~ 50, can ),description ≤ 200
GET/live/v1/action-libraries?pager.page=0&pager.pagesz=10list, 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 textBilling Method
whenwill seconds,2 seconds (11 seconds 12 seconds)
localized example textwill seconds
when Video Editingwill seconds; Reference image
localized example textvideoDuration (seconds); onlySuccess when, Failure
localized example text, Success when
/ / / imagelocalized 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.
Updated 2026-11-04