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

# Comfy Router로 Ray 3.2 사용하기

> Comfy Router를 통해 luma_2/ray-3.2를 호출합니다: 엔드포인트, 요청 형태 및 Router가 반환하는 응답.

Comfy Router가 Luma 2에서 제공하는 `luma_2/ray-3.2`의 API 레퍼런스입니다.

**입력:** 텍스트, 이미지, 비디오 · **출력:** 비디오

## 빠른 시작

[Comfy 워크스페이스](https://platform.comfy.org/profile/api-keys?onboarding=router)에서 키를 생성하고 `COMFY_API_KEY`로 내보내세요. Python 및 TypeScript 스니펫은 Comfy SDK(`pip install comfy-sdk`, `npm install @comfyorg/sdk`)를 사용하며, cURL 스니펫은 동일한 호출을 원시 HTTP로 수행합니다.

**모델 ID:** `luma_2/ray-3.2`

**엔드포인트:** `POST https://api.comfy.org/v2/models/luma_2/ray-3.2`

**결과 기다리기**

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

# 환경 변수에서 COMFY_API_KEY를 읽습니다.
# SDK는 자동으로 멱등성 키를 생성하고 자동 재시도에 재사용합니다.
with Comfy() as client:
    result = client.models.run(
        "luma_2/ray-3.2",
        {
            "prompt": "a paper boat drifting across a plain white background",
            "type": "video",
            "video": {
                "duration": "5s",
                "resolution": "360p",
            },
        },
    )

print(result)
```

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

// 환경 변수에서 COMFY_API_KEY를 읽습니다.
// SDK는 자동으로 멱등성 키를 생성하고 자동 재시도에 재사용합니다.
const { data } = await comfy.models.run("luma_2/ray-3.2", {
  prompt: "a paper boat drifting across a plain white background",
  type: "video",
  video: {
    duration: "5s",
    resolution: "360p",
  },
});

console.log(data);
```

```bash cURL theme={null}
curl https://api.comfy.org/v2/models/luma_2/ray-3.2 \
  -H "X-API-Key: $COMFY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d "{\"prompt\": \"a paper boat drifting across a plain white background\", \"type\": \"video\", \"video\": {\"duration\":\"5s\",\"resolution\":\"360p\"}}"
```

**대기열에 제출하고 나중에 수집하기**

동일한 본문을 `POST https://api.comfy.org/v2/models/luma_2/ray-3.2/requests`로 전송합니다. Router는 실행이 접수되는 즉시 `201`과 `request_id`로 응답하며, 결과는 준비가 되면 이 프로세스 또는 다른 프로세스에서 수집합니다. [대기 중 전달](https://docs.comfy.org/ko/development/comfy-router/queue.md)에서 상태, 취소, 수집 과정을 안내합니다.

```python Python theme={null}
import asyncio
from comfy_sdk import AsyncComfy

# 환경 변수에서 COMFY_API_KEY를 읽습니다.
# 각 submit() 호출은 자체 Idempotency-Key를 발급하고 자동 재시도에 재사용합니다.
async def main():
    async with AsyncComfy() as client:
        handle = await client.models.submit(
            "luma_2/ray-3.2",
            {
                "prompt": "a paper boat drifting across a plain white background",
                "type": "video",
                "video": {
                    "duration": "5s",
                    "resolution": "360p",
                },
            },
        )
        print("request_id:", handle.request_id)  # 모델 ID와 함께면 다른 프로세스에 필요한 전부입니다

        # 요청이 완료될 때까지 폴링하며, 서버가 알려주는 Retry-After만큼 기다립니다.
        async for update in handle.iter_events():
            print(update.status, update.queue_position)

        # 공급자의 원본 페이로드로, models.run()이 반환하는 것과 동일한 값입니다.
        # 실패했거나 취소된 요청은 여기서 타입이 지정된 Router 오류를 발생시킵니다.
        result = await handle.get()

    print(result)

asyncio.run(main())
```

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

// 환경 변수에서 COMFY_API_KEY를 읽습니다.
// 각 submit() 호출은 자체 Idempotency-Key를 발급하고 자동 재시도에 재사용합니다.
const handle = await comfy.models.submit("luma_2/ray-3.2", {
  prompt: "a paper boat drifting across a plain white background",
  type: "video",
  video: {
    duration: "5s",
    resolution: "360p",
  },
});
console.log("requestId:", handle.requestId); // 모델 ID와 함께면 다른 프로세스에 필요한 전부입니다

// 요청이 완료될 때까지 폴링하며, 서버가 알려주는 Retry-After만큼 기다립니다.
for await (const update of handle.events()) {
  console.log(update.status, update.queuePosition);
}

// models.run()이 반환하는 것과 동일한 결과입니다. 실패했거나 취소된 요청은 여기서 거부됩니다.
const result = await handle.get();

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

```bash cURL theme={null}
# 1. 제출. Router는 request_id, status_url, response_url, cancel_url과 함께 201로 응답합니다.
curl https://api.comfy.org/v2/models/luma_2/ray-3.2/requests \
  -H "X-API-Key: $COMFY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d "{\"prompt\": \"a paper boat drifting across a plain white background\", \"type\": \"video\", \"video\": {\"duration\":\"5s\",\"resolution\":\"360p\"}}"

# 2. 상태가 COMPLETED가 될 때까지 폴링하며, 각 응답이 알려주는 Retry-After 초만큼 기다립니다.
REQUEST_ID="<request_id from the 201 body>"
curl -i https://api.comfy.org/v2/models/luma_2/ray-3.2/requests/$REQUEST_ID/status \
  -H "X-API-Key: $COMFY_API_KEY"

# 3. 수집. 모델의 원본 출력과 함께 200, 아직 실행 중이면 상태 본문과 함께 202.
curl https://api.comfy.org/v2/models/luma_2/ray-3.2/requests/$REQUEST_ID \
  -H "X-API-Key: $COMFY_API_KEY"
```

## 스키마

### 입력

**aspect\_ratio** `string`

출력 가로세로 비율입니다. ray-3.2 비디오 모델은 9:16, 3:4, 1:1, 4:3, 16:9, 21:9 하위 집합을 지원합니다.

가능한 값: `3:1`, `2:1`, `21:9`, `16:9`, `3:2`, `4:3`, `1:1`, `3:4`, `2:3`, `9:16`, `1:2`, `1:3`

**image\_ref** `object[]`

스타일/콘텐츠 가이드를 위한 참조 이미지입니다. type이 'image'인 경우 최대 9개, 'image\_edit'인 경우 최대 8개입니다.

**image\_ref\[].data** `string`

Base64로 인코딩된 이미지 또는 비디오 데이터

**image\_ref\[].generation\_id** `string`

소스로 재사용할 이전에 완료된 생성의 UUID입니다. ray-3.2 video\_edit / video\_reframe에서 사용됩니다.

**image\_ref\[].media\_type** `string`

MIME 타입입니다. data와 함께 필수이며, 비디오 소스의 경우 url과도 함께 필수입니다(예: video\_edit / video\_reframe에서 video/mp4).

**image\_ref\[].url** `string`

공개적으로 접근 가능한 이미지 또는 비디오 URL

**model** `string`

사용할 모델입니다. 이미지 생성에는 uni-1 / uni-1-max, 비디오 생성, 편집 및 리프레이밍에는 ray-3.2를 사용합니다.

**output\_format** `string`

출력 이미지 형식

가능한 값: `png`, `jpeg`

**prompt** `string` *required*

텍스트 프롬프트

**source** `object`

이미지 또는 비디오에 대한 참조입니다. 스타일/콘텐츠 가이드, 가이드 생성, video-edit/video-reframe 소스 및 가이드 키프레임에 사용됩니다. generation\_id, url, data 중 정확히 하나를 제공하세요.

**source.data** `string`

Base64로 인코딩된 이미지 또는 비디오 데이터

**source.generation\_id** `string`

소스로 재사용할 이전에 완료된 생성의 UUID입니다. ray-3.2 video\_edit / video\_reframe에서 사용됩니다.

**source.media\_type** `string`

MIME 타입입니다. data와 함께 필수이며, 비디오 소스의 경우 url과도 함께 필수입니다(예: video\_edit / video\_reframe에서 video/mp4).

**source.url** `string`

공개적으로 접근 가능한 이미지 또는 비디오 URL

**style** `string`

스타일 프리셋

가능한 값: `auto`, `manga`

**type** `string`

수행할 생성 유형입니다. image/image\_edit는 uni-1 / uni-1-max 모델에서 생성되며, video/video\_edit/video\_reframe은 ray-3.2 모델에서 생성됩니다.

가능한 값: `image`, `image_edit`, `video`, `video_edit`, `video_reframe`

**video** `object`

ray-3.2의 비디오 출력 설정입니다. 여기에서는 검증 및 과금에 영향을 주는 필드만 모델링됩니다. 추가 필드(편집 제어, source\_position)는 수정 없이 Luma로 전달됩니다.

**video.duration** `string`

ray-3.2 video / video\_edit의 클립 재생 시간입니다. 기본값은 5s입니다. HDR 생성(type video)은 5s로 제한됩니다.

가능한 값: `5s`, `10s`

**video.end\_frame** `object`

이미지 또는 비디오에 대한 참조입니다. 스타일/콘텐츠 가이드, 가이드 생성, video-edit/video-reframe 소스 및 가이드 키프레임에 사용됩니다. generation\_id, url, data 중 정확히 하나를 제공하세요.

**video.end\_frame.data** `string`

Base64로 인코딩된 이미지 또는 비디오 데이터

**video.end\_frame.generation\_id** `string`

소스로 재사용할 이전에 완료된 생성의 UUID입니다. ray-3.2 video\_edit / video\_reframe에서 사용됩니다.

**video.end\_frame.media\_type** `string`

MIME 타입입니다. data와 함께 필수이며, 비디오 소스의 경우 url과도 함께 필수입니다(예: video\_edit / video\_reframe에서 video/mp4).

**video.end\_frame.url** `string`

공개적으로 접근 가능한 이미지 또는 비디오 URL

**video.exr\_export** `boolean`

아직 사용할 수 없습니다: Luma가 EXR 제공을 시작할 때까지 `exr_export=true` 요청은 400으로 거부됩니다. 향후 MP4와 함께 EXR 파일을 내보냅니다(hdr가 true여야 함). video\_reframe에서는 거부됩니다.

**video.hdr** `boolean`

HDR로 렌더링합니다. 720p/1080p가 필요합니다. video\_reframe에서는 거부됩니다.

**video.keyframe\_indexes** `integer[]`

`keyframes`의 출력 프레임 위치이며 길이가 같아야 합니다. 5s의 경우 0–120, 10s의 경우 0–240입니다. 수정 없이 전달됩니다.

**video.keyframes** `object[]`

가이드 프레임 이미지(1–64)이며 start\_frame/end\_frame과 상호 배타적입니다. 요청된 재생 시간을 기준으로 과금되며, keyframes 요청은 단일 키프레임 연장이 아닙니다.

**video.keyframes\[].data** `string`

Base64로 인코딩된 이미지 또는 비디오 데이터

**video.keyframes\[].generation\_id** `string`

소스로 재사용할 이전에 완료된 생성의 UUID입니다. ray-3.2 video\_edit / video\_reframe에서 사용됩니다.

**video.keyframes\[].media\_type** `string`

MIME 타입입니다. data와 함께 필수이며, 비디오 소스의 경우 url과도 함께 필수입니다(예: video\_edit / video\_reframe에서 video/mp4).

**video.keyframes\[].url** `string`

공개적으로 접근 가능한 이미지 또는 비디오 URL

**video.loop** `boolean`

생성된 클립을 반복합니다. 생성 시에만 가능합니다(type video).

**video.resolution** `string`

ray-3.2 비디오의 출력 해상도입니다. 기본값은 720p입니다. 360p는 초안 등급입니다. HDR에는 720p 또는 1080p가 필요합니다.

가능한 값: `360p`, `540p`, `720p`, `1080p`

**video.start\_frame** `object`

이미지 또는 비디오에 대한 참조입니다. 스타일/콘텐츠 가이드, 가이드 생성, video-edit/video-reframe 소스 및 가이드 키프레임에 사용됩니다. generation\_id, url, data 중 정확히 하나를 제공하세요.

**video.start\_frame.data** `string`

Base64로 인코딩된 이미지 또는 비디오 데이터

**video.start\_frame.generation\_id** `string`

소스로 재사용할 이전 완료된 생성의 UUID입니다. ray-3.2 video\_edit / video\_reframe에서 사용됩니다.

**video.start\_frame.media\_type** `string`

MIME 유형. data와 함께 필수입니다 (비디오 소스의 경우 url과도 함께, 예: video\_edit / video\_reframe에서 video/mp4).

**video.start\_frame.url** `string`

공개적으로 접근 가능한 이미지 또는 비디오 URL

**web\_search** `boolean`

웹 검색 그라운딩 활성화

Router가 `GET /v2/models/luma_2/ray-3.2/openapi.json`에서 제공하는 스키마에서 생성되었으며, 이는 요청이 공급자에 도달하기 전에 호출을 검증하는 동일한 문서입니다.

### 출력

**created\_at** `string`

생성 타임스탬프

**failure\_code** `string`

프로그래밍 방식으로 처리할 수 있는 기계 판독 가능 실패 코드

가능한 값: `content_moderated`, `generation_failed`, `budget_exhausted`, `output_not_found`

**failure\_reason** `string`

사람이 읽을 수 있는 실패 설명으로, FAILED 상태의 생성에서만 채워집니다. 성공한 생성에서는 `null`입니다.

**id** `string`

생성 식별자

**model** `string`

사용된 모델

**output** `object[]`

생성된 출력 항목

**output\[].type** `string`

미디어 유형 (예: 이미지)

**output\[].url** `string`

미리 서명된 URL (1시간 후 만료)

**state** `string`

생성의 현재 상태

가능한 값: `queued`, `processing`, `completed`, `failed`

**type** `string`

수행할 생성의 종류입니다. image/image\_edit는 uni-1 / uni-1-max 모델에서, video/video\_edit/video\_reframe은 ray-3.2 모델에서 생성됩니다.

가능한 값: `image`, `image_edit`, `video`, `video_edit`, `video_reframe`

## 예제

### 입력

```json theme={null}
{
  "prompt": "a paper boat drifting across a plain white background",
  "type": "video",
  "video": {
    "duration": "5s",
    "resolution": "360p"
  }
}
```

### 출력

```json theme={null}
{
  "created_at": "2027-01-01T00:00:00Z",
  "failure_code": null,
  "failure_reason": null,
  "id": "gen-luma-agents-ray32-9c1f3a0e7d52",
  "model": "ray-3.2",
  "output": [
    {
      "type": "video",
      "url": "https://example.invalid/luma_2/ray-3.2/generated.mp4"
    }
  ],
  "state": "completed",
  "type": "video"
}
```

## 배포 전 확인

SDK는 `Idempotency-Key`를 생성하고 자동 재시도에 재사용합니다. 수동으로 재시도할 때는 원본 키를 재사용하세요. Router는 연결을 최대 10분간 유지할 수 있습니다.

요청이 실패하면 Router는 그 이유를 설명하는 `X-Comfy-Error-Type` 응답 헤더를 보냅니다. `422`는 Router가 공급자를 호출하기 전에 입력을 거부했음을 의미하고, `413`은 요청 본문이 Router가 허용하는 크기보다 컸음을 의미합니다. [결과 URL이 만료](https://docs.comfy.org/ko/development/comfy-router/reference.md#결과-에셋)될 수 있으므로 생성된 에셋은 즉시 다운로드하세요.

위의 필드 설명에 명시된 크기 제한은 해당 필드에 대한 공급자 자체의 한도이며, 공급자 사양에서 인용한 것입니다. Router는 전체 요청 본문에 별도의 상한을 적용하며, base64로 인코딩된 미디어도 여기에 포함됩니다. [요청 본문 크기](https://docs.comfy.org/ko/development/comfy-router/limitations.md)를 참고하세요.

이 페이지는 Comfy Router를 통해 호출하는 하나의 파트너 모델을 설명합니다. 동일한 `comfy-sdk` / `@comfyorg/sdk` 패키지에는 Comfy Cloud에서 전체 ComfyUI 워크플로 그래프를 실행하기 위한 두 번째 클라이언트도 포함되어 있습니다: `Comfy(api_key=...)` / `new Comfy({ apiKey })`, 그리고 `client.workflows`, `client.assets`, `client.jobs`가 있습니다. [Comfy SDKs](https://docs.comfy.org/ko/development/api-development/sdks.md)를 참조하세요.

> **[헤더](https://docs.comfy.org/ko/development/comfy-router/headers.md)**
>
> 인증, 멱등성, 요청 ID, 오류 분류, 재시도 간격, 지출 한도.

> **[Router API 사용](https://docs.comfy.org/ko/development/comfy-router/api.md)**
>
> 모델 검색, 검증 오류, 재시도, 과금.

> **[제한 사항](https://docs.comfy.org/ko/development/comfy-router/limitations.md)**
>
> Router가 현재 지원하지 않는 기능과 대신 사용할 방법.


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