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

GET https://openapi.akool.com/api/open/v3/avatar/list

Request Headers

ParameterValueDescription
AuthorizationBearer {token}Your API Key used for request authorization. getToken

Query Attributes

ParameterTypeValueDescription
fromNumber2、32 represents the official avatar of Akool, 3 represents the avatar uploaded by the user themselves,If empty, returns all avatars by default.
pageNumber1Current number of pages,Default is 1.
sizeNumber10Current number of returns per page,Default is 100.

Response Attributes

ParameterTypeValueDescription
codeint1000Interface returns business status code(1000:success)
msgStringOKInterface returns status information
dataArray[{ 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

{
  "code": 1000,
  "msg": "ok",
  "data": [
    {
      "name": "Yasmin in White shirt",  // avatar name
      "avatar_id": "Yasmin_in_White_shirt_20231121",  //  parameter values ​​required to create talkingavatar
      "url": "https://drz0f01yeq1cx.cloudfront.net/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png", // avatar url
      "gender": "female",   //  avatar gender
      "thumbnailUrl": "https://drz0f01yeq1cx.cloudfront.net/avatar/thumbnail/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png", //  avatar thumbnail
      "from": 2 //  parameter values ​​required to create talkingavatar
    }
  ]
}

Create Talking avatar

POST https://openapi.akool.com/api/open/v3/talkingavatar/create

Request Headers

ParameterValueDescription
AuthorizationBearer {token}Your API Key used for request authorization.getToken.

Body Attributes

ParameterTypeValueDescription
widthNumber3840Set the output video width,must be 3840
heightNumber2160Set the output video height,must be 2160
avatar_fromNumber2 or 3You 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.
webhookUrlStringCallback url address based on HTTP request.
elements[Object]Collection of elements passed in in the video
[elements].urlStringLink 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_xNumber1Horizontal scaling ratio(Required when type is equal to image or avatar)
[elements].scale_yNumber1Vertical scaling ratio (Required when type is equal to image or avatar)
[elements].offset_xNumberHorizontal 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_yNumberVertical 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].heightNumberThe height of the element
[elements].widthNumberThe width of the element
[elements].typeStringElement type(avatar、image、audio)
[elements].avatar_idStringWhen 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

ParameterTypeValueDescription
codeint1000Interface returns business status code (1000:success)
msgStringInterface returns status information
dataObject{ _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:

  1. Obtain through webhook
  2. Obtain by polling the following interface Get Video Info

Example

Body

{
    "width": 3840,
    "height": 2160,
    "avatar_from": 3,
    "elements": [
        {
            "type": "image",
            "url": "https://drz0f01yeq1cx.cloudfront.net/1729480978805-talkingAvatarbg.png",
            "width": 780,
            "height": 438,
            "scale_x": 1,
            "scale_y": 1,
            "offset_x": 1920,
            "offset_y": 1080
        },
        {
            "type": "avatar",
            "url": "https://drz0f01yeq1cx.cloudfront.net/1732790419812-avavar_demo.jpg",
            "scale_x": 1,
            "scale_y": 1,
            "width": 1080,
            "height": 1080,
            "offset_x": 1920,
            "offset_y": 1080
        },
        {
            "type": "audio",
            "url": "https://drz0f01yeq1cx.cloudfront.net/1729666642023-bd6ad5f1-d558-40c7-b720-ad729688f814-6403.mp3"
        }
    ]
  "webhookUrl": "http://localhost:3007/api/open/v3/test/webhook"
}

Request

Response

{
    "code": 1000,
    "msg": "OK",
    "data": {
        "_id": "67491cdb4d9d1664a9782292",
        "uid": 100002,
        "video_id": "f1a489f4-0cca-4723-843b-e42003dc9f32",
        "task_id": "67491cdb1acd9d0ce2cc8998",
        "video_status": 1,
        "video": "",
        "create_time": 1732844763774
    }
}

Get Video Info

GET https://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64dd838cf0b6684651e90217

Request Headers

ParameterValueDescription
AuthorizationBearer {token}Your API Key used for request authorization.getToken.

Query Attributes

ParameterTypeValueDescription
video_model_idStringNULLvideo db id: You can get it based on the _id field returned by https://openapi.akool.com/api/open/v3/talkingavatar/create .

Response Attributes

ParameterTypeValueDescription
codeint1000Interface returns business status code(1000:success)
msgStringOKInterface returns status information
dataObject{ 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

{
  "code": 1000,
  "msg": "OK",
  "data": {
    "_id": "64dd92c1f0b6684651e90e09",
    "create_time": 1692242625334, //  content creation time
    "uid": 378337,
    "video_id": "0acfed62e24f4cfd8801c9e846347b1d", // video id
    "deduction_duration": 10,  // credits consumed by the final result
    "video_status": 2, // current status of video: 【1:queueing(The requested operation is being processed),2:processing(The requested operation is being processing),3:completed(The request operation has been processed successfully),4:failed(The request operation processing failed, the reason for the failure can be viewed in the video translation details.)】
    "video": "" //  Generated video resource url
  }
}

Get Avatar Detail

GET https://openapi.akool.com/api/open/v3/avatar/detail

Request Headers

ParameterValueDescription
AuthorizationBearer {token}Your API Key used for request authorization. getToken

Query Attributes

ParameterTypeValueDescription
idStringavatar record id.

Response Attributes

ParameterTypeValueDescription
codeint1000Interface returns business status code(1000:success)
msgStringOKInterface returns status information
dataArray[{ 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

{
  "code": 1000,
  "msg": "ok",
  "data": [
    {
      "_id": "66a1a02d591ad336275eda62",
        "uid": 100010,
        "type": 2,
        "from": 3,
        "status": 3,
        "name": "30870eb0",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1721868487350-6b4cc614038643eb9f842f4ddc3d5d56.mp4"
    }
  ]
}

Upload Avatar

GET https://openapi.akool.com/api/open/v3/avatar/create

Request Headers

ParameterValueDescription
AuthorizationBearer tokenYour API Key used for request authorization. getToken

Body Attributes

ParameterTypeValueDescription
urlStringAvatar 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_idStringavatar unique ID,Can only contain /^a-zA-Z0-9/.
typeString1,2Avatar 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

ParameterTypeValueDescription
codeint1000Interface returns business status code(1000:success)
msgStringOKInterface returns status information
dataArray[{ 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

{
  "code": 1000,
  "msg": "ok",
  "data": [
    {
      "_id": "655ffeada6976ea317087193",
      "disabled": false,
      "uid": 1,
      "type": 1,
      "from": 2,
      "status": 1,
      "sort": 12,
      "create_time": 1700788730000,
      "name": "Yasmin in White shirt",
      "avatar_id": "Yasmin_in_White_shirt_20231121",
      "url": "https://drz0f01yeq1cx.cloudfront.net/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
      "modify_url": "https://drz0f01yeq1cx.cloudfront.net/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
      "gender": "female",
      "thumbnailUrl": "https://drz0f01yeq1cx.cloudfront.net/avatar/thumbnail/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
      "crop_arr": []
    }
  ]
}

Response Code Description

Please note that if the value of the response code is not equal to 1000, the request is failed or wrong

ParameterValueDescription
code1000Success
code1003Parameter error or Parameter can not be empty
code1006Your quota is not enough
code1109create avatar video error
code1102Authorization cannot be empty
code1200The account has been banned
code1201Create audio error, please try again later