Description
- First you need to generate the voice through the following method or directly provide a link to the available voice file
- If you want to use the system’s sound model to generate speech, you need to generate a link by calling the interface Create TTS
- If you want to use the sound model you provide to generate speech, you need to generate a link by calling the interface Create Voice Clone
- Secondly, you need to provide an avatar link, which can be a picture or video.
- If you want to use the avatar provided by the system, you can obtain it through the interface Get Avatar List
- Then, you need to generate an avatar video by calling the API Create Avatar Video
- Finally,The processing status will be returned promptly through the provided callback address, or you can also query it by calling the interface Get Video Info
Get Avatar List
| Parameter | Value | Description |
|---|---|---|
| x-api-key | API Key | Your API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded. |
| Authorization | Bearer token | Your API Key used for request authorization. You can get from https://openapi.akool.com/api/open/v3/getToken api. |
| Parameter | Type | Value | Description |
|---|---|---|---|
| from | Number | 2、3 | 2 represents the official avatar of Akool, 3 represents the avatar uploaded by the user themselves,If empty, returns all avatars by default. |
| page | Number | 1 | Current number of pages,Default is 1. |
| size | Number | 10 | Current number of returns per page,Default is 100. |
| Parameter | Type | Value | Description |
|---|---|---|---|
| code | int | 1000 | Interface returns business status code(1000:success) |
| msg | String | OK | Interface returns status information |
| data | Array | [{ avatar_id: "xx", url: "" }] | avatar_id: Used by avatar interface and creating avatar interface. url: You can preview the avatar via the link. |
Get Avatar Detail
| Parameter | Value | Description |
|---|---|---|
| x-api-key | API Key | Your API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded. |
| Authorization | Bearer token | Your API Key used for request authorization. You can get from https://openapi.akool.com/api/open/v3/getToken api. |
| Parameter | Type | Value | Description |
|---|---|---|---|
| id | String | avatar record id. |
| Parameter | Type | Value | Description |
|---|---|---|---|
| code | int | 1000 | Interface returns business status code(1000:success) |
| msg | String | OK | Interface returns status information |
| data | Array | [{ avatar_id: "xx", url: "", status: "" }] | avatar_id: Used by avatar interface and creating avatar interface. url: You can preview the avatar via the link. status: 1-queueing 2-processing),3:completed 4-failed |
Upload Avatar
| Parameter | Value | Description |
|---|---|---|
| x-api-key | API Key | Your API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded. |
| Authorization | Bearer token | Your API Key used for request authorization. You can get from https://openapi.akool.com/api/open/v3/getToken api. |
| Parameter | Type | Value | Description |
|---|---|---|---|
| url | String | Avatar resource link. It is recommended that the video be about one minute long, and the avatar in the video content should rotate at a small angle and be clear. | |
| avatar_id | String | avatar unique ID,Can only contain /^a-zA-Z0-9/. | |
| name | String | Avatar display name for easier identification and management. | |
| type | Number | 1,2 | Avatar type, 1 represents real avatar, 2 represents stream avatar, When type is 2, you need to wait until status is 3 before you can use it, You can get the current status in real time through the interface https://openapi.akool.com/api/open/v3/avatar/create. |
| url_from | Number | 1,2 | url source, 1 means akool and other links, 2 means other third-party links (currently only supports YouTube / TikTok / X / Google Drive) |
| Parameter | Type | Value | Description |
|---|---|---|---|
| code | int | 1000 | Interface returns business status code(1000:success) |
| msg | String | OK | Interface returns status information |
| data | Array | [{ avatar_id: "xx", url: "", status: 1 }] | avatar_id: Used by creating live avatar interface. url: You can preview the avatar via the link. status: 1-queueing, 2-processing, 3-success, 4-failed |
Create Avatar Video
| Parameter | Value | Description |
|---|---|---|
| x-api-key | API Key | Your API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded. |
| Authorization | Bearer token | Your API Key used for request authorization. You can get from https://openapi.akool.com/api/open/v3/getToken api. |
| Parameter | Type | Value | Description |
|---|---|---|---|
| data | [Object] | ||
| [data].width | Number | 1920 | Set the output video width |
| [data].height | Number | 1080 | Set the output video height |
| [data].duration | Number | Set the output video duration (in milliseconds) | |
| [data].voice | Object | Set Video Sound | |
| [data].voice.voice_url | String | When you want to use the specified audio for cloning, you first need to call https://openapi.akool.com/api/open/v3/audio/create API for audio cloning, you will obtain the field 【url】 and pass it here | |
| [data].elements | [Object] | Collection of elements passed in in the video | |
| [data].[elements].url | [Object] | Link to element | |
| [data].[elements].scale_x | [Object] | Horizontal scaling ratio, range of values (0-1) | |
| [data].[elements].scale_y | [Object] | Vertical scaling ratio, range of values (0-1) | |
| [data].[elements].offset_x | [Object] | Horizontal offset of the upper left corner of the element from the video setting area (in pixels) | |
| [data].[elements].offset_y | [Object] | Vertical offset of the upper left corner of the element from the video setting area (in pixels) | |
| [data].[elements].type | [Object] | Element type(avatar、image、video) | |
| [data].[elements].layer_number | Number | Element hierarchy, with higher levels displayed above | |
| [data].[elements].avatar_id | Number | You use the avatar_id of the avatar model, and you can get from Avatar list V3 api, you will obtain the field 【avatar_id】 and pass it here | |
| [data].[elements].url | String | You can provide image or video url resources | |
| [data].ratio | String | Video ratio,default “16:9” | |
| [data].background | String | Video background color, default white (# ffffff) | |
| [data].avatarFrom | Number | You use the avatar from of the avatar model, and you can get from Avatar list V3 api, you will obtain the field 【from】 and pass it here | |
| duration | Number | Generate the total duration of the video, which defaults to the sum of the durations in the array sub-items (in milliseconds) | |
| webhookUrl | String | Callback url address based on HTTP request. |
voice_id and voice_url must provide one
| Parameter | Type | Value | Description |
|---|---|---|---|
| code | int | 1000 | Interface returns business status code (1000:success) |
| msg | String | Interface returns status information | |
| data | Object | { _id:"", video_status:3, video:"" } | _id: Interface returns data status: the status of video: 【1:queueing, 2:processing, 3:completed, 4:failed】, video: the url of Generated video |
Get Video Info
| Parameter | Value | Description |
|---|---|---|
| x-api-key | API Key | Your API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded. |
| Authorization | Bearer token | Your API Key used for request authorization. You can get from https://open.akool.com/api/open/v3/getToken api. |
| Parameter | Type | Value | Description |
|---|---|---|---|
| video_model_id | String | NULL | video db id: You can get it based on the _id field returned by https://openapi.akool.com/api/open/v3/avatar/createVideo . |
| Parameter | Type | Value | Description |
|---|---|---|---|
| code | int | 1000 | Interface returns business status code(1000:success) |
| msg | String | OK | Interface returns status information |
| data | Object | { video_status:1, _id:"", video:"" } | video_status: the status of video:【1:queueing, 2:processing, 3:completed, 4:failed】 video: Generated video resource url _id: Interface returns data |
Please note that if the value of the response code is not equal to 1000, the
request is failed or wrong
| Parameter | Value | Description |
|---|---|---|
| code | 1000 | Success |
| code | 1003 | Parameter error or Parameter can not be empty |
| code | 1006 | Your quota is not enough |
| code | 1109 | create avatar video error |
| code | 1102 | Authorization cannot be empty |
| code | 1200 | The account has been banned |
| code | 1201 | Create audio error, please try again later |