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

# Playground

> Submit a real Grok Imagine video task from this page, then poll it with the returned task id.

Fill in your API key and a prompt, then send. This hits the live API — the same
endpoint your code would call, and the only way to reach the video models.

<Warning>
  **Requests sent from this page are real and are billed to your key.**
  Video is priced per second: a one-second `480p` clip costs \$0.05 to \$0.08,
  and a fifteen-second `1080p` clip costs several dollars. Start short.
</Warning>

## Parameters

<ParamField body="model" type="string" required>
  Which model to run. Accepts `grok-imagine-video` or `grok-imagine-video-1.5`,
  matched exactly. Only `grok-imagine-video` can edit or extend an existing clip;
  only `grok-imagine-video-1.5` reaches `1080p` and preset voices.
</ParamField>

<ParamField body="input" type="object" required>
  The generation parameters. Any key not listed below is rejected with
  `invalid_params`.

  <Expandable title="input">
    <ParamField body="input.prompt" type="string" required>
      What to generate, or what to change when editing.
    </ParamField>

    <ParamField body="input.mode" type="string" default="generate">
      `generate`, `edit` or `extend`. Both `edit` and `extend` need
      `input.video` and only work on `grok-imagine-video`.
    </ParamField>

    <ParamField body="input.duration" type="integer">
      Length in seconds, 1 to 15. In `extend` mode the upstream model narrows
      this to 2 to 10, which is enforced after the task is queued rather than at
      submit time. Not used by `edit`, which follows the source length.
    </ParamField>

    <ParamField body="input.resolution" type="string" default="480p">
      `480p`, `720p`, or `1080p` on `grok-imagine-video-1.5` only. Rejected in
      `edit` mode, and capped at `720p` when `input.reference_images` is set.
    </ParamField>

    <ParamField body="input.aspect_ratio" type="string" default="16:9">
      One of `1:1` `16:9` `9:16` `4:3` `3:4` `3:2` `2:3`. There is no `auto`
      here, unlike the image models.
    </ParamField>

    <ParamField body="input.images" type="string[]">
      Exactly one image, used as the **first frame** of the clip. An `https` URL
      or a base64 data URI. Cannot be combined with `input.reference_images`.
    </ParamField>

    <ParamField body="input.video" type="string">
      The source clip for `edit` and `extend`. An `https` URL or a base64 video
      data URI, and at least 2 seconds long. Charged per second as an input.
    </ParamField>

    <ParamField body="input.reference_images" type="string[]">
      Up to 3 images the model draws style and subject from. Caps the output at
      `720p`. Cannot be combined with `input.images`.
    </ParamField>

    <ParamField body="input.voice_ids" type="string[]">
      Up to 3 preset voices, `grok-imagine-video-1.5` only. The value is not
      checked at submit time, so a wrong name fails the task later.
    </ParamField>

    <ParamField body="input.generate_audio" type="boolean" default="true">
      Set `false` for a silent clip. Does not change the price.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="callback_url" type="string">
  An `https` URL to POST the finished task to, so you can skip polling. Given
  that video takes 20 to 50 seconds, a callback is worth wiring up.
</ParamField>

## What comes back

Submitting returns immediately, in well under a second. The clip is **not** in
this response — generation happens in the background.

| Field        | Type    | Notes                                  |
| ------------ | ------- | -------------------------------------- |
| `id`         | string  | The task id. Everything else needs it. |
| `status`     | string  | `queued` on a fresh task.              |
| `created_at` | integer | Unix seconds, UTC.                     |

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "task_IIISyUlKs0fJDptkSCLbcJvXWZLpECKM",
    "status": "queued",
    "created_at": 1788189046
  }
  ```
</ResponseExample>

## Then poll for the result

This playground covers the create call only. Take the `id` from the response
above and read the task until `status` reaches `completed` or `failed` — expect
20 to 50 seconds depending on length and resolution.

```bash theme={null}
curl https://api.widerouter.com/v1/task/$TASK_ID \
  -H "Authorization: Bearer $WIDEROUTER_API_KEY"
```

A finished task carries an `outputs` array holding one MP4:

```json theme={null}
{
  "id": "task_IIISyUlKs0fJDptkSCLbcJvXWZLpECKM",
  "model": "grok-imagine-video",
  "status": "completed",
  "created_at": 1788189046,
  "completed_at": 1788189065,
  "expires_at": 1788275465,
  "outputs": ["https://r2cdn.agisuitepro.com/o/2026/08/31/task_IIISyUlKs0fJDptkSCLbcJvXWZLpECKM_0.mp4"],
  "counts": { "requested": 1, "succeeded": 1, "failed": 0 },
  "usage": { "cost_in_usd_ticks": 500000000 }
}
```

The file is served as `video/mp4` and plays inline. Its duration runs about
0.04 seconds longer than you asked for.

<Info>
  Output URLs are unauthenticated and expire 24 hours after the task finishes.
  `usage.cost_in_usd_ticks` is the **list price**; your balance moves by that
  figure times your group multiplier — see
  [pricing](/models/grok-imagine/video/overview#pricing).
</Info>

## Next steps

<CardGroup cols={2}>
  <Card title="Overview" icon="film" href="/models/grok-imagine/video/overview">
    Modes, duration and resolution tiers, reference images, voices and pricing.
  </Card>

  <Card title="Async task API" icon="clock" href="/api/async-tasks">
    The polling loop, callbacks and the full error table.
  </Card>
</CardGroup>
