Production

How To Integrate A Video Generation API Into Your Application

A developer guide to integrating AI video generation APIs, covering endpoints, async workflows, and production deployment.

LTX Team
Start Now
How To Integrate A Video Generation API Into Your Application
Table of Contents:
Key Takeaways:
  • The LTX-2 API exposes five core generation endpoints — text-to-video, image-to-video, audio-to-video, extend, and retake — plus an HDR upscaling endpoint, all using async job patterns where you submit a request and poll for completion.
  • Hosted API is the right choice for applications serving users without local GPU resources; local inference is better when you need full parameter control, custom LoRA training, or pipeline variants not exposed by the API.
  • Production integrations require polling at 5-second intervals, exponential backoff for retries, and a queue system for managing concurrent jobs within rate limits — with per-second output pricing varying by model variant and resolution.

AI video generation has moved from research demos to production-ready APIs that developers can integrate into applications, content platforms, and creative tools. Whether you are building an automated content pipeline, a user-facing video creation feature, or a batch processing system, integrating a video generation API requires understanding the endpoint surface, async job patterns, and production deployment considerations that differ from standard REST integrations.

This guide walks through the complete integration process using the LTX-2 API as a reference implementation — covering authentication, available endpoints, request handling, async workflows, and scaling for production use.

API vs Local Inference: When to Use Each

Before integrating an API, consider whether a hosted API or local inference better fits your use case. The LTX-2 ecosystem supports both approaches.

Use a hosted API when: you need to generate video without managing GPU infrastructure, your application serves users who do not have local GPU resources, you want to iterate quickly without setting up a local environment, or you need scalable throughput without provisioning hardware.

Use local inference when: you require full control over model parameters and pipeline configuration, you are training custom LoRA adapters and need tight iteration loops, your workload justifies dedicated GPU investment, or you need parameters and pipeline variants not exposed by the API (such as cfg_scale, stg_scale, or rescale_scale).

The LTX-2 hosted API uses different model variant names than the open-source repository: ltx-2-fast and ltx-2-pro (original variants), and ltx-2-3-fast and ltx-2-3-pro (newer variants with portrait support and cinematic frame rates). The fast variants map conceptually to the distilled model in the open-source codebase; the pro variants map to the dev model. Parameter schemas differ between surfaces.

Getting Started with the LTX Video API

Authentication

All LTX-2 API endpoints require Bearer token authentication. Obtain an API key from the developer console, then include it in the Authorization header of every request:

Authorization: Bearer YOUR_API_KEY

The developer console at console.ltx.video handles organization management, API key generation, billing, and usage tracking.

Available Endpoints

The LTX-2 API exposes the following generation endpoints, each designed for a specific workflow:

POST /v1/text-to-video — Generate video from a text prompt.

POST /v1/image-to-video — Generate video conditioned on an input image.

POST /v1/audio-to-video — Generate video driven by an input audio file.

POST /v1/extend — Extend an existing video with a continuation prompt.

POST /v1/retake — Regenerate a specific portion of an existing video.

A v2 endpoint (POST /v2/video-to-video-hdr) is also available for HDR upscaling. For current pricing, see our pricing. Interactive API documentation with request/response schemas is available at docs.ltx.video.

Text-to-Video Generation

Building Your First API Call

A basic text-to-video request includes the text prompt, desired resolution, duration, and model selection. Fast models support up to 20 seconds at 1080p and up to 10 seconds at higher resolutions. Pro models support up to 10 seconds across all resolutions. The API supports output resolutions of 1080p, 1440p, and 4K.

Prompt Best Practices

For consistent API results, write prompts as detailed, chronological descriptions of actions and scenes. Include specific movements, appearances, camera angles, and environmental details — all in a single flowing paragraph. The API accepts prompts up to 5000 characters; for best results, aim for 4–8 descriptive sentences covering composition, action, character details, camera movement, and audio.

Async Workflows and Job Management

Video generation is computationally intensive — a single request may take seconds to minutes depending on resolution, duration, and model variant. The LTX-2 API handles this through an asynchronous job pattern.

The Request Flow

When you submit a generation request, the API follows this flow:

1. Authentication and validation — Your API key is verified and the request is validated.

2. Billing pre-check — The pricing rate is determined based on model variant and resolution, and for prepaid accounts, balance is reserved before generation starts.

3. Job enqueue — The generation job is added to the processing queue.

4. Model inference — A GPU worker picks up the job and runs the model.

5. Completion — On success, billing is finalized and the generated video is available for download. On failure, reserved balance is released.

Polling for Job Status

The LTX-2 API uses a polling pattern for monitoring job completion. After submitting a job via POST /v1/{endpoint}, poll for status with GET /v2/{endpoint}/{id} at recommended 5-second intervals. Status values are: pending, processing, completed, and failed. Jobs are retained for 24 hours after reaching a terminal state.

For production systems, implement a polling service that manages multiple concurrent jobs rather than blocking on individual requests.

Error Handling and Retries

Build your integration to handle authentication failures, insufficient balance, rate limiting, and transient infrastructure errors. Implement exponential backoff for retries on transient failures.

Production Deployment Considerations

Billing and Cost Management

The LTX-2 API uses per-second pricing on output video generated, with rates varying by model variant and resolution. See our pricing for the current rate schedule.

Rate Limiting and Quotas

Plan your integration around rate limits and concurrent job quotas. For batch processing, implement a queue that submits jobs within allowed concurrency.

Monitoring and Logging

Track API usage by logging every request with its job ID, parameters, latency, and outcome. The developer console at console.ltx.video provides a usage tracking dashboard.

Conclusion

Integrating a video generation API into your application follows a predictable pattern: authenticate, submit generation requests, poll for async completion, and build for production reliability. The LTX-2 API provides a clear endpoint surface for text-to-video, image-to-video, audio-to-video, extend, and retake workflows.

Get started today: Create an account at the LTX developer console, explore the API documentation, and try the interactive playground. For questions and community support, join the LTX Discord.

No items found.