# Talking avatar API from one photo

URL: https://docs.bithuman.ai/start/talking-avatar-api

> Create an avatar from one portrait with the API, then talk to it live.

Send one portrait to `POST /v1/agent/generate` and bitHuman creates a talking avatar from it in the bitHuman cloud. Then talk to the avatar in real time through the REST API, an SDK or the LiveKit plugin; the finished avatar runs anywhere its model runs.

## Which model to use

Essence 2 renders a photoreal person from one portrait; Expression 2 renders any character (people, animals, cartoons) from one portrait.

| You have | Use |
|---|---|
| A photo of a real person | `essence-2`: photoreal, up to 1080p |
| A character, animal, robot or illustration | `expression-2`: any subject |
| Not sure | `auto`: people go to `essence-2`, everything else to `expression-2` |

Every model except Expression 2 needs a clear, real human face. Always send `model`: an omitted `model` creates a first-generation Expression 1 agent.

## Create the avatar

```bash
curl -X POST https://api.bithuman.ai/v1/agent/generate \
  -H "Content-Type: application/json" -H "api-secret: $BITHUMAN_API_SECRET" \
  -d '{"model": "auto", "prompt": "You are a friendly receptionist.", "image": "https://example.com/headshot.jpg"}'
```

```json
{"success": true, "message": "Agent generation started", "agent_id": "A80HVD8577", "status": "processing"}
```

Poll [`GET /v1/agent/status/{agent_id}`](https://docs.bithuman.ai/api/agents#poll-status) every few seconds until `status` is `ready` or `failed`. An Essence 2 avatar is ready in minutes; an Expression 2 avatar takes longer to build. Every step, with the voice and the persona: [Create your own avatar](https://docs.bithuman.ai/build/create-avatar).

### What makes a good photo

One subject, in focus, facing the camera with a resting expression and the whole face visible (eyes, nose and mouth). The image is under 10 MB, at a URL that opens in a browser without signing in. For an animal or character, use `expression-2` with a well-lit, front-facing photo and the face filling the frame.

## What it costs to create

Creating your own avatar is a one-time 500 credits for Essence 2 (ready in a few minutes) or 2,000 credits for Expression 2 (it takes longer to build).

A failed creation is refunded automatically. API use needs the Creator plan or higher. Every rate is on [Pricing](https://docs.bithuman.ai/pricing#creation--one-time-credits).

## Talk to it in real time

| You are building | Use |
|---|---|
| A web page | the [web embed](https://docs.bithuman.ai/platforms/web): `https://www.bithuman.ai/embed/<agent_id>` |
| A LiveKit voice agent | the [LiveKit plugin](https://docs.bithuman.ai/platforms/livekit): `bithuman.AvatarSession(avatar_id=…)` |
| An iPhone, iPad, Mac or Android app | the [Swift package](https://docs.bithuman.ai/platforms/ios) or the [Android SDK](https://docs.bithuman.ai/platforms/android), rendering on the device |
| A backend or a script | the [Python SDK](https://docs.bithuman.ai/platforms/python), or the [REST API](https://docs.bithuman.ai/platforms/rest) |
| A quick check from the terminal | the [CLI](https://docs.bithuman.ai/platforms/cli): `bithuman run <agent_id>` |

To make a live avatar say a line from your backend, call [`POST /v1/agent/{agent_id}/speak`](https://docs.bithuman.ai/api/agents#make-an-agent-speak).

A real-time session bills to the second at the rates on [Pricing](https://docs.bithuman.ai/pricing#how-billing-works); rendering on your own hardware or on the device bills a lower rate than the bitHuman cloud.

## Try a sample first

The `wise-pup` sample (Expression 2) runs in the web embed with no account or install:

```html
<iframe src="https://www.bithuman.ai/embed/A23WJF0199" allow="microphone *" style="width:100%;height:600px;border:0"></iframe>
```

Open the page, allow the microphone and talk: the avatar greets you and answers. A sample session ends after a minute. The sample avatars are `sofia-ramirez` (Essence 2) and `wise-pup` (Expression 2): [Sample avatars](https://docs.bithuman.ai/examples/avatars).

## Troubleshooting

| Symptom | Cause | Fix |
|---|---|---|
| `402 INSUFFICIENT_BALANCE` | not enough credits | [top up](https://www.bithuman.ai/billing#credits) (the error's `topup_url`) |
| `403 PLAN_REQUIRED` | a Free account, which cannot create agents, or a model outside your plan | [choose a plan](https://www.bithuman.ai/pricing?from=docs) (the error's `upgrade_url`) |
| `422 MODEL_SUBJECT_MISMATCH` | any model but `expression-2` for a subject that is not a real person, or no face found | use `expression-2` or `auto` |
| `422 IMAGE_FACE_UNSUITABLE` | `essence-2` with a face too small in frame, or several faces | upload a closer photo of one person |
| `failed` with an image error | the image URL is not publicly fetchable | host the image publicly and create again (the failed creation is refunded) |
