Build Avatar

After defining your avatar's appearance, build a full avatar model using the POST /v1/avatar/async_build endpoint.

Request

Provide a name for your avatar and a base64-encoded image representing its face or reference.

import requests
import base64

api_key = "YOUR_API_KEY"
base_url = "https://api.mirako.ai/v1"
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}

# Read and encode your reference image
with open("avatar_face.png", "rb") as f:
    image_b64 = base64.b64encode(f.read()).decode("utf-8")

payload = {
    "name": "MyAvatar",
    "image": image_b64
}

response = requests.post(
    f"{base_url}/avatar/async_build",
    headers=headers,
    json=payload
)
response.raise_for_status()
data = response.json()["data"]
avatar_id = data.get("avatar_id")
print(f"Build task started for avatar ID: {avatar_id}")

Note: Ensure your reference image is clear, well-lit, and cropped to focus on the face.

Dive deeper