LTX 2.5 Video API: Image to Video With Audio, Step by Step

Tutorials
LTX 2.5 Video API: Image to Video With Audio, Step by Step

The LTX 2.5 API on an OpenLLM Buddy pod is three HTTP calls: POST /v1/videos with a prompt (and an image for image-to-video), GET /v1/videos/{id} to follow the job, and GET /v1/videos/{id}/content to download an MP4 with synchronised sound. This tutorial walks through each call with curl and Python.

What you will have at the end

  • A text-to-video request that returns a clip with sound.
  • An image-to-video request that starts the clip from your own picture.
  • A polling loop that handles every job status, including refusals.
  • A Python script that does all of it and saves the MP4.

Clips can be 2 to 30 seconds at 720p, or 2 to 10 seconds at 1080p, at 24 fps. How long a clip takes to generate is not yet measured on our pods; the job status reports the real timings for each video, so you will see them on your first request.

Prerequisites

  • A running LTX-2.5 Uncensored Video pod. If you do not have one, deploy it first. The model guide explains what the build is.
  • The pod's base URL and API key from your console. In the samples they are https://YOUR-POD-ENDPOINT and YOUR_API_KEY.
  • curl, or Python 3 with the requests package.
  • For image-to-video: one PNG, JPEG or WebP image, 10 MB or smaller, at least 256 pixels on its shorter side. It must not be a photo of a real person (see the rules below).

Every /v1 route needs the header Authorization: Bearer YOUR_API_KEY. Without it, or with a wrong key, the pod answers 401 with {"error": "Unauthorized"}.

Step 1: Check the pod and your key

The health route needs no key and tells you the pod is up:

curl https://YOUR-POD-ENDPOINT/health
{"status": "ok"}

Then check the key with the models route, which returns a short list holding the pod's model id:

curl https://YOUR-POD-ENDPOINT/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"

A 401 here means the key is wrong. Fix that before going on.

Step 2: Send a text-to-video request

The request body is a JSON object. Only prompt is required.

FieldRequiredAccepted valuesDefault
promptYesText, up to 4,000 charactersnone
secondsNoWhole number from 2 to 30 (2 to 10 at 1080p)5
resolutionNo"720p" or "1080p""720p"
aspectNo"16:9" or "9:16""16:9"
seedNoWhole number from 0 to 4294967295random
imageNoPNG, JPEG or WebP as a base64 data URLnone (text-to-video)

Those six fields are the whole request. Any other field is rejected with a 400, so do not send sampler settings, a frame rate or a model name.

curl https://YOUR-POD-ENDPOINT/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A steam train crosses a stone viaduct at dawn, wide shot, mist in the valley. Sound: the engine chuffing, wheels on rails, one long whistle that echoes.",
    "seconds": 8,
    "resolution": "720p",
    "aspect": "16:9",
    "seed": 1234
  }'

The pod checks the request and the prompt first. If both pass, it answers 202 with the job:

{
  "id": "3f6c0e5a9b0d4c1e8a7f2b6d9c4e1a70",
  "status": "queued",
  "mode": "t2v",
  "seconds": 8,
  "resolution": "720p",
  "aspect": "16:9",
  "seed": 1234,
  "progress": {"segments_done": 0, "segments_total": 1},
  "error": null,
  "code": null,
  "timings_ms": {}
}

Keep the id. If you did not send a seed, the response shows the random one that was picked, so you can reuse it later.

The output size follows resolution and aspect:

16:99:16
720p1280×720720×1280
1080p1920×10801080×1920

Step 3: Send an image-to-video request

Image-to-video is the same endpoint with one more field. image holds your picture as a data URL: the text data:image/png;base64, (or image/jpeg, image/webp) followed by the file in base64. A web address is not accepted; the image travels inside the request.

With curl, build the body in a file first, because the base64 text is long:

printf '{"prompt": "%s", "seconds": 6, "image": "data:image/png;base64,%s"}' \
  "She turns toward the window and the curtains lift in the breeze. Sound: soft wind, fabric rustling, birds outside." \
  "$(base64 -w 0 start.png)" > request.json

curl https://YOUR-POD-ENDPOINT/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d @request.json

On macOS, use base64 -i start.png in place of base64 -w 0 start.png.

In Python:

import base64
import requests

with open("start.png", "rb") as f:
    data_url = "data:image/png;base64," + base64.b64encode(f.read()).decode()

response = requests.post(
    "https://YOUR-POD-ENDPOINT/v1/videos",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "prompt": "She turns toward the window and the curtains lift in the breeze. "
                  "Sound: soft wind, fabric rustling, birds outside.",
        "seconds": 6,
        "image": data_url,
    },
)
print(response.status_code, response.json())

A 202 response for this request shows "mode": "i2v". The image is checked before anything is queued, so a problem with it comes back at once as a 400 (the file is unusable) or a 422 (the image breaks a rule).

The clip starts from your image, so use the prompt for what the image cannot say: what moves, how the camera behaves, and what is heard.

Step 4: Poll the job

Ask for the job by id until its status stops changing:

curl https://YOUR-POD-ENDPOINT/v1/videos/3f6c0e5a9b0d4c1e8a7f2b6d9c4e1a70 \
  -H "Authorization: Bearer YOUR_API_KEY"

The response has the same shape as the one from Step 2. Read status:

StatusMeaningWhat to do
queuedWaiting for the GPU. A pod renders one video at a timeKeep polling
runningBeing generatedKeep polling; progress shows how far it is
doneThe MP4 is readyDownload it (Step 5)
refusedThe finished video was blocked by a rule, or the check could not run. code and error say why. The file is deletedChange the prompt or image and submit again
failedGeneration went wrong. code is engine_error and error has the detailSubmit again

A long clip is generated as several segments that are joined into one file. progress.segments_total tells you how many, and progress.segments_done counts up while the job runs. A short clip is one segment.

When a job finishes, timings_ms is filled in with the time spent in each stage, in milliseconds:

KeyStage
queueWaiting behind other jobs
renderGenerating the picture and sound
joinAssembling the final MP4
checksChecking the finished video
totalFrom submit to finished

This is the simplest way to measure speed on your own pod for your own clip lengths.

Step 5: Download the MP4

curl https://YOUR-POD-ENDPOINT/v1/videos/3f6c0e5a9b0d4c1e8a7f2b6d9c4e1a70/content \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o clip.mp4

The response is video/mp4: H.264 video and AAC audio in one file, at 24 fps. It carries the header X-AI-Generated: true, and the file's own metadata says it is AI generated.

If you ask for the content before the job is done, the pod answers 409 with the current state, for example {"error": "The video is running."}.

Download the file soon after it is ready. A finished job and its video are kept for a limited time, one hour by default. After that both routes answer 404.

The whole flow in one Python script

import base64
import sys
import time

import requests

BASE = "https://YOUR-POD-ENDPOINT/v1"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}


def data_url(path):
    kind = {"png": "png", "jpg": "jpeg", "jpeg": "jpeg", "webp": "webp"}[path.rsplit(".", 1)[-1].lower()]
    with open(path, "rb") as f:
        return f"data:image/{kind};base64," + base64.b64encode(f.read()).decode()


def make_video(prompt, out_path, image_path=None, seconds=5, resolution="720p", aspect="16:9"):
    body = {"prompt": prompt, "seconds": seconds, "resolution": resolution, "aspect": aspect}
    if image_path:
        body["image"] = data_url(image_path)

    created = requests.post(f"{BASE}/videos", headers=HEADERS, json=body)
    if created.status_code != 202:
        # 400 bad request, 401 wrong key, 422 refused by a rule, 429 pod busy
        sys.exit(f"{created.status_code}: {created.json()}")
    job = created.json()

    while job["status"] in ("queued", "running"):
        time.sleep(5)
        job = requests.get(f"{BASE}/videos/{job['id']}", headers=HEADERS).json()
        done, total = job["progress"]["segments_done"], job["progress"]["segments_total"]
        print(f"{job['status']}: segment {done} of {total}")

    if job["status"] != "done":
        sys.exit(f"{job['status']} ({job['code']}): {job['error']}")

    video = requests.get(f"{BASE}/videos/{job['id']}/content", headers=HEADERS)
    with open(out_path, "wb") as f:
        f.write(video.content)
    print(f"saved {out_path}, seed {job['seed']}, timings {job['timings_ms']}")


make_video(
    "The paper lantern rises slowly into the night sky. Sound: a low crowd murmur, a gentle breeze.",
    "lantern.mp4",
    image_path="lantern.png",
    seconds=6,
)

Leave out image_path and the same function does text-to-video.

Prompt tips for sound

The API has no audio field. There is nothing to upload and nothing to switch on: the soundtrack is generated with the picture, from the prompt. So the prompt is the only control you have over what is heard.

  • Write a sound line. End the prompt with a sentence that starts "Sound:" and lists what is heard. It keeps the audio from being an afterthought.
  • Layer it. Name a background (rain, a busy street, a quiet room), then one or two sounds in the foreground (footsteps, a kettle, a door closing).
  • Tie sounds to things on screen. A sound with a visible cause, such as a glass set down on a table, gives the model an event to line up in both picture and audio.
  • Put sounds in order. If the whistle comes after the train enters the shot, write it in that order.
  • For a voice, write the line and the delivery. Put the words in quotes and say how they are spoken: whispered, shouted, flat. Judge the result on your own prompts; speech quality is not yet measured on our pods.
  • Say what to leave out. "No music" and "no dialogue" are valid instructions.
  • Do not name a real singer, actor or voice. A prompt that asks to sound like a real person is refused.
  • Change one thing at a time. Resend the same seed with an edited sound line to hear what the edit did.

You have 4,000 characters, which is more than most clips need. One clear action with its sounds usually beats a crowded scene.

Rules that cannot be switched off

The pod enforces these on every request, and no field or setting turns them off:

  • Adults only (18+).
  • No minors. Any prompt involving a minor is refused, including any word for a child, a school setting or an age under 18. The refusal message names the word it found. This also stops harmless prompts that mention children; that is deliberate.
  • No real people. A prompt that names or imitates a real person is refused. An uploaded image that looks like a photo of a real person is refused; drawings, renders and other non-photographic images can be animated.
  • Every video is tagged as AI generated, in the response header and in the file.

The checks run before a job is queued, so a refused prompt or image costs you no generation time. The finished video is checked once more before it is released.

Limits and errors

Limits

LimitValue
Clip length at 720p2 to 30 seconds
Clip length at 1080p2 to 10 seconds
Frame rate24 fps
Prompt length4,000 characters
Image formatsPNG, JPEG, WebP, sent as a base64 data URL
Image size10 MB or smaller; shorter side at least 256 pixels
Videos rendered at onceOne; others wait in the queue
QueueA small number of jobs (four queued or running by default), then 429
How long a finished video is keptOne hour by default

HTTP errors

StatusBodyCauseFix
400{"error": "..."}The request is malformed. The message says what, for example seconds must be between 2 and 30., 1080p clips can be at most 10 seconds., Unknown field: steps., image must be 10 MB or smaller.Correct the field named in the message
401{"error": "Unauthorized"}Missing or wrong API keySend Authorization: Bearer YOUR_API_KEY
404{"error": "No such video."}Unknown id, or the video has expiredCheck the id; generate again if it expired
409{"error": "The video is running."}Content requested before the job is donePoll until done
422{"error": "...", "code": "..."}Refused by a rule. Nothing was queuedSee the refusal codes below
429{"error": "The pod is busy. Try again when the current videos finish."}The queue is fullWait for a job to finish, then resend

Things that cause a 400 and are easy to miss: seconds must be a whole number (5, not 5.0 or "5"), aspect only takes 16:9 or 9:16, and image must be a data URL, not a link.

Refusal codes

codeWhere you see itMeaning
minor_term422 on submitThe prompt contains a word for a child or an age under 18
minor_prompt422 on submitThe prompt may describe a person under 18
real_person_prompt422 on submitThe prompt may name or imitate a real person
real_person_image422 on submitThe image looks like a photo of a real person
minor_image422 on submitThe image may show a person under 18
minor_outputJob status refusedThe finished video may show a person under 18. It is deleted
check_unavailable422 on submit, or job status refusedThe safety check could not run, so nothing is released. Try again in a minute

The code values are stable, so build your handling on them and show the error text to the user.

For the GPUs behind the pod and why clip length and resolution are capped, see LTX 2.5 VRAM and GPU requirements. If you are still choosing a video model, LTX 2.5 vs Wan 2.2 compares the two in the catalog.

FAQ

Does the LTX 2.5 API return video with audio?

Yes. Every finished job is one MP4 with H.264 video and AAC audio. The sound is generated together with the picture from your prompt, and there is no separate audio call.

How do I send an image to the LTX 2.5 image to video API?

Add an image field to the same POST /v1/videos request, holding the picture as a base64 data URL in PNG, JPEG or WebP. It must be 10 MB or smaller with a shorter side of at least 256 pixels.

Can I animate a photo of a person with the LTX 2.5 API?

No. An image that looks like a photo of a real person is refused with the code real_person_image. Drawings, renders and other non-photographic images can be animated.

How long does an LTX 2.5 video take to generate?

It is not yet measured on our pods. Each finished job reports its own timings in milliseconds, so you can read the real figure for your clip length from the job status.

Is the LTX 2.5 API the same as the chat completions API?

No. It uses the same kind of base URL and Bearer key as the other pods, but video has its own routes: submit a job, poll it, download the file. Chat clients do not apply to it.

Can I send several video requests at once?

Yes, up to the queue limit. The pod renders one video at a time and holds the others in a queue, and when the queue is full it answers 429 until a job finishes.

More to read

Other recent articles from our blog.