---
title: "HappyHorse 1.0"
description: "Tokenlio HappyHorse 1.0 API · 3–15s · 720p / 1080p"
outline: [2, 3]
pageClass: video-api-reference
---

# HappyHorse 1.0

**Generation 3–15 seconds · 720p / 1080p · MP4**

Generate from text, a first-frame image or multiple reference images. Create an asynchronous task, wait for success, then download MP4. This version also edits one source video using instructions and optional reference images, with a choice to retain the original audio.

> Create a Workspace **model-routing API Key** in the console and copy the exact public API model ID from your Workspace catalog. Documentation describes the contract; it does not grant access to your Workspace or Key.

## 1. Endpoints and authentication

**Base URL** · `https://api.tokenlio.ai`

| Method and path | Purpose | Response |
| --- | --- | --- |
| `POST /v1/videos/generations` | Create video task | `202 Accepted` |
| `GET /v1/tasks/{id}` | Query one task | `200 OK` |
| `GET /v1/tasks/{id}/content` | Authorized video download | `307 Temporary Redirect` |

| Header | Requirement |
| --- | --- |
| `Authorization: Bearer $TOKENLIO_API_KEY` | Required. Use a Workspace model-routing Key. Keep it server-side, never in public browser code. |
| `Content-Type: application/json` | Required. Send JSON, not multipart uploads or URL query parameters. |
| `Idempotency-Key` | Optional. 1–128 printable ASCII characters, without spaces. Keep one stable identifier per business request; use a new identifier for an independent task. |

## 2. Choose a generation mode

| Goal | Tokenlio inputs | Notes |
| --- | --- | --- |
| Text to video | `prompt` | A nonblank `prompt` is required. |
| First-frame animation | `image_with_roles` · `first_frame` | Use `first_frame`; a `prompt` can describe motion and camera work. |
| Image references | `image_urls` | 1–9 reference images and a required `prompt`. |
| Video editing | `operation: edit` + `video_urls` | 1.0 only. Explicit edit; omit `duration` and `size`. |

::: tip
Do not mix first-frame and reference images. Omit `size` for a first frame. Version 1.1 does not edit video. Choose `image_urls` or `image_with_roles`, not both.
:::

## 3. Quick start

Set `TOKENLIO_API_KEY` securely in your environment first. Example material domains and task IDs are placeholders, not usable inputs or tasks.

::: code-group

```bash [1 · Create]
BASE_URL='https://api.tokenlio.ai'
# TOKENLIO_API_KEY is supplied securely by your environment.
curl "$BASE_URL/v1/videos/generations" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"model":"happyhorse-1.0","prompt":"A quiet landscape at sunrise","duration":5,"resolution":"720p","size":"16:9"}'
```

```bash [2 · Query]
TASK_ID='YOUR_TASK_ID'
curl "$BASE_URL/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY"
```

```bash [3 · Download]
curl --location "$BASE_URL/v1/tasks/$TASK_ID/content" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" -o result.mp4
```

:::

Save the returned id. **HTTP 202 means accepted, not completed**. Poll every 5–15 seconds and download only when status is `succeeded`; the query/download tabs are not instructions to run immediately after submission.

## 4. Request parameters

### Basic fields

| Field | Type | Required / default | Rule |
| --- | --- | --- | --- |
| `model` | `string` | Required | This page's ID is used in examples; send the public ID from your current Workspace catalog. |
| `prompt` | `string` | Mode-dependent | Up to 2,500 Unicode characters. Required for text/reference-image generation and editing; optional with one first-frame image. |
| `operation` | `string` | `generate` | generate for generation; only 1.0 also supports edit. |
| `resolution` | `string` | `1080p` | 720p / 1080p; default 1080p. |
| `seed` | `integer` | Random if omitted | Integer 0–2147483647; omit for random generation. |
| `watermark` | `boolean` | `false` | Boolean, default false. |

### Generation controls

| Field | Type | Required / default | Rule |
| --- | --- | --- | --- |
| `duration` | `integer` | Required to generate; omit to edit | Explicit integer 3–15 for generation. Omit `duration` entirely for editing, including explicit 0. |
| `size` | `string` | Mode-dependent | 16:9 (default), 9:16, 1:1, 4:3, 3:4 for text/reference-image generation. Must be omitted with first-frame inputs or editing. |

### Reference inputs

| Field | Type | Required / default | Rule |
| --- | --- | --- | --- |
| `image_urls` | `string[]` | Optional | 1–9 for generation; editing optionally accepts up to 5. |
| `image_with_roles` | `object[]` | Optional | One `first_frame` for image animation; `reference_image` is also supported for references. Do not mix the families. |

### Editing fields (1.0 only)

| Field | Type | Required / default | Rule |
| --- | --- | --- | --- |
| `video_urls` | `string[]` | Required | Required for editing: exactly one source video URL. |
| `audio_setting` | `string` | `auto` | 1.0 editing only: auto (default) or origin to retain source audio. Rejected outside editing. |

### Role-tagged image fields

| Field | Type | Required / default | Rule |
| --- | --- | --- | --- |
| `image_with_roles[].url` | `string` | Required | A public HTTPS image URL. |
| `image_with_roles[].role` | `string` | Required | `first_frame` or `reference_image`; no last frame. |

::: warning
The entire request must fit **64 KiB** as well as each field's character limit. Unknown/duplicate fields, null and undocumented parameters are rejected; long prompts are not silently truncated. Omit unused optional fields. Editing's forbidden fields must be absent, not set to 0 or empty strings.
:::

## 5. Scenario requests

Each tab is a complete JSON body for the same creation endpoint. Replace the material URLs before use.

::: code-group

```json [First frame]
{
  "model": "happyhorse-1.0",
  "duration": 5,
  "resolution": "720p",
  "image_with_roles": [
    {
      "url": "https://cdn.example.com/first.png",
      "role": "first_frame"
    }
  ]
}
```

```json [Multiple reference images]
{
  "model": "happyhorse-1.0",
  "prompt": "A quiet landscape at sunrise",
  "duration": 8,
  "resolution": "1080p",
  "size": "16:9",
  "image_urls": [
    "https://cdn.example.com/ref-a.jpg",
    "https://cdn.example.com/ref-b.jpg"
  ]
}
```

```json [Video editing]
{
  "model": "happyhorse-1.0",
  "operation": "edit",
  "prompt": "Restyle the source video with warm cinematic lighting",
  "resolution": "720p",
  "video_urls": [
    "https://cdn.example.com/source.mp4"
  ],
  "image_urls": [
    "https://cdn.example.com/style.jpg"
  ],
  "audio_setting": "origin",
  "seed": 0,
  "watermark": false
}
```

:::

## 6. Input requirements and tips

Inputs must be **public HTTPS / port 443** URLs. Local paths, private hosts, embedded credentials, fragments, uploads and base64 are not accepted. Each URL is at most 8192 bytes; duplicate material URLs in one request are rejected.

Tokenlio validates URL syntax, counts and parameter combinations and forwards inputs. It does not download, probe, resize, crop, transcode or host input files. The following are material suitability requirements, not proof that Tokenlio inspected the bytes; unsuitable materials can still fail asynchronously.

| Material | Format / size | Dimensions / duration |
| --- | --- | --- |
| First frame | JPEG / JPG / PNG / BMP / WEBP; ≤10 MB | Short side ≥300 px; aspect ratio 1:2.5–2.5:1 |
| Reference images | Same formats; ≤10 MB each | Short side ≥720 px recommended; short/long side ≥0.4 |
| Editing source (1.0 only) | MP4 / MOV; ≤100 MB | 3–60 seconds; only the first 15 seconds are used if longer. Short side ≥360 px, minimum 480p, aspect ratio 1:8–8:1, >8 fps |

- Use a clear first frame with a recognizable subject/composition; its aspect ratio determines the output, so omit `size`. Describe how reference images define subjects, scenes or style.
- 1.0 editing follows the effective source length: omit `duration`. `audio_setting`: origin keeps the original audio; auto leaves the choice to the model.
- Keep URLs accessible and their content unchanged until completion; signed input links need enough lifetime. Freezing a URL does not freeze its bytes. A fixed `seed` helps comparisons but does not guarantee identical results.

## 7. Responses and task states

Developer endpoints return the task object directly, **without an extra data envelope**. These are structural examples, not real tasks; the file address is a placeholder.

::: code-group

```http [202 · Accepted]
HTTP/1.1 202 Accepted
Content-Type: application/json

{
  "id": "4b9e421d-79ab-4ed3-a64d-1e04b35755a1",
  "model": "happyhorse-1.0",
  "status": "queued",
  "assets": []
}
```

```http [200 · Succeeded]
HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": "4b9e421d-79ab-4ed3-a64d-1e04b35755a1",
  "model": "happyhorse-1.0",
  "status": "succeeded",
  "assets": [
    {
      "role": "video",
      "url": "https://files.example.com/video.mp4?signature=EXAMPLE_ONLY"
    }
  ]
}
```

```http [200 · Task failed]
HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": "4b9e421d-79ab-4ed3-a64d-1e04b35755a1",
  "model": "happyhorse-1.0",
  "status": "failed",
  "assets": [],
  "error": {
    "code": "TASK_TIMEOUT",
    "message": "Video task timed out."
  }
}
```

```http [400 · Rejected]
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "error": {
    "type": "VIDEO_REQUEST_INVALID",
    "message": "VIDEO_REQUEST_INVALID"
  }
}
```

:::

::: details Response field reference

| Field | Type | Rule |
| --- | --- | --- |
| `id` | string | Task identifier used for query and download. |
| `model` | string | The public model ID for this task. |
| `status` | string | `queued` / `processing` / `succeeded` / `failed`. |
| `assets` | object[] | Empty before results are ready; downloadable outputs after success. |
| `assets[].role` | string | video for these models. |
| `assets[].url` | string | Time-limited private download URL, not a permanent resource address. |
| `message` | string, optional | May explain pending confirmation; not permission to create again. |
| `error.code / error.message` | string, on failure | Task failure information, distinct from creation errors using `error.type`. |

:::

| status | Meaning | Action |
| --- | --- | --- |
| `queued` | Accepted / awaiting `processing` | Keep the id and query; do not resubmit. |
| `processing` | Generating or preparing results | Continue interval polling; do not download yet. |
| `succeeded` | Result available | Download through the content endpoint. |
| `failed` | Terminal failure | Inspect `error.code`; do not wait for success. |

The download endpoint defaults to video and returns **307 Temporary Redirect**. Use curl --location as shown. Request a fresh authorized download if a temporary URL expires; never attach your API Key directly to a file address. Developer task objects do not include accounting details; inspect actual charges in console call records.

## 8. Troubleshooting

| HTTP / stage | Error or scenario | Action |
| --- | --- | --- |
| 400 · Create | VIDEO_REQUEST_INVALID / VIDEO_ASSET_INVALID | Check fields, types, URLs and mutually exclusive modes; correct the request first. |
| 401 / 403 | Authentication or model access denied | Check the Workspace model-routing Key and model permissions. |
| 402 · Create | INSUFFICIENT_BALANCE | Fund the Workspace; check for an existing task before retrying. |
| 404 · Query / download | MEDIA_TASK_NOT_FOUND | Check task ID, Key and access scope. |
| 409 · Create | VIDEO_IDEMPOTENCY_CONFLICT | Keep original fields, URLs and values identical for the same identifier; do not add default fields. |
| 409 · Create | VIDEO_PRICE_CHANGED | Review current catalog terms before choosing to create again. |
| 409 · Download | MEDIA_CONTENT_NOT_READY | Wait for `succeeded` before downloading. |
| 429 / 503 | Limit reached / temporarily unavailable | Reduce frequency and inspect limits; check records first when submission is uncertain. |
| 200 · status: `failed` | `error.code`: TASK_TIMEOUT | Task timed out without a customer charge. Creating again is a new task, not polling. |

Common 1.0 editing mistakes are sending `duration`/`size` or omitting explicit `operation`: edit. Version 1.1 cannot reuse a 1.0 editing request.

## 9. Billing and version compatibility

- The console displays per-second reference rates, not a task total or spending cap.
- Inspect `charged_amount` in console call records after successful delivery and settlement. Failed/timed-out tasks are not charged; default video timeout is one hour, subject to platform configuration.
- 202 proves neither final delivery nor completed charging. Developer create/query results contain no billing detail; empty `assets` or an absent amount do not mean free.

HappyHorse 1.0 and 1.1 share the display reference baseline, not the same mode support: editing is 1.0 only.

::: details Idempotency and unknown submission results
`Idempotency-Key` is optional. The same Key, identifier and original parameters reuse the task; changed parameters conflict. Every POST without the header is independent. Query the returned id. If submission times out or is uncertain, check the console usage records before another create request; do not automatically resubmit.
:::

::: details Price-version compatibility
`expected_pricing_revision` is optional: send it only when you already hold a valid pricing version. Actual-cost models reject `max_charge_amount`. Catalog `video-reference-pricing/v3` describes display rates, not a creation parameter.
:::

**Related documentation** · [Shared video API](/api/videos) · [HappyHorse 1.1](/api/videos/happyhorse-1-1)
