# Muse Video Generation

Create Muse Video (Meta) text-to-video and multi-reference video tasks with `muse-video`. Brioi exposes a single public model name and accepts reference images and videos via `ref`.

> A model is callable only when it appears in `GET /v1/models` for your current API key. A successful creation response, task ID, or in-progress status does not mean a deliverable video has been obtained.

## Endpoints & Authentication

```http
POST https://vip.brioi.com/v1/videos
GET  https://vip.brioi.com/v1/videos/{task_id}
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

## Request Parameters

| Parameter | Type | Required | Default | Description |
|---|---|---:|---|---|
| `model` | string | Yes | — | Must be `muse-video`. |
| `prompt` | string | Yes | — | Non-empty video description. Reference input assets with the literal model tags `@图片1`, `@视频1`, etc. |
| `ref` | object[] | No | — | Reference assets; see `ref` items below. |
| `duration` | integer | No | `5` | Output duration in integer seconds (`4–30`). |
| `aspect_ratio` | string | No | `16:9` | Supports `16:9`, `9:16`. |
| `resolution` | string | No | `720p` | Only `720p` is supported; may be omitted. |

### `ref` Items

Each item passes `type` and `url`. Every URL must be a publicly accessible HTTP(S) address readable throughout task execution without login, cookies, or custom request headers.

| `type` | Description | Max Count |
|---|---|---:|
| `image` | Reference image | 7 images |
| `video` | Reference video | 3 clips |

- Up to 7 reference images and up to 3 reference videos can be used individually or together.
- Images and videos are numbered separately starting from 1 according to their order in `ref`: the first image is `@图片1` and the first video is `@视频1` (note: `@图片1` and `@视频1` are literal Chinese model syntax tags—keep them unchanged in prompts).
- Reference audio, first/last frames, and other `type` values are not currently supported.

## Examples

### Text-to-Video: Complete cURL Example (Defaults to 5s, 16:9, 720p)

```bash
curl --request POST 'https://vip.brioi.com/v1/videos' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "muse-video",
    "prompt": "Rainy neon street at night, camera pushing forward slowly, lights reflected on wet pavement",
    "duration": 5
  }'
```

### Multi-Reference: 2 Images + 1 Video, Portrait 8s

```json
{
  "model": "muse-video",
  "prompt": "The two people in @图片1 and @图片2 walk side by side down a neon-lit street, following the motion and camera pacing of @视频1, then wave together at the end",
  "duration": 8,
  "aspect_ratio": "9:16",
  "ref": [
    {
      "type": "image",
      "url": "https://example.com/person-1.png"
    },
    {
      "type": "image",
      "url": "https://example.com/person-2.png"
    },
    {
      "type": "video",
      "url": "https://example.com/motion-1.mp4"
    }
  ]
}
```

## Billing

Billed by the requested `duration` in seconds (defaulting to `5` seconds when omitted), with no extra charge for the number of reference images or videos. Per-second rates follow the Model Marketplace listing and your API key's token-group multiplier; failed tasks are refunded in full.

## Asynchronous Responses

Save `id` from the creation response and poll the same task via `GET /v1/videos/{task_id}`. Generation typically takes several minutes; poll every 10–30 seconds. Public statuses:

| Status | Action |
|---|---|
| `queued` | Queued; continue polling. |
| `in_progress` | Generating; continue polling. |
| `completed` | Read `metadata.url`. |
| `failed` | Read `error` and stop polling. |

Treat any status value not listed above as incomplete and continue polling. A deliverable video is obtained only when `status=completed` and `metadata.url` is non-empty and downloadable (`result_url` holds the same value as a fallback). Result URLs expire—download or persist the video immediately upon completion. If a creation request times out or returns a transient `5xx`, verify whether the task was already created before submitting a second task.

## Unsupported Parameters

The following are not currently accepted: aspect ratios such as `1:1` or `4:3`, resolutions such as `480p`, `1080p`, or `4K`, durations above 30 seconds, reference audio, `seed`, `watermark`, `quality`, and Chat Completions parameters (`messages`, `temperature`, `top_p`, `stream`).

## Error Handling

| HTTP Status | Common Cause |
|---:|---|
| `400` | Invalid parameters; querying a non-existent task also returns `400` with `code` set to `task_not_exist` |
| `401` | Missing or invalid API key |
| `403` | Insufficient balance/quota, or no permission for the requested model |
| `429` | Rate limit exceeded |
| `503` | Service temporarily unavailable |
| `500` / `502` | Transient service error |

