AI Tools Suite
Talking Avatar
Talking Avatar API documentation
The resources (image, video, voice) generated by our API are valid for 7 days. Please save the relevant resources as soon as possible to prevent expiration.
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 .Or provide your own avatar url.
- Then, you need to generate an avatar video by calling the API Create Talking Avatar
- 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
Request Headers
Parameter | Value | Description |
---|---|---|
Authorization | Bearer {token} | Your API Key used for request authorization. getToken |
Query Attributes
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. |
Response Attributes
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. |
Example
Request
Response
Create Talking avatar
Request Headers
Parameter | Value | Description |
---|---|---|
Authorization | Bearer {token} | Your API Key used for request authorization.getToken. |
Body Attributes
Parameter | Type | Value | Description |
---|---|---|---|
width | Number | 3840 | Set the output video width,must be 3840 |
height | Number | 2160 | Set the output video height,must be 2160 |
avatar_from | Number | 2 or 3 | You use the avatar from of the avatar model, and you can get from https://openapi.akool.com/api/open/v3/avatar/list api, you will obtain the field 【from】 and pass it here. If you provide an avatar URL yourself, avatar_from must be 3. |
webhookUrl | String | Callback url address based on HTTP request. | |
elements | [Object] | Collection of elements passed in in the video | |
[elements].url | String | Link to element(When type is equal to image, url can be either a link or a Hexadecimal Color Code). When avatar_from =2, you don’t need to pass this parameter | |
[elements].scale_x | Number | 1 | Horizontal scaling ratio(Required when type is equal to image or avatar) |
[elements].scale_y | Number | 1 | Vertical scaling ratio (Required when type is equal to image or avatar) |
[elements].offset_x | Number | Horizontal offset of the upper left corner of the element from the video setting area (in pixels)(Required when type is equal to image or avatar) | |
[elements].offset_y | Number | Vertical offset of the upper left corner of the element from the video setting area (in pixels)(Required when type is equal to image or avatar) | |
[elements].height | Number | The height of the element | |
[elements].width | Number | The width of the element | |
[elements].type | String | Element type(avatar、image、audio) | |
[elements].avatar_id | String | When type is equal to avatar, you use the avatar_id of the avatar model, and you can get from https://openapi.akool.com/api/open/v3/avatar/list api, you will obtain the field 【avatar_id】 and pass it here。 If you provide an avatar URL yourself, you don’t need to pass this parameter. |
Response Attributes
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 |
Please note that the generated video link can only be obtained when video_status is equal to 3. We provide 2 methods:
- Obtain through webhook
- Obtain by polling the following interface Get Video Info
Example
Body
Request
Response
Get Video Info
Request Headers
Parameter | Value | Description |
---|---|---|
Authorization | Bearer {token} | Your API Key used for request authorization.getToken. |
Query Attributes
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/talkingavatar/create . |
Response Attributes
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 |
Example
Request
Response
Get Avatar Detail
Request Headers
Parameter | Value | Description |
---|---|---|
Authorization | Bearer {token} | Your API Key used for request authorization. getToken |
Query Attributes
Parameter | Type | Value | Description |
---|---|---|---|
id | String | avatar record id. |
Response Attributes
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 |
Example
Request
Response
Upload Avatar
Request Headers
Parameter | Value | Description |
---|---|---|
Authorization | Bearer token | Your API Key used for request authorization. getToken |
Body Attributes
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/. | |
type | String | 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. |
Response Attributes
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 |
Example
Request
Response
Response Code Description
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 |