Docs index: /llms.txt · every page as Markdown: add .md

‹ API reference

Agents

Create an avatar agent from a portrait, then manage it and make it speak.

An agent is an avatar (face, voice and persona) identified by a short code such as A23WJF0199. Create one, poll until it is ready, then use it everywhere: the web embed, the SDKs, talking video and live sessions. Creation and model adds cost credits per model (pricing); everything else on this page is free.

The sample avatars (such as A23WJF0199, wise-pup) only download; every other call on this page needs an agent you own, and returns 404 for a sample.

To add knowledge to a live session, see Knowledge; every operation is also in the API reference index.

The Python examples on this page use the requests package: install it first with pip install requests.

Generate an agent

POST /v1/agent/generate generateAgent

Starts an asynchronous creation and returns an agent_id at once. Credits are reserved at submit and refunded automatically if creation fails. Pick the model from the subject: a real person → essence-2; a cartoon, animal, robot or any other character → expression-2 (Choosing a model).

Request

ParameterTypeRequiredDescription
modelstringalways send itessence-2 (a real person), expression-2 (any character) or auto (picks from the image). essence-1 and expression-1 are the first generation. Always send it: it becomes required on 2026-12-26 (see Notes).
imagestringnoPortrait URL (publicly fetchable), a file_id or signed link from Files, or a data URL (data:image/png;base64,<base64>). Bare base64 without the data: prefix returns 400 VALIDATION_ERROR. Used as a reference; a portrait is generated from prompt when omitted
promptstringnoA description of the avatar’s role and personality. Creation writes the agent’s system prompt from it, so the stored system_prompt is new text, not a copy of yours (see below). Send prompt, image or both
audiostringnoVoice sample URL, a file_id or signed link from Files, or a data URL (data:audio/mpeg;base64,<base64>), for voice cloning. Bare base64 without the data: prefix returns 400 VALIDATION_ERROR. Requires attestation
attestationobjectwith audio{"attested": true, "variant": "a"}: your confirmation that the voice can be cloned (Clone a voice)
aspect_ratiostringno16:9 (default), 9:16 or 1:1
framingstringnoportrait (default) or full_body. full_body works with essence-2: send a photo that shows the person from head to toe. If the full-body result can’t be delivered, the creation fails and its credits are refunded in full. With essence-1 and expression-2, full_body isn’t available yet: the agent’s status becomes failed and nothing is charged. expression-2 currently frames a person from the head to the hips
transparencybooleannoNot offered right now: leave it out. It asks for a green-screen background for chroma key, and the check that confirms that background is being fixed, so a creation with it can come back with a plain backdrop. This page will say when it is back.
agent_idstringnoLeave it out; a fresh code is generated. If it names an agent you own that is not ready yet (for example a failed creation), that agent is regenerated in place (it returns to processing). A ready agent returns 409 AGENT_ALREADY_DELIVERED: add a model, or delete it and create a new one. An agent whose build is still running returns 409 TRAIN_IN_FLIGHT: wait for that build to finish. Another account’s code returns 404

A model outside your plan gets 403 PLAN_REQUIRED.

Your prompt is a description, not the stored text. Every creation, on every model, writes a new system prompt from your prompt (and from the image, if you sent one). The result is a full persona of at least 500 characters, usually several paragraphs, with a name and background added.

A short prompt and a long one are both rewritten, so the stored system_prompt can differ from what you sent, and your own wording or rules can be reworded or left out. With no prompt, a role chosen at random from a built-in list is picked and the persona is written from that and your image. With neither prompt nor image, the call returns 400 VALIDATION_ERROR before anything is charged.

To store exact text, create the agent, wait until it is ready, then send the text as system_prompt to update an agent. An update saves it as sent.

Headers: api-secret, and optionally Idempotency-Key: a repeated request with the same key returns the first response and starts no second creation.

Clone a voice

Sending a voice sample as audio clones that voice, so the request must also carry attestation: your confirmation that “This is my own voice, or I have the speaker’s permission to clone it.” Send it only when that is true; cloning someone else’s voice without permission breaks the acceptable use policy. Without it, the call returns 400 VOICE_CLONE_ATTESTATION_REQUIRED before anything is uploaded or charged.

Notes

  • Omitted, model still creates an expression-1 agent and warns (MODEL_DEFAULT_DEPRECATED), so a character is refused with 422. From 2026-12-26 model is required, and the bare names essence and expression (and the version field) are refused with a 400 naming the replacement.
  • Creation takes minutes for essence-2, essence-1 and expression-1, and longer for expression-2. Set your polling timeout per model.
  • Every model except expression-2 needs a clear, real human face. For essence-2, essence-1 or expression-1, a cartoon, stylized character, animal, robot or creature in the photo or prompt, or a photo with no face found, returns 422 MODEL_SUBJECT_MISMATCH before anything is charged; the message tells you to use Expression 2. An essence-2 creation or add also checks the photo’s face before charging: a face too small in frame, or several similar-sized faces, returns 422 IMAGE_FACE_UNSUITABLE — upload a closer photo of one person. auto routes people to essence-2 and everything else to expression-2.
  • A 200 does not mean the image was fetched. An unreachable image fails the creation a few seconds later (refunded); poll status to confirm. Creation is image-only: a video field returns 400 VIDEO_INPUT_NOT_SUPPORTED.
  • At most two essence-2 creations run at once per account; a third fails at once with a capacity message and no charge.

Example

curl

curl -X POST https://api.bithuman.ai/v1/agent/generate \
  -H "Content-Type: application/json" \
  -H "api-secret: $BITHUMAN_API_SECRET" \
  -H "Idempotency-Key: museum-guide-1" \
  -d '{"model": "expression-2", "prompt": "You are a cheerful museum guide.", "image": "https://example.com/portrait.jpg"}'

Python

import os, requests

resp = requests.post(
    "https://api.bithuman.ai/v1/agent/generate",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
    json={"model": "expression-2", "prompt": "You are a cheerful museum guide.", "image": "https://example.com/portrait.jpg"},
)
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agent/generate", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "api-secret": process.env.BITHUMAN_API_SECRET,
    "Idempotency-Key": "museum-guide-1",
  },
  body: JSON.stringify({
    model: "expression-2",
    prompt: "You are a cheerful museum guide.",
    image: "https://example.com/portrait.jpg",
  }),
});
console.log(await resp.json());

Response

{"success": true, "message": "Agent generation started", "agent_id": "A23WJF0199", "status": "processing"}

curl

curl -X POST https://api.bithuman.ai/v1/agent/generate \
  -H "Content-Type: application/json" \
  -H "api-secret: $BITHUMAN_API_SECRET" \
  -d '{"model": "expression-2", "prompt": "You are a cheerful museum guide.", "image": "https://example.com/portrait.jpg", "audio": "https://example.com/my-voice.wav", "attestation": {"attested": true, "variant": "a"}}'

Python

import os, requests

resp = requests.post(
    "https://api.bithuman.ai/v1/agent/generate",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
    json={
        "model": "expression-2",
        "prompt": "You are a cheerful museum guide.",
        "image": "https://example.com/portrait.jpg",
        "audio": "https://example.com/my-voice.wav",
        "attestation": {"attested": True, "variant": "a"},
    },
)
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agent/generate", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "api-secret": process.env.BITHUMAN_API_SECRET,
  },
  body: JSON.stringify({
    model: "expression-2",
    prompt: "You are a cheerful museum guide.",
    image: "https://example.com/portrait.jpg",
    audio: "https://example.com/my-voice.wav",
    attestation: { attested: true, variant: "a" },
  }),
});
console.log(await resp.json());

Poll status

GET /v1/agent/status/{agent_id} getAgentStatus

Reports a creation’s progress. Poll every 5 seconds until status is ready or failed. On the way status takes other values, such as generating and success, which are not final. A boolean final field, true only for ready and failed, is coming; until it appears in responses, stop on ready or failed.

A missing or mistyped agent_id returns 404 NOT_FOUND. The response is the agent’s full record, the same as Get an agent; the fields below are the ones to poll.

current_stepProgressStage
paymentabout 2%credits reserved
persona5–15%persona prepared
voice_imageabout 20%voice and portrait
videoabout 45%identity video (Essence models)
lip_sync70–99%the model step; the longest for second-generation models
done100%ready

Notes

  • supported_models lists the models the agent can be launched as, spelled as model values you can send back.

  • model_status gives each requested model’s state (pending, ready, failed). Models never requested are absent.

  • For second-generation models model_url is a storage reference, not a link: fetch the file with Download an agent’s model.

  • ready means the agent can be launched; it doesn’t yet mean its model file can be downloaded. The download returns 404 MODEL_ARTIFACT_NOT_READY until the file is published, so retry until it stops: Essence 1 at once; Essence 2: a new agent’s device copy is built when you first request it, which takes about 2 hours (poll model_status["essence-2"].planes.device); Expression 2 later (currently delayed; see status.bithuman.ai).

  • For an Essence 2 agent on the current engine, the response also carries model_status["essence-2"].planes: {"cloud": <state>, "device": <state>}. cloud is the agent’s state in the bitHuman cloud. device says whether the copy for your own devices (the Swift, Android and Python SDKs, the CLI and the browser’s render=local) can be downloaded. Poll device to know when to download:

    deviceMeaningWhat the download returns
    absentnot built yet404 MODEL_ARTIFACT_NOT_READY; a download request made with the owner’s API secret starts the build
    preparingbuilding404 MODEL_ARTIFACT_NOT_READY (reason: DEVICE_BUILD_PENDING); retry
    readybuiltthe file
    failedthe build stopped409 MODEL_UNAVAILABLE (reason: DEVICE_BUILD_FAILED); the agent still works in the cloud; contact support to re-run the build

    Builds run one at a time and can take several hours when others are waiting. While a build runs, the owner’s 404 message says when it was requested and whether it is being built or waiting in line. model_status["essence-2"].planes is absent for agents that don’t have it.

curl

curl https://api.bithuman.ai/v1/agent/status/A23WJF0199 -H "api-secret: $BITHUMAN_API_SECRET"

Python

import os, requests

resp = requests.get(
    "https://api.bithuman.ai/v1/agent/status/A23WJF0199",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
)
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agent/status/A23WJF0199", {
  headers: { "api-secret": process.env.BITHUMAN_API_SECRET },
});
console.log(await resp.json());
{"success": true, "data": {"agent_id": "A23WJF0199", "status": "ready", "progress": 1.0, "current_step": "done", "error_message": null, "supported_models": ["expression-2"], "model_status": {"expression-2": {"state": "ready", "reason": null}}, "name": "Museum Guide"}}
import os, time, requests

def wait_until_ready(agent_id, timeout_s=3 * 3600):
    deadline = time.time() + timeout_s
    while time.time() < deadline:
        r = requests.get(f"https://api.bithuman.ai/v1/agent/status/{agent_id}",
                         headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]}, timeout=30)
        if r.ok:
            data = r.json()["data"]
            if data["status"] in ("ready", "failed"):
                if data["status"] == "failed":
                    raise RuntimeError(data["error_message"])
                return data
        time.sleep(5)   # creation continues server-side through transient errors
    raise TimeoutError(agent_id)

Get an agent

GET /v1/agent/{code} getAgent

Returns the agent’s full record: persona (system_prompt, name, language), voice_id, media URLs, creation state, model and supported_models.

curl

curl https://api.bithuman.ai/v1/agent/A23WJF0199 -H "api-secret: $BITHUMAN_API_SECRET"

Python

import os, requests

resp = requests.get(
    "https://api.bithuman.ai/v1/agent/A23WJF0199",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
)
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agent/A23WJF0199", {
  headers: { "api-secret": process.env.BITHUMAN_API_SECRET },
});
console.log(await resp.json());
{"success": true, "data": {"code": "A23WJF0199", "status": "ready", "model": "expression-2", "supported_models": ["expression-2"], "name": "Museum Guide", "system_prompt": "You are Maya, a cheerful museum guide with a decade of experience… (the full text written at creation, several paragraphs)", "language": "en", "voice_id": "bf0a246a-8642-498a-9950-80c35e9276b5", "image_url": "https://…/image.jpg"}}

List your agents

GET /v1/agents listAgents

Lists your agents, newest first. Query: limit (default 20, max 100), offset, status (for example ready). Items are summaries (code, name, model, status, supported_models, created_at and a few more); read the full record with Get an agent. Deleted agents appear with status: "deleted". Older agents can also show completed, success or unknown; read supported_models to see what they can launch as.

curl

curl "https://api.bithuman.ai/v1/agents?status=ready&limit=20" -H "api-secret: $BITHUMAN_API_SECRET"

Python

import os, requests

resp = requests.get(
    "https://api.bithuman.ai/v1/agents?status=ready&limit=20",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
)
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agents?status=ready&limit=20", {
  headers: { "api-secret": process.env.BITHUMAN_API_SECRET },
});
console.log(await resp.json());
{"success": true, "data": [{"code": "A23WJF0199", "name": "Museum Guide", "model": "expression-2", "status": "ready"}], "pagination": {"limit": 20, "offset": 0, "total": 1, "has_more": false}}

Update an agent

POST /v1/agent/{code} updateAgent

POST /v1/agent/{code} (not PATCH, which returns 404) changes the system_prompt, the voice-provider selection (providers, see Voice providers), or both. Send at least one, or the call returns 400 MISSING_PARAM. The name is generated and cannot be set. The voice cannot be set here: change it in the Console (Voices).

curl

curl -X POST https://api.bithuman.ai/v1/agent/A23WJF0199 \
  -H "Content-Type: application/json" -H "api-secret: $BITHUMAN_API_SECRET" \
  -d '{"system_prompt": "You are a concise sales assistant."}'

Python

import os, requests

resp = requests.post(
    "https://api.bithuman.ai/v1/agent/A23WJF0199",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
    json={"system_prompt": "You are a concise sales assistant."},
)
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agent/A23WJF0199", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "api-secret": process.env.BITHUMAN_API_SECRET,
  },
  body: JSON.stringify({ system_prompt: "You are a concise sales assistant." }),
});
console.log(await resp.json());
{"agent_code": "A23WJF0199", "updated": true}

Delete an agent

DELETE /v1/agent/{code} deleteAgent

Deletes an agent you own. Usage history is kept. An unknown or unowned code returns 404.

curl

curl -X DELETE https://api.bithuman.ai/v1/agent/A23WJF0199 -H "api-secret: $BITHUMAN_API_SECRET"

Python

import os, requests

resp = requests.delete(
    "https://api.bithuman.ai/v1/agent/A23WJF0199",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
)
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agent/A23WJF0199", {
  method: "DELETE",
  headers: { "api-secret": process.env.BITHUMAN_API_SECRET },
});
console.log(await resp.json());
{"success": true, "agent_code": "A23WJF0199", "deleted": true}

Add a model to an existing agent

POST /v1/agent/{code}/models addAgentModel

Adds a model to a ready agent without re-creating it; the body is {"model": "<model>"}. Re-adding a model the agent has costs nothing, and a failed add is refunded.

modelNeedsTimeCredits
expression-1a stored image and voice, of a real personimmediatefree
expression-2a stored imagetakes longer to build2000
essence-2a stored identity video and a photoreal personabout 2–2.5 h (an add still trains; a new essence-2 agent is ready in minutes)500
essence-1a stored image or identity video, of a real person10–20 min250

Poll status until model_status["essence-2"].state is ready or failed. The top-level status stays ready during an add. A failed add is refunded, and its reason says why. Errors: 409 AGENT_NOT_READY, 422 MODEL_PREREQUISITE_MISSING, 422 MODEL_SUBJECT_MISMATCH (an essence-2, essence-1 or expression-1 add for an agent that isn’t a real person; nothing is charged, see Choosing a model).

curl

curl -X POST https://api.bithuman.ai/v1/agent/A23WJF0199/models \
  -H "Content-Type: application/json" -H "api-secret: $BITHUMAN_API_SECRET" \
  -d '{"model": "essence-2"}'

Python

import os, requests

resp = requests.post(
    "https://api.bithuman.ai/v1/agent/A23WJF0199/models",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
    json={"model": "essence-2"},
)
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agent/A23WJF0199/models", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "api-secret": process.env.BITHUMAN_API_SECRET,
  },
  body: JSON.stringify({ model: "essence-2" }),
});
console.log(await resp.json());
{"success": true, "agent_id": "A23WJF0199", "model": "essence-2", "status": "processing", "supported_models": ["expression-2"]}

Download an agent’s model

GET /v1/agent/{code}/model/download downloadAgentModel

Redirects (302) to the agent’s model file, a .imx container, for the SDKs and CLI. Pass ?model= to choose a model when the agent has several; the default is the model it was created with. Sample avatars download with no credential; your own agents need the api-secret header.

Keep your API secret on api.bithuman.ai. The redirect points at a storage host, and curl -L sends every -H header to it too. So ask for the file’s URL first (?redirect=false); the secret goes to api.bithuman.ai only:

Then download data.url from that answer (a signed URL, valid 1 hour) with no secret. In a shell, both steps together, using jq to read the URL:

Name the output file yourself (-o). An Essence 2 agent made on the current Essence 2 engine downloads as a package of several files once model_status["essence-2"].planes.device is ready (until then the download returns 404; see Poll status): get it with python -m bithuman pull <code> from the Python package (2.12.8 or newer: pip install -U bithuman), which prints its local path.

A single-file request for such an agent waits for its device copy to be built (a reason that starts with DEVICE_BUILD_, below), so use python -m bithuman pull for it.

Add ?redirect=false to get the URL as JSON:

StatusCodeMeaning
400MODEL_NOT_DOWNLOADABLEthe model has no file (expression-1)
403PLAN_REQUIREDthe model is not in your plan; the message names the plan
404MODEL_ARTIFACT_NOT_READYpublished shortly after ready, or the copy for your own devices is still being built (model_status["essence-2"].planes.device is absent or preparing, see Poll status); retry
409MODEL_NOT_GENERATEDthe agent does not have that model; add it
409MODEL_UNAVAILABLEreason DEVICE_BUILD_FAILED: the copy for your own devices couldn’t be built; the agent still works in the cloud; contact support to re-run the build

curl

curl -fsS -H "api-secret: $BITHUMAN_API_SECRET" \
  "https://api.bithuman.ai/v1/agent/A23WJF0199/model/download?model=expression-2&redirect=false"

Python

import os, requests

resp = requests.get(
    "https://api.bithuman.ai/v1/agent/A23WJF0199/model/download?model=expression-2&redirect=false",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
)
resp.raise_for_status()
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agent/A23WJF0199/model/download?model=expression-2&redirect=false", {
  headers: { "api-secret": process.env.BITHUMAN_API_SECRET },
});
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
console.log(await resp.json());
URL=$(curl -fsS -H "api-secret: $BITHUMAN_API_SECRET" \
  "https://api.bithuman.ai/v1/agent/A23WJF0199/model/download?model=expression-2&redirect=false" | jq -r .data.url)
curl -fL -o A23WJF0199.imx "$URL"
{"success": true, "data": {"code": "A23WJF0199", "model": "expression-2", "filename": "A23WJF0199.imx", "url": "https://…", "expires_in": 3600}}

List the freely downloadable showcase models

GET /v1/models/showcase getShowcaseManifest

Lists the sample avatars anyone can download, with no API secret and no account: slug, agent code, model and size. Each entry’s url is Download an agent’s model. bithuman list and bithuman pull read this list.

curl

curl https://api.bithuman.ai/v1/models/showcase

Python

import requests

resp = requests.get("https://api.bithuman.ai/v1/models/showcase")
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/models/showcase");
console.log(await resp.json());
{"version": 2, "updated": "2026-09-10", "models": [{"slug": "bolt", "name": "Bolt", "model": "expression-2", "agent_code": "X03BOLT", "url": "https://api.bithuman.ai/v1/agent/X03BOLT/model/download?model=expression-2", "size": 198106157}]}

List an agent’s live sessions

GET /v1/agent/{code}/sessions listAgentSessions

Lists the agent’s open sessions. Use a room_id whose deliverable is true with speak or add-context.

curl

curl https://api.bithuman.ai/v1/agent/A23WJF0199/sessions -H "api-secret: $BITHUMAN_API_SECRET"

Python

import os, requests

resp = requests.get(
    "https://api.bithuman.ai/v1/agent/A23WJF0199/sessions",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
)
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agent/A23WJF0199/sessions", {
  headers: { "api-secret": process.env.BITHUMAN_API_SECRET },
});
console.log(await resp.json());
{"agent_code": "A23WJF0199", "sessions": [{"room_id": "room-A23WJF0199-x1y2", "num_participants": 2, "created_at": 1788480000, "deliverable": true}]}

Make an agent speak

POST /v1/agent/{code}/speak agentSpeak

Makes the avatar say message in its live sessions: one session with room_id, or every deliverable session without it. With no live session it returns 404 NOT_FOUND.

curl

curl -X POST https://api.bithuman.ai/v1/agent/A23WJF0199/speak \
  -H "Content-Type: application/json" -H "api-secret: $BITHUMAN_API_SECRET" \
  -d '{"message": "We have a 20% discount today.", "room_id": "room-A23WJF0199-x1y2"}'

Python

import os, requests

resp = requests.post(
    "https://api.bithuman.ai/v1/agent/A23WJF0199/speak",
    headers={"api-secret": os.environ["BITHUMAN_API_SECRET"]},
    json={
        "message": "We have a 20% discount today.",
        "room_id": "room-A23WJF0199-x1y2",
    },
)
print(resp.json())

Node

const resp = await fetch("https://api.bithuman.ai/v1/agent/A23WJF0199/speak", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "api-secret": process.env.BITHUMAN_API_SECRET,
  },
  body: JSON.stringify({
    message: "We have a 20% discount today.",
    room_id: "room-A23WJF0199-x1y2",
  }),
});
console.log(await resp.json());
{"agent_code": "A23WJF0199", "delivered_to_rooms": 1, "rooms": ["room-A23WJF0199-x1y2"], "rooms_skipped": [], "rooms_failed": []}

This section moved: docs.bithuman.ai/api/knowledge#inject-knowledge

This section moved: docs.bithuman.ai/api/errors#agent-operations