> ## 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로 Aleph 2 사용하기

> Comfy Router를 통해 runway/aleph2를 호출합니다: 엔드포인트, 요청 형태, 그리고 Router가 반환하는 응답.

Runway가 제공하고 Comfy Router가 서비스하는 `runway/aleph2`의 API 레퍼런스입니다.

## 빠른 시작

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

**Model ID:** `runway/aleph2`

**Endpoint:** `POST https://api.comfy.org/v2/models/runway/aleph2`

<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(
              "runway/aleph2",
              {
                  "promptText": "recolor the scene in cool blue tones",
                  "videoUri": "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
              },
          )

      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("runway/aleph2", {
        promptText: "recolor the scene in cool blue tones",
        videoUri: "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/runway/aleph2 \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"promptText\": \"recolor the scene in cool blue tones\", \"videoUri\": \"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4\"}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Queue and collect later">
    <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(
              "runway/aleph2",
              {
                  "promptText": "recolor the scene in cool blue tones",
                  "videoUri": "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
              },
          )
          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("runway/aleph2", {
        promptText: "recolor the scene in cool blue tones",
        videoUri: "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
      });
      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/runway/aleph2/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"promptText\": \"recolor the scene in cool blue tones\", \"videoUri\": \"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4\"}"

      # 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/runway/aleph2/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/runway/aleph2/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## 스키마

### 입력

<ParamField body="contentModeration" type="object">
  콘텐츠 검열 시스템의 동작에 영향을 주는 설정입니다.
</ParamField>

<ParamField body="contentModeration.publicFigureThreshold" type="string">
  `low`로 설정하면 콘텐츠 검열 시스템이 인식 가능한 공인(public figure)이 포함된 생성을 차단하는 데 덜 엄격해집니다.

  가능한 값: `auto`, `low`
</ParamField>

<ParamField body="keyframes" type="object[]">
  입력 비디오의 특정 지점에 배치되는 시간 지정 가이드 이미지입니다. 최대 5개의 키프레임.

  가능한 값: `auto`, `low`
</ParamField>

<ParamField body="model" type="string">
  생성에 사용할 모델입니다. Comfy Router 경로 `POST /v2/models/runway/{model}`에서는 이 필드가 경로에서 제공되므로 반드시 전송해서는 안 됩니다. v1 `POST /proxy/runway/video_to_video` 경로에서는 필수이며 RunwayVideoToVideoModelEnum(`aleph2`)으로 제한됩니다.
</ParamField>

<ParamField body="promptImage" type="object[]">
  비디오의 특정 지점에서 편집을 가이드하기 위한 최대 5개의 이미지 키프레임 목록입니다.
</ParamField>

<ParamField body="promptImage[].position" type="`first`, `last` | object" required>
  이미지가 적용되어야 할 출력 비디오 내 위치입니다.
</ParamField>

<ParamField body="promptImage[].uri" type="string" required>
  인코딩된 이미지를 포함하는 HTTPS URL, Runway URI 또는 데이터 URI입니다.
</ParamField>

<ParamField body="promptText" type="string" required>
  출력에 무엇이 나타나야 하는지 설명하는 1000자 이하의 비어 있지 않은 문자열입니다.
</ParamField>

<ParamField body="seed" type="integer">
  생성을 위한 무작위 시드입니다.

  범위: `0` \~ `4294967295`

  형식: `int64`
</ParamField>

<ParamField body="videoUri" type="string" required>
  편집할 입력 비디오입니다(HTTPS URL, Runway upload URI 또는 데이터 URI). 30초 이하여야 합니다.
</ParamField>

`GET /v2/models/runway/aleph2/openapi.json`에서 Router가 제공하는 스키마에서 생성되었으며, 이는 요청이 공급자에게 도달하기 전에 호출을 검증하는 데 사용하는 것과 동일한 문서입니다.

### 출력

<ResponseField name="createdAt" type="string (date-time)" required>
  작업 생성 타임스탬프

  형식: `date-time`
</ResponseField>

<ResponseField name="id" type="string" required>
  작업 ID
</ResponseField>

<ResponseField name="output" type="string[]">
  완료된 생성물의 에셋 URL입니다. `runway/gen4_turbo`와 `runway/aleph2`의 경우 각 요소는 VIDEO URL입니다. 작업이 성공적으로 종료되면 제공되며, 이 목록이 곧 결과입니다.
</ResponseField>

<ResponseField name="progress" type="number">
  작업의 진행률을 나타내는 0과 1 사이의 실수 값입니다. 상태가 RUNNING인 경우에만 사용할 수 있습니다.

  범위: `0` \~ `1`

  형식: `float`
</ResponseField>

<ResponseField name="status" type="string" required>
  Runway 작업의 가능한 상태입니다.

  가능한 값: `SUCCEEDED`, `RUNNING`, `FAILED`, `PENDING`, `CANCELLED`, `THROTTLED`
</ResponseField>

## 예제

### 입력

```json theme={null}
{
  "promptText": "recolor the scene in cool blue tones",
  "videoUri": "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4"
}
```

### 출력

```json theme={null}
{
  "createdAt": "2027-01-01T00:00:00Z",
  "id": "5f7c1b28-9a03-4e61-8d2f-1b2c3d4e5f60",
  "output": [
    "https://example.invalid/runway/gen4_turbo/generated.mp4"
  ],
  "status": "SUCCEEDED"
}
```

## 배포 전 확인

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

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

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

<CardGroup cols={3}>
  <Card title="헤더" icon="list" href="/ko/development/comfy-router/headers">
    인증, 멱등성, 요청 ID, 오류 분류, 재시도 간격, 지출 한도.
  </Card>

  <Card title="Router API 사용" icon="code" href="/ko/development/comfy-router/api">
    모델 검색, 검증 오류, 재시도, 과금.
  </Card>

  <Card title="제한 사항" icon="triangle-exclamation" href="/ko/development/comfy-router/limitations">
    Router가 현재 지원하지 않는 기능과 대신 사용할 방법.
  </Card>
</CardGroup>
