> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-matt-sdk-0-3-0-run-kind.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Photon Flash 1 with Comfy Router

> Call luma/photon-flash-1 through Comfy Router: endpoint, request shape and the response Router returns.

API Reference for `luma/photon-flash-1`, served by Comfy Router from Luma.

## Quick start

Create a key in [your Comfy workspace](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/photon-flash-1`

**Endpoint:** `POST https://api.comfy.org/v2/models/luma/photon-flash-1`

<Tabs>
  <Tab title="Wait for the result">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # The SDK automatically creates an idempotency key and reuses it for automatic retries.
      with Comfy() as client:
          result = client.models.run(
              "luma/photon-flash-1",
              {
                  "aspect_ratio": "1:1",
                  "prompt": "a red circle on a plain white background",
              },
          )

      print(result)
      ```

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

      // Reads COMFY_API_KEY from the environment.
      // The SDK automatically creates an idempotency key and reuses it for automatic retries.
      const { data } = await comfy.models.run("luma/photon-flash-1", {
        aspect_ratio: "1:1",
        prompt: "a red circle on a plain white background",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/luma/photon-flash-1 \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"aspect_ratio\": \"1:1\", \"prompt\": \"a red circle on a plain white background\"}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Queue and collect later">
    <Note>
      Queued delivery is rolling out per workspace. Until yours is enabled, the submit route answers `403` with `X-Comfy-Error-Type: not_enabled`. Nothing about the request is wrong, and the same body works through the synchronous route in the meantime.
    </Note>

    The same body, sent to `POST https://api.comfy.org/v2/models/luma/photon-flash-1/requests`. Router answers `201` with a `request_id` as soon as the run is admitted, and the result is collected once it is ready, from this process or another one. [Queued delivery](/development/comfy-router/queue) walks through status, cancellation and collection.

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

      # Reads COMFY_API_KEY from the environment.
      # Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      with Comfy() as client:
          handle = client.models.submit(
              "luma/photon-flash-1",
              {
                  "aspect_ratio": "1:1",
                  "prompt": "a red circle on a plain white background",
              },
          )
          print("request_id:", handle.request_id)  # with the model ID, all another process needs

          # Poll until the request completes, waiting the Retry-After the server names.
          for update in handle.iter_events():
              print(update.status, update.queue_position)

          # The provider's own payload, the same value models.run() returns.
          # A request that failed or was cancelled raises the typed Router error here.
          result = handle.get()

      print(result)
      ```

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

      // Reads COMFY_API_KEY from the environment.
      // Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      const handle = await comfy.models.submit("luma/photon-flash-1", {
        aspect_ratio: "1:1",
        prompt: "a red circle on a plain white background",
      });
      console.log("requestId:", handle.requestId); // with the model ID, all another process needs

      // Poll until the request completes, waiting the Retry-After the server names.
      for await (const update of handle.events()) {
        console.log(update.status, update.queuePosition);
      }

      // The same result models.run() returns. A request that failed or was cancelled rejects here.
      const result = await handle.get();

      console.log(result.data);
      ```

      ```bash cURL theme={null}
      # 1. Submit. Router answers 201 with request_id, status_url, response_url and cancel_url.
      curl https://api.comfy.org/v2/models/luma/photon-flash-1/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"aspect_ratio\": \"1:1\", \"prompt\": \"a red circle on a plain white background\"}"

      # 2. Poll until status is COMPLETED, waiting the Retry-After seconds each response names.
      REQUEST_ID="<request_id from the 201 body>"
      curl -i https://api.comfy.org/v2/models/luma/photon-flash-1/requests/$REQUEST_ID/status \
        -H "X-API-Key: $COMFY_API_KEY"

      # 3. Collect. 200 with the model's native output, 202 with the status body while it is still running.
      curl https://api.comfy.org/v2/models/luma/photon-flash-1/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Schema

### Input

<ParamField body="aspect_ratio" type="string" default="&#x22;16:9&#x22;">
  The aspect ratio of the generation

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

<ParamField body="callback_url" type="string (uri)">
  The callback URL for the generation

  Format: `uri`
</ParamField>

<ParamField body="character_ref" type="object" />

<ParamField body="character_ref.identity0" type="object">
  The image identity object
</ParamField>

<ParamField body="character_ref.identity0.images" type="string (uri)[]">
  The URLs of the image identity
</ParamField>

<ParamField body="generation_type" type="string" default="&#x22;image&#x22;">
  Possible values: `image`
</ParamField>

<ParamField body="image_ref" type="object[]">
  The image reference object
</ParamField>

<ParamField body="image_ref[].url" type="string (uri)">
  The URL of the image reference

  Format: `uri`
</ParamField>

<ParamField body="image_ref[].weight" type="number">
  The weight of the image reference
</ParamField>

<ParamField body="model" type="string">
  The image model used for the generation. On the Comfy Router route `POST /v2/models/luma/{model}` this field is supplied from the path and MUST NOT be sent; on the v1 `POST /proxy/luma/generations/image` route it is constrained to the LumaImageModel enum (`photon-1`, `photon-flash-1`), which the Rewrite enforces by refusing an omitted or unknown model.
</ParamField>

<ParamField body="modify_image_ref" type="object">
  The modify image reference object
</ParamField>

<ParamField body="modify_image_ref.url" type="string (uri)">
  The URL of the image reference

  Format: `uri`
</ParamField>

<ParamField body="modify_image_ref.weight" type="number">
  The weight of the modify image reference
</ParamField>

<ParamField body="prompt" type="string">
  The prompt of the generation
</ParamField>

<ParamField body="style_ref" type="object[]">
  The image reference object
</ParamField>

<ParamField body="style_ref[].url" type="string (uri)">
  The URL of the image reference

  Format: `uri`
</ParamField>

<ParamField body="style_ref[].weight" type="number">
  The weight of the image reference
</ParamField>

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

### Output

<ResponseField name="assets" type="object">
  The assets of an image generation. `image` is the result; `video` and `progress_video` belong to the Dream Machine VIDEO operation, which shares this status route, and Luma sends them here as explicit nulls.
</ResponseField>

<ResponseField name="assets.image" type="string (uri)">
  The URL of the generated image — the leaf a `luma/photon-*` generation fills. Null until the generation reaches `completed`.

  Format: `uri`
</ResponseField>

<ResponseField name="assets.progress_video" type="string (uri)">
  Always null on an image generation; it is the in-flight preview Luma publishes while a VIDEO generation runs.

  Format: `uri`
</ResponseField>

<ResponseField name="assets.video" type="string (uri)">
  Always null on an image generation; the `luma/ray-*` video models fill it instead.

  Format: `uri`
</ResponseField>

<ResponseField name="created_at" type="string (date-time)">
  The date and time when the generation was created

  Format: `date-time`
</ResponseField>

<ResponseField name="failure_reason" type="string">
  The reason for the state of the generation
</ResponseField>

<ResponseField name="generation_type" type="string">
  The type of the generation — always `image` on this operation

  Possible values: `image`
</ResponseField>

<ResponseField name="id" type="string (uuid)">
  The ID of the generation

  Format: `uuid`
</ResponseField>

<ResponseField name="model" type="string">
  The model used for the generation
</ResponseField>

<ResponseField name="request" type="object">
  The image generation request, echoed back inside the terminal document. Luma serialises every field of its request model, writing an explicit `null` into each one the caller did not set, so read a field's presence from its VALUE rather than from the key.
</ResponseField>

<ResponseField name="request.aspect_ratio" type="string" default="&#x22;16:9&#x22;">
  The aspect ratio of the generation

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

<ResponseField name="request.callback_url" type="string (uri)">
  The callback URL for the generation

  Format: `uri`
</ResponseField>

<ResponseField name="request.character_ref" type="object" />

<ResponseField name="request.character_ref.identity0" type="object">
  An image identity as it comes BACK inside the terminal document. Same shape as `LumaImageIdentity`, with its members nullable for the reason `LumaImageRefEcho` gives.
</ResponseField>

<ResponseField name="request.character_ref.identity0.images" type="string (uri)[]">
  The URLs of the image identity
</ResponseField>

<ResponseField name="request.generation_type" type="string">
  Always `image` when set, echoing the operation. Null when the caller did not send one, for the reason this whole echo object exists.
</ResponseField>

<ResponseField name="request.image_ref" type="object[]">
  An image reference as it comes BACK inside the terminal document. Same shape as `LumaImageRef`, with each member nullable because Luma echoes an unset one as an explicit `null` rather than omitting it.
</ResponseField>

<ResponseField name="request.image_ref[].url" type="string (uri)">
  The URL of the image reference

  Format: `uri`
</ResponseField>

<ResponseField name="request.image_ref[].weight" type="number">
  The weight of the image reference
</ResponseField>

<ResponseField name="request.model" type="string" default="&#x22;photon-1&#x22;">
  The image model used for the generation

  Possible values: `photon-1`, `photon-flash-1`
</ResponseField>

<ResponseField name="request.modify_image_ref" type="object">
  A modify-image reference as it comes BACK inside the terminal document. Same shape as `LumaModifyImageRef`, with its members nullable for the reason `LumaImageRefEcho` gives.
</ResponseField>

<ResponseField name="request.modify_image_ref.url" type="string (uri)">
  The URL of the image reference

  Format: `uri`
</ResponseField>

<ResponseField name="request.modify_image_ref.weight" type="number">
  The weight of the modify image reference
</ResponseField>

<ResponseField name="request.prompt" type="string">
  The prompt of the generation
</ResponseField>

<ResponseField name="request.style_ref" type="object[]">
  An image reference as it comes BACK inside the terminal document. Same shape as `LumaImageRef`, with each member nullable because Luma echoes an unset one as an explicit `null` rather than omitting it.
</ResponseField>

<ResponseField name="request.style_ref[].url" type="string (uri)">
  The URL of the image reference

  Format: `uri`
</ResponseField>

<ResponseField name="request.style_ref[].weight" type="number">
  The weight of the image reference
</ResponseField>

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

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

## Examples

### Input

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

### Output

```json theme={null}
{
  "assets": {
    "image": "https://example.invalid/luma/photon-flash-1/generated.png",
    "progress_video": null,
    "video": null
  },
  "created_at": "2027-01-01T00:00:00Z",
  "failure_reason": null,
  "generation_type": "image",
  "id": "a1c73f26-08d5-4e69-b7a2-3c4d5e6f7a80",
  "model": "photon-flash-1",
  "request": {
    "aspect_ratio": "1:1",
    "callback_url": null,
    "character_ref": null,
    "generation_type": "image",
    "image_ref": null,
    "model": "photon-flash-1",
    "modify_image_ref": null,
    "prompt": "a red circle on a plain white background",
    "style_ref": null
  },
  "state": "completed"
}
```

## Before you ship

The SDKs create an `Idempotency-Key` and reuse it for automatic retries. For manual retries, reuse the original key. Router can hold the connection for up to 10 minutes.

When a request fails, Router sends an `X-Comfy-Error-Type` response header explaining why. 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/api">
    Model discovery, validation errors, retries, and billing.
  </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>
