# HeyGen Translate

> HeyGen Translate: translate a finished video into another language with lipsync and a cloned voice, up to 8 minutes.

HeyGen Translate takes a finished video of a person speaking and translates the speech into the language you pick: the voice stays similar, and the lips follow the new speech.

This is a translation of a finished clip, not a clip made from scratch: the framing and scene stay yours. The length usually matches the source; if speech in the other language is longer or shorter, the duration adjusts a little.

You need one video from 2 seconds to 8 minutes (MP4/MOV). Speed is faster and cheaper; Precision matches the lips more tightly. Optionally you can translate only the audio and leave the face unchanged.

You pay per second of your video; the rate depends on the mode. If generation fails, the money is returned.

One model, `heygen-translate` · ~5 min. Send your video `video_url` and photos `image_urls`.




## Price

| Resolution | Price per second of your video |
|---|---|
| 1080p | $0.065 |

- Price = per-second price × clip length, rounded up to $0.001. Charged when the task is created and fully refunded if it fails.
- You pay per second of your video (2 to 480 s). A clip longer than 480 s is trimmed to 480; the result has the same length. `prompt` may be omitted.

## Media limits

| Type | Limits |
|---|---|
| Video | one clip, `video_url`; **2 s** to **480 s** (longer is trimmed to 480); MP4 / MOV → MP4 on the server; upload ≤ **200 MB** |

Photos — public https or upload; video and audio — files/upload only.


## Parameters (field `input`)

| Parameter | Description | Values (default in bold) |
|---|---|---|
| `video_url` | Motion video (MP4): one clip, at least 4 s. Longer than 30 s is trimmed to 30. Upload it via files/upload first | `"https://…"` |
| `output_language` | Target language | `English` `Spanish` `French` `Hindi` `Italian` `German` `Polish` `Portuguese` `Chinese` `Japanese` `Dutch` `Turkish` `Korean` `Danish` `Arabic` `Romanian` `Mandarin` `Filipino` `Swedish` `Indonesian` `Ukrainian` `Greek` `Czech` `Bulgarian` `Malay` `Slovak` `Croatian` `Tamil` `Finnish` **`Russian`** `Afrikaans (South Africa)` `Albanian (Albania)` `Amharic (Ethiopia)` `Arabic (Algeria)` `Arabic (Bahrain)` `Arabic (Egypt)` `Arabic (Iraq)` `Arabic (Jordan)` `Arabic (Kuwait)` `Arabic (Lebanon)` `Arabic (Libya)` `Arabic (Morocco)` `Arabic (Oman)` `Arabic (Qatar)` `Arabic (Saudi Arabia)` `Arabic (Syria)` `Arabic (Tunisia)` `Arabic (United Arab Emirates)` `Arabic (Yemen)` `Armenian (Armenia)` `Azerbaijani (Latin, Azerbaijan)` `Bangla (Bangladesh)` `Basque` `Bengali (India)` `Bosnian (Bosnia and Herzegovina)` `Bulgarian (Bulgaria)` `Burmese (Myanmar)` `Catalan` `Chinese (Cantonese, Traditional)` `Chinese (Jilu Mandarin, Simplified)` `Chinese (Mandarin, Simplified)` `Chinese (Northeastern Mandarin, Simplified)` `Chinese (Southwestern Mandarin, Simplified)` `Chinese (Taiwanese Mandarin, Traditional)` `Chinese (Wu, Simplified)` `Chinese (Zhongyuan Mandarin Henan, Simplified)` `Chinese (Zhongyuan Mandarin Shaanxi, Simplified)` `Croatian (Croatia)` `Czech (Czechia)` `Danish (Denmark)` `Dutch (Belgium)` `Dutch (Netherlands)` `English (Australia)` `English (Canada)` `English (Hong Kong SAR)` `English (India)` `English (Ireland)` `English (Kenya)` `English (New Zealand)` `English (Nigeria)` `English (Philippines)` `English (Singapore)` `English (South Africa)` `English (Tanzania)` `English (UK)` `English (United States)` `Estonian (Estonia)` `Filipino (Philippines)` `Finnish (Finland)` `French (Belgium)` `French (Canada)` `French (France)` `French (Switzerland)` `Galician` `Georgian (Georgia)` `German (Austria)` `German (Germany)` `German (Switzerland)` `Greek (Greece)` `Gujarati (India)` `Hebrew (Israel)` `Hindi (India)` `Hungarian (Hungary)` `Icelandic (Iceland)` `Indonesian (Indonesia)` `Irish (Ireland)` `Italian (Italy)` `Japanese (Japan)` `Javanese (Latin, Indonesia)` `Kannada (India)` `Kazakh (Kazakhstan)` `Khmer (Cambodia)` `Korean (Korea)` `Lao (Laos)` `Latvian (Latvia)` `Lithuanian (Lithuania)` `Macedonian (North Macedonia)` `Malay (Malaysia)` `Malayalam (India)` `Maltese (Malta)` `Marathi (India)` `Mongolian (Mongolia)` `Nepali (Nepal)` `Norwegian Bokmål (Norway)` `Pashto (Afghanistan)` `Persian (Iran)` `Polish (Poland)` `Portuguese (Brazil)` `Portuguese (Portugal)` `Romanian (Romania)` `Russian (Russia)` `Serbian (Latin, Serbia)` `Sinhala (Sri Lanka)` `Slovak (Slovakia)` `Slovenian (Slovenia)` `Somali (Somalia)` `Spanish (Argentina)` `Spanish (Bolivia)` `Spanish (Chile)` `Spanish (Colombia)` `Spanish (Costa Rica)` `Spanish (Cuba)` `Spanish (Dominican Republic)` `Spanish (Ecuador)` `Spanish (El Salvador)` `Spanish (Equatorial Guinea)` `Spanish (Guatemala)` `Spanish (Honduras)` `Spanish (Mexico)` `Spanish (Nicaragua)` `Spanish (Panama)` `Spanish (Paraguay)` `Spanish (Peru)` `Spanish (Puerto Rico)` `Spanish (Spain)` `Spanish (United States)` `Spanish (Uruguay)` `Spanish (Venezuela)` `Sundanese (Indonesia)` `Swahili (Kenya)` `Swahili (Tanzania)` `Swedish (Sweden)` `Tamil (India)` `Tamil (Malaysia)` `Tamil (Singapore)` `Tamil (Sri Lanka)` `Telugu (India)` `Thai (Thailand)` `Turkish (Türkiye)` `Ukrainian (Ukraine)` `Urdu (India)` `Urdu (Pakistan)` `Uzbek (Latin, Uzbekistan)` `Vietnamese (Vietnam)` `Welsh (United Kingdom)` `Zulu (South Africa)` `English - Your Accent` `English - American Accent` |
| `quality` | Режим | **`speed`** `precision` |
| `translate_audio_only` | Translate audio only, leave the face | `true` `false` (default `false`) |
| `speaker_num` | How many people speak | 1…20 |
| `enable_dynamic_duration` | Fit the length to the speech rate | `true` `false` (default `true`) |

## Examples

### Video + photo

```bash
curl -X POST https://mixmedia.tech/api/v1/jobs/createTask \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"heygen-translate","input":{"mode":"motion-transfer","prompt":"Keep the face from the photo, take the motion from the video","video_url":"https://mixmedia.tech/files/<id>.mp4","image_urls":["https://mixmedia.tech/static/img/previews/gpt-t2i.jpg"],"resolution":"720p"}}'
```

```python
import os, requests

r = requests.post(
    "https://mixmedia.tech/api/v1/jobs/createTask",
    headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
    json={
      "model": "heygen-translate",
      "input": {
        "mode": "motion-transfer",
        "prompt": "Keep the face from the photo, take the motion from the video",
        "video_url": "https://mixmedia.tech/files/<id>.mp4",
        "image_urls": [
          "https://mixmedia.tech/static/img/previews/gpt-t2i.jpg"
        ],
        "resolution": "720p"
      }
    },
)
print(r.json())  # {"code": 200, "data": {"taskId": "..."}}
```

```javascript
const r = await fetch("https://mixmedia.tech/api/v1/jobs/createTask", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "model": "heygen-translate",
    "input": {
      "mode": "motion-transfer",
      "prompt": "Keep the face from the photo, take the motion from the video",
      "video_url": "https://mixmedia.tech/files/<id>.mp4",
      "image_urls": [
        "https://mixmedia.tech/static/img/previews/gpt-t2i.jpg"
      ],
      "resolution": "720p"
    }
  }),
});
console.log(await r.json()); // { code: 200, data: { taskId: "..." } }
```

## Create and result

1. `POST /api/v1/jobs/createTask` with `model` and `input`.
2. Poll `GET /api/v1/jobs/recordInfo?taskId=…` every 3–5 s (or a [callback](https://docs.mixmedia.tech/en/callbacks)).

### Successful createTask (HTTP 200)

```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_...",
    "task_id": "task_...",
    "status": "submitted"
  }
}
```

### Completed task (recordInfo)

```json
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_...",
    "task_id": "task_...",
    "state": "success",
    "status": "completed",
    "costUsd": "0.384",
    "refunded": false,
    "resultJson": {
      "videos": [
        {
          "url": "https://…/out.mp4"
        }
      ],
      "duration": 8
    }
  }
}
```

Aliases: `task_id` = `taskId`; `status`: `pending` / `processing` / `completed` / `failed` alongside `state`. Clip URL is in `resultJson`. `size` is an alias of `aspect_ratio` in `input`.


Photos can be any public https links or uploads via [files/upload](https://docs.mixmedia.tech/en/endpoints/upload). Videos and audio — via files/upload only.

## Error handling

API responses are JSON `{"code", "msg", "data"}`; errors also have a string `error` field (type). **On `/api/v1/*` the HTTP status matches body `code`.**

### Example response bodies

**400**

```json
{
  "code": 400,
  "msg": "input.duration: must be between 4 and 30, or \"auto\" / -1",
  "data": null,
  "error": "invalid_request_error"
}
```

**401**

```json
{
  "code": 401,
  "msg": "Authentication failed. Please check your API key",
  "data": null,
  "error": "authentication_error"
}
```

**402**

```json
{
  "code": 402,
  "msg": "Insufficient balance. Please top up and try again. Available: $0.01, required: $0.015. Top up at https://mixmedia.tech/cabinet/billing",
  "data": {
    "balance": "0.0100",
    "required": "0.0150",
    "currency": "USD",
    "topUpUrl": "https://mixmedia.tech/cabinet/billing"
  },
  "error": "payment_required"
}
```

**429**

```json
{
  "code": 429,
  "msg": "Rate limit exceeded: 10 createTask/upload requests per 10 s per key. Retry after 8s",
  "data": null,
  "error": "rate_limit_error"
}
```

**500**

```json
{
  "code": 500,
  "msg": "Internal server error",
  "data": null,
  "error": "server_error"
}
```

### Codes on createTask / upload

| code | error | Meaning | What to do |
|---|---|---|---|
| 400 | `invalid_request_error` | Invalid parameter or body | See `msg` |
| 400 | `unsupported_model` | Unknown model | [Model list](https://docs.mixmedia.tech/en/models) |
| 400 | `nsfw_content_detected` | Moderation / content policy — `msg` / `failMsg` is the upstream text verbatim | Read the refusal text, change the prompt or files |
| 401 | `authentication_error` | Missing or invalid key | Check the key |
| 402 | `payment_required` | Not enough balance | Top up |
| 403 | `permission_error` | No access | Contact support |
| 429 | `rate_limit_error` | Too many requests | Wait for `Retry-After` |
| 505 | `model_disabled` | Model temporarily disabled | Pick another |
| 500 | `server_error` | Our failure | Retry later |

Example `msg` values: `Authentication failed. Please check your API key` (401); `Insufficient balance. Please top up and try again…` (402).

### Task errors (recordInfo)

If the task was created and then failed: `state: "fail"` (alias `status: "failed"`), `failCode` / `failMsg`, and `error: { code, message, type }`. Money is refunded (`refunded: true`).

| failCode | error.type | Meaning |
|---|---|---|
| 400 | `nsfw_content_detected` / `invalid_request_error` | Moderation — `failMsg` is upstream text verbatim |
| 422 | `invalid_request_error` | The model rejected the parameters (length, mode, resolution, file) |
| 501 | `server_error` | The model could not generate (`failMsg`) |
| 504 | `timeout_error` | Timed out — retry |
| 500 / 503 | `server_error` | Service temporarily unavailable |

### Rate limits

| What | Limit |
|---|---|
| createTask and upload | 20 per 10 s per key |
| recordInfo / list / balance | 100 per 10 s per key |

Over the limit — HTTP 429 and `Retry-After`.
