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

# Text to video

> Generate a video from a prompt alone.

Send `input.prompt` alone, with no media. Describe the subject, action, setting, camera and light; `ratio` sets the aspect ratio and `duration` the length.

> [!TIP]
>
> Want to try it right away? Open [Create video generation task](https://docs.dreamto.ai/en/api-reference/wan-3-0-prime/create-video-synthesis.md), pick "Text to video" in the request example menu, enter your API key and click **Try it**.

## Request

`$DREAMTO_API_KEY` in the examples is your API key.

```bash cURL theme={null}
curl -X POST "https://api.dreamto.ai/api/v1/services/aigc/video-generation/video-synthesis" \
  -H "Authorization: Bearer $DREAMTO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-DashScope-Async: enable" \
  -d '{
    "model": "wan3.0-video-prime",
    "input": {
      "prompt": "A small red paper boat floats down a rain-filled street gutter, close-up, soft morning light."
    },
    "parameters": {
      "resolution": "720P",
      "ratio": "16:9",
      "duration": 5
    }
  }'
```

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

payload = {
    "model": "wan3.0-video-prime",
    "input": {
        "prompt": "A small red paper boat floats down a rain-filled street gutter, close-up, soft morning light."
    },
    "parameters": {
        "resolution": "720P",
        "ratio": "16:9",
        "duration": 5
    }
}

resp = requests.post(
    "https://api.dreamto.ai/api/v1/services/aigc/video-generation/video-synthesis",
    headers={
        "Authorization": f"Bearer {os.environ['DREAMTO_API_KEY']}",
        "X-DashScope-Async": "enable",
    },
    json=payload,
    timeout=60,
)
print(resp.status_code, resp.json())  # {'request_id': '...', 'output': {'task_id': '...', 'task_status': 'PENDING'}}
```

```javascript Node.js theme={null}
const payload = {
  "model": "wan3.0-video-prime",
  "input": {
    "prompt": "A small red paper boat floats down a rain-filled street gutter, close-up, soft morning light."
  },
  "parameters": {
    "resolution": "720P",
    "ratio": "16:9",
    "duration": 5
  }
};

const resp = await fetch("https://api.dreamto.ai/api/v1/services/aigc/video-generation/video-synthesis", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.DREAMTO_API_KEY}`,
    "Content-Type": "application/json",
    "X-DashScope-Async": "enable",
  },
  body: JSON.stringify(payload),
});
console.log(resp.status, await resp.json()); // { request_id: '...', output: { task_id: '...', task_status: 'PENDING' } }
```

## Response

A successful create returns HTTP 200 and the task is queued. Quote `request_id` when you report a problem:

```json theme={null}
{
  "request_id": "7d2c3a51-8f0e-4b6a-9c1d-2e3f4a5b6c7d",
  "output": {
    "task_id": "0385dc79-5ff8-4d82-bcb6-bc5ae0ed7a4f",
    "task_status": "PENDING"
  }
}
```

With `output.task_id`, call [Query task](https://docs.dreamto.ai/en/api-reference/wan-3-0-prime/query-task.md) about every 15 seconds; when `task_status` is `SUCCEEDED`, download the video from `output.video_url`. All request parameters and their values are in [Create video generation task](https://docs.dreamto.ai/en/api-reference/wan-3-0-prime/create-video-synthesis.md).


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