> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-stale2000-router-model-pages.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Uni 1 with Comfy Router

> Call luma_2/uni-1 through Comfy Router: endpoint, request shape and the response Router returns.

Use `luma_2/uni-1` with the Comfy Router API. Luma 2 provides the model; Router gives it the shared authentication and request route below.

## Quick start

Create a key at [platform.comfy.org/profile/api-keys](https://platform.comfy.org/profile/api-keys) and export it as `COMFY_API_KEY`. The Python and TypeScript snippets use the Comfy SDKs (`pip install comfy-sdk`, `npm install @comfyorg/sdk`); the cURL snippet is the same call over raw HTTP.

**Model ID:** `luma_2/uni-1`

**Endpoint:** `POST https://api.comfy.org/v2/models/luma_2/uni-1`

<CodeGroup>
  ```python Python theme={null}
  import uuid
  from comfy_sdk import Comfy

  # Reads COMFY_API_KEY from the environment. Save this key and reuse it if you
  # retry this request after the SDK returns an error.
  idempotency_key = str(uuid.uuid4())
  with Comfy() as client:
      result = client.models.run(
          "luma_2/uni-1",
          {
              # Request fields are the provider's own — see Input below.
          },
          idempotency_key=idempotency_key,
      )

  print(result)
  ```

  ```typescript TypeScript theme={null}
  import { comfy } from "@comfyorg/sdk";

  // Reads COMFY_API_KEY from the environment. Save this key and reuse it if you
  // retry this request after the SDK returns an error.
  const idempotencyKey = crypto.randomUUID();
  const { data } = await comfy.models.run("luma_2/uni-1", {
    // Request fields are the provider's own — see Input below.
  }, { idempotencyKey });

  console.log(data);
  ```

  ```bash cURL theme={null}
  # Request fields are the provider's own — see Input below.
  # Run this line once. Reuse ROUTER_REQUEST_KEY if you retry the curl command.
  ROUTER_REQUEST_KEY=$(uuidgen)
  curl https://api.comfy.org/v2/models/luma_2/uni-1 \
    -H "X-API-Key: $COMFY_API_KEY" \
    -H "Idempotency-Key: $ROUTER_REQUEST_KEY" \
    -H "Content-Type: application/json" \
    -d '{}'
  ```
</CodeGroup>

## Schema

### Input

<ParamField body="aspect_ratio" type="string">
  Output aspect ratio. The ray-3.2 video models support the subset 9:16, 3:4, 1:1, 4:3, 16:9, 21:9.

  Possible values: `3:1`, `2:1`, `21:9`, `16:9`, `3:2`, `4:3`, `1:1`, `3:4`, `2:3`, `9:16`, `1:2`, `1:3`
</ParamField>

<ParamField body="image_ref" type="object[]">
  Reference images for style/content guidance. Up to 9 for type 'image', up to 8 for type 'image\_edit'.
</ParamField>

<ParamField body="image_ref[].data" type="string">
  Base64-encoded image or video data
</ParamField>

<ParamField body="image_ref[].generation_id" type="string">
  UUID of a prior completed generation to reuse as the source. Used by ray-3.2 video\_edit / video\_reframe.
</ParamField>

<ParamField body="image_ref[].media_type" type="string">
  MIME type. Required with data (and with url for video sources, e.g. video/mp4 on video\_edit / video\_reframe).
</ParamField>

<ParamField body="image_ref[].url" type="string">
  Publicly accessible image or video URL
</ParamField>

<ParamField body="model" type="string">
  Model to use. uni-1 / uni-1-max for image generation, ray-3.2 for video generation, editing, and reframing.
</ParamField>

<ParamField body="output_format" type="string">
  Output image format

  Possible values: `png`, `jpeg`
</ParamField>

<ParamField body="prompt" type="string" required>
  Text prompt
</ParamField>

<ParamField body="source" type="object">
  Reference to an image or video. Used for style/content guidance, guided generation, video-edit/video-reframe sources, and guide keyframes. Provide exactly one of generation\_id, url, or data.
</ParamField>

<ParamField body="source.data" type="string">
  Base64-encoded image or video data
</ParamField>

<ParamField body="source.generation_id" type="string">
  UUID of a prior completed generation to reuse as the source. Used by ray-3.2 video\_edit / video\_reframe.
</ParamField>

<ParamField body="source.media_type" type="string">
  MIME type. Required with data (and with url for video sources, e.g. video/mp4 on video\_edit / video\_reframe).
</ParamField>

<ParamField body="source.url" type="string">
  Publicly accessible image or video URL
</ParamField>

<ParamField body="style" type="string">
  Style preset

  Possible values: `auto`, `manga`
</ParamField>

<ParamField body="type" type="string">
  The kind of generation to perform. image/image\_edit are produced by the uni-1 / uni-1-max models; video/video\_edit/video\_reframe are produced by the ray-3.2 model.

  Possible values: `image`, `image_edit`, `video`, `video_edit`, `video_reframe`
</ParamField>

<ParamField body="video" type="object">
  Video output settings for ray-3.2. Only the fields that affect validation and billing are modelled here; additional fields (edit controls, end\_frame, loop, source\_position) are forwarded to Luma untouched.
</ParamField>

<ParamField body="video.duration" type="string">
  Clip duration for ray-3.2 video / video\_edit. Defaults to 5s. HDR generation (type video) is restricted to 5s.

  Possible values: `5s`, `10s`
</ParamField>

<ParamField body="video.exr_export" type="boolean">
  Export an EXR file alongside the MP4. Requires hdr true. Rejected for video\_reframe.
</ParamField>

<ParamField body="video.hdr" type="boolean">
  Render in HDR. Requires 720p/1080p. Rejected for video\_reframe.
</ParamField>

<ParamField body="video.keyframes" type="object[]">
  Guide-frame images. A single keyframe makes a type "video" request a single-keyframe extend, which always bills as one 5s block.
</ParamField>

<ParamField body="video.keyframes[].data" type="string">
  Base64-encoded image or video data
</ParamField>

<ParamField body="video.keyframes[].generation_id" type="string">
  UUID of a prior completed generation to reuse as the source. Used by ray-3.2 video\_edit / video\_reframe.
</ParamField>

<ParamField body="video.keyframes[].media_type" type="string">
  MIME type. Required with data (and with url for video sources, e.g. video/mp4 on video\_edit / video\_reframe).
</ParamField>

<ParamField body="video.keyframes[].url" type="string">
  Publicly accessible image or video URL
</ParamField>

<ParamField body="video.loop" type="boolean">
  Loop the generated clip. Create-only (type video).
</ParamField>

<ParamField body="video.resolution" type="string">
  Output resolution for ray-3.2 video. Defaults to 720p. 360p is the draft tier. HDR requires 720p or 1080p.

  Possible values: `360p`, `540p`, `720p`, `1080p`
</ParamField>

<ParamField body="video.start_frame" type="object">
  Reference to an image or video. Used for style/content guidance, guided generation, video-edit/video-reframe sources, and guide keyframes. Provide exactly one of generation\_id, url, or data.
</ParamField>

<ParamField body="video.start_frame.data" type="string">
  Base64-encoded image or video data
</ParamField>

<ParamField body="video.start_frame.generation_id" type="string">
  UUID of a prior completed generation to reuse as the source. Used by ray-3.2 video\_edit / video\_reframe.
</ParamField>

<ParamField body="video.start_frame.media_type" type="string">
  MIME type. Required with data (and with url for video sources, e.g. video/mp4 on video\_edit / video\_reframe).
</ParamField>

<ParamField body="video.start_frame.url" type="string">
  Publicly accessible image or video URL
</ParamField>

<ParamField body="web_search" type="boolean">
  Enable web search grounding
</ParamField>

Generated from the schema Router serves at `GET /v2/models/luma_2/uni-1/openapi.json`, the same document it validates a call against before the request reaches the provider.

### Output

<ResponseField name="created_at" type="string">
  Creation timestamp
</ResponseField>

<ResponseField name="failure_code" type="string">
  Machine-readable failure code for programmatic handling

  Possible values: `content_moderated`, `generation_failed`, `budget_exhausted`, `output_not_found`
</ResponseField>

<ResponseField name="failure_reason" type="string">
  Human-readable failure description, populated only on a FAILED generation. `null` on a successful one.
</ResponseField>

<ResponseField name="id" type="string">
  Generation identifier
</ResponseField>

<ResponseField name="model" type="string">
  Model used
</ResponseField>

<ResponseField name="output" type="object[]">
  A generated output entry
</ResponseField>

<ResponseField name="output[].type" type="string">
  Media type (e.g. image)
</ResponseField>

<ResponseField name="output[].url" type="string">
  Presigned URL (1hr expiry)
</ResponseField>

<ResponseField name="state" type="string">
  Current state of the generation

  Possible values: `queued`, `processing`, `completed`, `failed`
</ResponseField>

<ResponseField name="type" type="string">
  The kind of generation to perform. image/image\_edit are produced by the uni-1 / uni-1-max models; video/video\_edit/video\_reframe are produced by the ray-3.2 model.

  Possible values: `image`, `image_edit`, `video`, `video_edit`, `video_reframe`
</ResponseField>

## Examples

### Input

```json theme={null}
{
  "prompt": "a red circle on a plain white background",
  "type": "image"
}
```

### Output

```json theme={null}
{
  "created_at": "2027-01-01T00:00:00Z",
  "failure_code": null,
  "failure_reason": null,
  "id": "gen-luma-agents-3f2a7c1e8b40",
  "model": "uni-1",
  "output": [
    {
      "type": "image",
      "url": "https://example.invalid/luma_2/uni-1/generated.png"
    }
  ],
  "state": "completed",
  "type": "image"
}
```

## Before you ship

Save one `Idempotency-Key` for each call and reuse it for retries. Router can hold the connection for up to 10 minutes. The SDKs handle authentication; raw HTTP clients send the headers themselves.

Use `X-Comfy-Error-Type` to classify a failure. A `422` means Router rejected the input before calling the provider. Download generated assets promptly because [result URLs can expire](/development/comfy-router/reference#result-assets).

<CardGroup cols={3}>
  <Card title="Headers" icon="list" href="/development/comfy-router/headers">
    Authentication, idempotency, request IDs, error buckets, retry pacing, spend limits.
  </Card>

  <Card title="Using the Router API" icon="code" href="/development/comfy-router/models">
    Find models, inspect schemas, and retry safely.
  </Card>

  <Card title="Limitations" icon="triangle-exclamation" href="/development/comfy-router/limitations">
    What Router does not do today, and what to use instead.
  </Card>
</CardGroup>
