> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-dev.ltx.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-dev.ltx.io/_mcp/server.

# Extend video duration

POST https://api.ltx.io/v2/extend
Content-Type: application/json

Extend a video by generating additional frames at the beginning or end. The model uses context frames from the input to produce a seamless continuation with consistent motion and audio.

Responds immediately with the job `id` and `created_at` timestamp. Poll `GET /v2/extend/{id}` until the status is `completed`, then download from `result.video_url`.

Billed per second, based on the extended portion plus the context frames used from the input video. See [Pricing](/pricing).

Reference: https://docs-dev.ltx.io/api-documentation/api-reference/async-video-generation/submit-extend

## Authentication

- `Authorization` header (bearer token, required) — API key authentication

## Request

### Body (application/json)

This endpoint expects an ExtendVideoRequest.

- `video_uri` (string, required) — Input video for extending. See [Input Formats](/input-formats#video-input) for supported formats and codecs. - Supported aspect ratios: 16:9 and 9:16 - Maximum resolution: 3840x2160 (4K) - Minimum frame count: 73 (around 3 seconds at 24fps) The output video preserves the input video's resolution.
- `duration` (double, required) — Duration in seconds to extend the video. Minimum 2 seconds, maximum 20 seconds (480 frames at 24fps).
- `prompt` (string, optional) — Description of what should happen in the extended portion of the video.
- `mode` (enum, optional, default: end) — Where to extend the video: - `end` (default): Extends the video at the end. - `start`: Extends the video at the beginning.
  - Allowed values: `start`, `end`
- `model` (enum, optional, default: ltx-2-3-pro) — Model to use for video generation.
  - Allowed values: `ltx-2-3-pro`
- `context` (double, optional) — **Advanced parameter:** Number of seconds from the input video to use as context for the extension (maximum 20 seconds). The model uses context frames from the input video to generate a more coherent extension. The sum of `context` + `duration` (converted to frames using the input video's FPS) cannot exceed 505 frames (~21 seconds at 24fps). For higher-FPS inputs, the maximum total duration in seconds will be proportionally lower; for lower-FPS inputs, it will be proportionally higher. If not provided, defaults to maximize available context within the 505 frame limit while respecting the 20-second cap.

## Response

### 202

Job submitted successfully

- `id` (string, required) — Unique job identifier. Use this to poll for status.
- `created_at` (datetime, required) — ISO 8601 timestamp of when the job was created.

## Errors

### 400 Bad Request Error

The request is invalid or malformed

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

### 401 Unauthorized Error

Authentication failed

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

### 402 Payment Required Error

Insufficient credits

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

### 422 Unprocessable Entity Error

Content rejected by safety filters

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

### 429 Too Many Requests Error

Concurrency or queue limit exceeded

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

### 500 Internal Server Error

An unexpected error occurred

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

### 503 Service Unavailable Error

Service temporarily unavailable

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

## Types

### ErrorError

- `type` (string, required) — Error type for programmatic handling
- `message` (string, required) — Human-readable error description

## Examples

**Request**

```json
{
  "video_uri": "YOUR_VIDEO_URI",
  "duration": 5,
  "prompt": "Continue the motion smoothly",
  "mode": "end"
}
```

**SDK Code**

```python
import requests

url = "https://api.ltx.io/v2/extend"

payload = {
    "video_uri": "YOUR_VIDEO_URI",
    "duration": 5,
    "prompt": "Continue the motion smoothly",
    "mode": "end"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.ltx.io/v2/extend"

	payload := strings.NewReader("{\n  \"video_uri\": \"YOUR_VIDEO_URI\",\n  \"duration\": 5,\n  \"prompt\": \"Continue the motion smoothly\",\n  \"mode\": \"end\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.ltx.io/v2/extend")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"video_uri\": \"YOUR_VIDEO_URI\",\n  \"duration\": 5,\n  \"prompt\": \"Continue the motion smoothly\",\n  \"mode\": \"end\"\n}")
  .asString();
```