Skip to content

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 pathPurposeResponse
POST /v1/videos/generationsCreate video task202 Accepted
GET /v1/tasks/{id}Query one task200 OK
GET /v1/tasks/{id}/contentAuthorized video download307 Temporary Redirect
HeaderRequirement
Authorization: Bearer $TOKENLIO_API_KEYRequired. Use a Workspace model-routing Key. Keep it server-side, never in public browser code.
Content-Type: application/jsonRequired. Send JSON, not multipart uploads or URL query parameters.
Idempotency-KeyOptional. 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 ​

GoalTokenlio inputsNotes
Text to videopromptA nonblank prompt is required.
First-frame animationimage_with_roles · first_frameUse first_frame; a prompt can describe motion and camera work.
Image referencesimage_urls1–9 reference images and a required prompt.
Video editingoperation: edit + video_urls1.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.

bash
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
TASK_ID='YOUR_TASK_ID'
curl "$BASE_URL/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY"
bash
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 ​

FieldTypeRequired / defaultRule
modelstringRequiredThis page's ID is used in examples; send the public ID from your current Workspace catalog.
promptstringMode-dependentUp to 2,500 Unicode characters. Required for text/reference-image generation and editing; optional with one first-frame image.
operationstringgenerategenerate for generation; only 1.0 also supports edit.
resolutionstring1080p720p / 1080p; default 1080p.
seedintegerRandom if omittedInteger 0–2147483647; omit for random generation.
watermarkbooleanfalseBoolean, default false.

Generation controls ​

FieldTypeRequired / defaultRule
durationintegerRequired to generate; omit to editExplicit integer 3–15 for generation. Omit duration entirely for editing, including explicit 0.
sizestringMode-dependent16: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 ​

FieldTypeRequired / defaultRule
image_urlsstring[]Optional1–9 for generation; editing optionally accepts up to 5.
image_with_rolesobject[]OptionalOne first_frame for image animation; reference_image is also supported for references. Do not mix the families.

Editing fields (1.0 only) ​

FieldTypeRequired / defaultRule
video_urlsstring[]RequiredRequired for editing: exactly one source video URL.
audio_settingstringauto1.0 editing only: auto (default) or origin to retain source audio. Rejected outside editing.

Role-tagged image fields ​

FieldTypeRequired / defaultRule
image_with_roles[].urlstringRequiredA public HTTPS image URL.
image_with_roles[].rolestringRequiredfirst_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.

json
{
  "model": "happyhorse-1.0",
  "duration": 5,
  "resolution": "720p",
  "image_with_roles": [
    {
      "url": "https://cdn.example.com/first.png",
      "role": "first_frame"
    }
  ]
}
json
{
  "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
{
  "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.

MaterialFormat / sizeDimensions / duration
First frameJPEG / JPG / PNG / BMP / WEBP; ≤10 MBShort side ≥300 px; aspect ratio 1:2.5–2.5:1
Reference imagesSame formats; ≤10 MB eachShort side ≥720 px recommended; short/long side ≥0.4
Editing source (1.0 only)MP4 / MOV; ≤100 MB3–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.

http
HTTP/1.1 202 Accepted
Content-Type: application/json

{
  "id": "4b9e421d-79ab-4ed3-a64d-1e04b35755a1",
  "model": "happyhorse-1.0",
  "status": "queued",
  "assets": []
}
http
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
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
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "error": {
    "type": "VIDEO_REQUEST_INVALID",
    "message": "VIDEO_REQUEST_INVALID"
  }
}
Response field reference
FieldTypeRule
idstringTask identifier used for query and download.
modelstringThe public model ID for this task.
statusstringqueued / processing / succeeded / failed.
assetsobject[]Empty before results are ready; downloadable outputs after success.
assets[].rolestringvideo for these models.
assets[].urlstringTime-limited private download URL, not a permanent resource address.
messagestring, optionalMay explain pending confirmation; not permission to create again.
error.code / error.messagestring, on failureTask failure information, distinct from creation errors using error.type.
statusMeaningAction
queuedAccepted / awaiting processingKeep the id and query; do not resubmit.
processingGenerating or preparing resultsContinue interval polling; do not download yet.
succeededResult availableDownload through the content endpoint.
failedTerminal failureInspect 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 / stageError or scenarioAction
400 · CreateVIDEO_REQUEST_INVALID / VIDEO_ASSET_INVALIDCheck fields, types, URLs and mutually exclusive modes; correct the request first.
401 / 403Authentication or model access deniedCheck the Workspace model-routing Key and model permissions.
402 · CreateINSUFFICIENT_BALANCEFund the Workspace; check for an existing task before retrying.
404 · Query / downloadMEDIA_TASK_NOT_FOUNDCheck task ID, Key and access scope.
409 · CreateVIDEO_IDEMPOTENCY_CONFLICTKeep original fields, URLs and values identical for the same identifier; do not add default fields.
409 · CreateVIDEO_PRICE_CHANGEDReview current catalog terms before choosing to create again.
409 · DownloadMEDIA_CONTENT_NOT_READYWait for succeeded before downloading.
429 / 503Limit reached / temporarily unavailableReduce frequency and inspect limits; check records first when submission is uncertain.
200 · status: failederror.code: TASK_TIMEOUTTask 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.

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.

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 · HappyHorse 1.1

Access leading AI models through one unified API