> ## Documentation Index
> Fetch the complete documentation index at: https://testweb2-docs-openapi.test765.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Five API is a video generation REST API. Base URL: https://api.fiveapi.ai. Authenticate with the header Authorization: Bearer <API key>; read the key from the FIVEAPI_API_KEY environment variable and never hard-code it.
> Every generation is an asynchronous task: POST /v1/{brand}/{version}/{task} returns a queued task, then poll GET /v1/tasks/{task_id} or receive a signed webhook, and download output.video.url before expires_at (7 days).
> The OpenAPI spec is at https://docs.fiveapi.ai/api-reference/openapi.yaml. An installable agent skill: npx skills add https://docs.fiveapi.ai

# Text to video

> Generate a video from a written description, with optional synchronized audio.

Text to video turns a prompt into a video. It is available on three models:

| Model | Endpoint | Resolutions | Duration | Audio |
| - | - | - | - | - |
| Video Fast 1.0 | `POST /v1/video-fast/v1.0/text-to-video` | 480p, 768p | 3–15 s | — |
| Wan 3.0 Spark | `POST /v1/wan/v3.0-spark/text-to-video` | 480p, 720p, 1080p | 2–30 s | yes |
| Wan 3.0 Prime Spark | `POST /v1/wan/v3.0-prime-spark/text-to-video` | 480p, 720p, 1080p | 2–30 s | yes |

## Create a task

```bash cURL theme={null}
curl https://api.fiveapi.ai/v1/wan/v3.0-spark/text-to-video \
  -H "Authorization: Bearer $FIVEAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: campaign-42-shot-1" \
  -d '{
    "prompt": "a lighthouse on a cliff during a storm, waves crash below, slow aerial orbit, cinematic",
    "negative_prompt": "text, watermark, blurry",
    "duration": 6,
    "resolution": "1080p",
    "aspect_ratio": "16:9",
    "generate_audio": true,
    "webhook_url": "https://hooks.example.com/fiveapi",
    "metadata": { "campaign": "42", "shot": 1 }
  }'
```

```python Python theme={null}
import os
import requests

task = requests.post(
    "https://api.fiveapi.ai/v1/wan/v3.0-spark/text-to-video",
    headers={
        "Authorization": f"Bearer {os.environ['FIVEAPI_API_KEY']}",
        "Idempotency-Key": "campaign-42-shot-1",
    },
    json={
        "prompt": "a lighthouse on a cliff during a storm, waves crash below, slow aerial orbit, cinematic",
        "negative_prompt": "text, watermark, blurry",
        "duration": 6,
        "resolution": "1080p",
        "aspect_ratio": "16:9",
        "generate_audio": True,
        "webhook_url": "https://hooks.example.com/fiveapi",
        "metadata": {"campaign": "42", "shot": 1},
    },
    timeout=30,
).json()
print(task["id"], task["status"])
```

```javascript Node.js theme={null}
const res = await fetch("https://api.fiveapi.ai/v1/wan/v3.0-spark/text-to-video", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.FIVEAPI_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "campaign-42-shot-1",
  },
  body: JSON.stringify({
    prompt: "a lighthouse on a cliff during a storm, waves crash below, slow aerial orbit, cinematic",
    negative_prompt: "text, watermark, blurry",
    duration: 6,
    resolution: "1080p",
    aspect_ratio: "16:9",
    generate_audio: true,
    webhook_url: "https://hooks.example.com/fiveapi",
    metadata: { campaign: "42", shot: 1 },
  }),
});
const task = await res.json();
console.log(task.id, task.status);
```

The task comes back `queued` with `credits.estimated` held. Get the video from the `task.completed` [webhook](https://testweb2-docs-openapi.test765.com/concepts/webhooks.md) or by polling [Get a task](https://testweb2-docs-openapi.test765.com/api-reference/tasks/get-task.md).

## Parameters

| Field | Required | Description |
| - | - | - |
| `prompt` | yes | What to generate, up to 2,000 characters. |
| `duration` | yes | Length in seconds, within the model's range. |
| `resolution` | yes | One of the model's resolutions. |
| `aspect_ratio` | no | `9:16`, `16:9`, `1:1`, `3:4` or `4:3`. Default: `9:16` on Video Fast 1.0, `16:9` on Wan 3.0. |
| `negative_prompt` | no | What to keep out of the video, up to 2,000 characters. |
| `generate_audio` | no | Wan 3.0 only. `true` adds synchronized audio. Default `false`. |
| `prompt_expansion` | no | `none`, `basic` or `advanced` (default). With `basic` or `advanced` the prompt is rewritten into a more detailed description; the result is in `output.actual_prompt`. |
| `seed` | no | Fixed seed for more reproducible results. |
| `webhook_url`, `metadata` | no | See [Webhooks](https://testweb2-docs-openapi.test765.com/concepts/webhooks.md) and [Tasks](https://testweb2-docs-openapi.test765.com/concepts/tasks.md). |

The exact ranges of each model are on its API reference page and in `GET /v1/models`.

## Write better prompts

A good prompt describes the shot the way a director would brief a camera crew:

| Element | Example |
| - | - |
| Subject | "an elderly fisherman with a white beard" |
| Action | "mends a net, then looks up at the sea" |
| Setting and light | "on a wooden pier at dawn, golden backlight, light fog" |
| Camera | "slow dolly-in, shallow depth of field" |
| Style | "cinematic, 35 mm film look" |
| Sound (with `generate_audio`) | "gulls cry, waves lap against the pier" |

Tips:

* Describe one continuous shot. Several unrelated scenes in one prompt tend to blur together.
* Name the camera movement explicitly: "static shot", "slow pan left", "aerial orbit".
* Use `negative_prompt` for things you keep seeing and don't want, such as text, watermarks or extra limbs.
* Leave `prompt_expansion` at `advanced` for short prompts. Switch to `none` when you have written a detailed prompt and want it used exactly.
* Iterate at 480p and a short duration, then render the final version at a higher resolution with the same prompt and `seed`.

## Choose the aspect ratio

| Ratio | Typical use |
| - | - |
| `9:16` | Vertical video for Reels, TikTok and Shorts |
| `16:9` | Landscape video for YouTube, web pages and TV |
| `1:1` | Square posts |
| `4:3`, `3:4` | Classic photo framing, product shots |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.