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

# Use Kling 3.0 Turbo with Comfy Router

> Call kling/kling-3.0-turbo through Comfy Router: endpoint, request shape and the response Router returns.

API Reference for `kling/kling-3.0-turbo`, served by Comfy Router from Kling.

## Quick start

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

**Model ID:** `kling/kling-3.0-turbo`

**Endpoint:** `POST https://api.comfy.org/v2/models/kling/kling-3.0-turbo`

<Tabs defaultTabIndex={1}>
  <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(
              "kling/kling-3.0-turbo",
              {
                  "prompt": "A neon-lit alley in the rain, slow dolly forward.",
                  "settings": {
                      "aspect_ratio": "16:9",
                      "duration": 5,
                      "resolution": "1080p",
                  },
              },
          )

      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("kling/kling-3.0-turbo", {
        prompt: "A neon-lit alley in the rain, slow dolly forward.",
        settings: {
          aspect_ratio: "16:9",
          duration: 5,
          resolution: "1080p",
        },
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/kling/kling-3.0-turbo \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"prompt\": \"A neon-lit alley in the rain, slow dolly forward.\", \"settings\": {\"aspect_ratio\":\"16:9\",\"duration\":5,\"resolution\":\"1080p\"}}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Queue and collect later">
    The same body, sent to `POST https://api.comfy.org/v2/models/kling/kling-3.0-turbo/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}
      import asyncio
      from comfy_sdk import AsyncComfy

      # Reads COMFY_API_KEY from the environment.
      # Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      async def main():
          async with AsyncComfy() as client:
              handle = await client.models.submit(
                  "kling/kling-3.0-turbo",
                  {
                      "prompt": "A neon-lit alley in the rain, slow dolly forward.",
                      "settings": {
                          "aspect_ratio": "16:9",
                          "duration": 5,
                          "resolution": "1080p",
                      },
                  },
              )
              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.
              async 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 = await handle.get()

          print(result)

      asyncio.run(main())
      ```

      ```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("kling/kling-3.0-turbo", {
        prompt: "A neon-lit alley in the rain, slow dolly forward.",
        settings: {
          aspect_ratio: "16:9",
          duration: 5,
          resolution: "1080p",
        },
      });
      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/kling/kling-3.0-turbo/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"prompt\": \"A neon-lit alley in the rain, slow dolly forward.\", \"settings\": {\"aspect_ratio\":\"16:9\",\"duration\":5,\"resolution\":\"1080p\"}}"

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

## Serving providers

This model is served by Comfy Router directly unless the request names another provider. The providers below serve it too, on the same endpoint and with the same model ID, selected with the `model_provider` query parameter.

* **Comfy** (default): `POST https://api.comfy.org/v2/models/kling/kling-3.0-turbo`
* **Higgsfield**, as `higgsfield/higgsfield-kling-3-turbo`: `POST https://api.comfy.org/v2/models/kling/kling-3.0-turbo?model_provider=higgsfield`

`strict_mode` defaults to false, so Router translates the native request body documented on this page into the provider's own schema and translates the response back. See [`model_provider`, `strict_mode` and `fallback_provider`](/development/comfy-router/reference#post-v2modelsprovidermodel) in the API reference, and [Serving providers](/development/comfy-router/providers) for every model routed this way.

## Schema

### Input

<ParamField body="aspect_ratio" type="string" default="&#x22;16:9&#x22;">
  Video aspect ratio

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

<ParamField body="duration" type="string" default="&#x22;5&#x22;">
  Video length in seconds

  Possible values: `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`
</ParamField>

<ParamField body="options" type="object">
  General configuration such as callback address and watermark options.
</ParamField>

<ParamField body="options.callback_url" type="string">
  Callback notification URL for task results. The server notifies when the task status changes.
</ParamField>

<ParamField body="options.external_task_id" type="string">
  Customized Task ID. Does not overwrite the system-generated task ID but can be used for queries. Must be unique within a single user account.
</ParamField>

<ParamField body="options.watermark_info" type="object">
  Whether to generate watermarked results simultaneously. Custom watermarks are not supported.
</ParamField>

<ParamField body="options.watermark_info.enabled" type="boolean">
  true means generate watermarked result, false means do not generate. Default false.
</ParamField>

<ParamField body="prompt" type="string" required>
  Prompt that may include both positive and negative descriptions. Recommended length under 2500 characters. Multi-shot videos use the format "shot n, m, words; shot n, m, words;".
</ParamField>

<ParamField body="settings" type="object">
  Output configuration such as resolution, aspect ratio and duration.
</ParamField>

<ParamField body="settings.aspect_ratio" type="string">
  Aspect ratio (width:height) of the generated frames. One of "16:9", "9:16" or "1:1". Default "16:9".

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

<ParamField body="settings.duration" type="integer">
  Video length in seconds. Supported values 3 through 15. Default 5.

  Range: `3` to `15`
</ParamField>

<ParamField body="settings.resolution" type="string">
  Clarity of the generated video. One of "720p" or "1080p". Default "720p".

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

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

### Output

<ResponseField name="code" type="integer">
  Error code. 0 indicates success.
</ResponseField>

<ResponseField name="data" type="object[]">
  Tasks matching the query.
</ResponseField>

<ResponseField name="data[].billing" type="object[]">
  Billing details for the task.
</ResponseField>

<ResponseField name="data[].billing[].amount" type="string">
  Consumption amount, accurate to two decimal places.
</ResponseField>

<ResponseField name="data[].billing[].charge_type" type="string">
  Consumption account type. "cash" for balance, "unit" for a resource package.
</ResponseField>

<ResponseField name="data[].billing[].package_type" type="string">
  Consumable resource bundle type (only present when charge\_type is "unit"). One of "video", "image" or "audio".
</ResponseField>

<ResponseField name="data[].create_time" type="integer">
  Task creation time. Unix timestamp in milliseconds.

  Format: `int64`
</ResponseField>

<ResponseField name="data[].external_id" type="string">
  The custom task ID for this task, if any.
</ResponseField>

<ResponseField name="data[].id" type="string">
  The task ID.
</ResponseField>

<ResponseField name="data[].message" type="string">
  Task status information, displaying the failure reason when the task fails.
</ResponseField>

<ResponseField name="data[].outputs" type="object[]">
  Generated outputs for the task.
</ResponseField>

<ResponseField name="data[].outputs[].duration" type="string">
  Duration of the generated video in seconds.
</ResponseField>

<ResponseField name="data[].outputs[].group_id" type="string">
  Grouping marker, present only for grouped images.
</ResponseField>

<ResponseField name="data[].outputs[].id" type="string">
  Output ID generated by the system.
</ResponseField>

<ResponseField name="data[].outputs[].mp3_duration" type="string">
  Duration of the generated MP3 audio in seconds.
</ResponseField>

<ResponseField name="data[].outputs[].mp3_url" type="string">
  MP3 URL of the generated audio (hotlink-protected).
</ResponseField>

<ResponseField name="data[].outputs[].name" type="string">
  Name of the generated material.
</ResponseField>

<ResponseField name="data[].outputs[].owned_by" type="string">
  Source of the material. "kling" denotes the official library; numbers are creator IDs.
</ResponseField>

<ResponseField name="data[].outputs[].status" type="string">
  Status of the material. One of "succeeded" or "deleted".
</ResponseField>

<ResponseField name="data[].outputs[].type" type="string">
  Output content type. One of "video", "image", "audio", "voice" or "element".
</ResponseField>

<ResponseField name="data[].outputs[].url" type="string">
  URL of the generated result (hotlink-protected). Cleared after 30 days.
</ResponseField>

<ResponseField name="data[].outputs[].watermark_url" type="string">
  URL of the watermarked result (hotlink-protected).
</ResponseField>

<ResponseField name="data[].outputs[].wav_duration" type="string">
  Duration of the generated WAV audio in seconds.
</ResponseField>

<ResponseField name="data[].outputs[].wav_url" type="string">
  WAV URL of the generated audio (hotlink-protected).
</ResponseField>

<ResponseField name="data[].status" type="string">
  Task status. One of "submitted", "processing", "succeeded" or "failed".
</ResponseField>

<ResponseField name="data[].update_time" type="integer">
  Task update time. Unix timestamp in milliseconds.

  Format: `int64`
</ResponseField>

<ResponseField name="message" type="string">
  Error message.
</ResponseField>

<ResponseField name="request_id" type="string">
  Request ID generated by the system.
</ResponseField>

## Examples

### Input

```json theme={null}
{
  "prompt": "A neon-lit alley in the rain, slow dolly forward.",
  "settings": {
    "aspect_ratio": "16:9",
    "duration": 5,
    "resolution": "1080p"
  }
}
```

### Output

```json theme={null}
{
  "code": 0,
  "data": [
    {
      "create_time": 1798761600000,
      "id": "kling-v2-task-7c8d9e0f1a2b",
      "message": "",
      "outputs": [
        {
          "duration": "5",
          "id": "kling-v2-output-2b1a0f9e8d7c",
          "type": "video",
          "url": "https://example.invalid/kling/kling-3.0-turbo/generated.mp4"
        }
      ],
      "status": "succeeded",
      "update_time": 1798761820000
    }
  ],
  "message": "SUCCEED",
  "request_id": "3d7e5c91-0b42-4f68-9a13-8e2c6d4b0a75"
}
```

## 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, and a `413` means the request body was larger than Router accepts. Download generated assets promptly because [result URLs can expire](/development/comfy-router/reference#result-assets).

Any size limit named in a field description above is the provider's own bound on that field, quoted from the provider's specification. Router applies a separate cap to the whole request body, which base64-encoded media counts against: see [request body size](/development/comfy-router/limitations#request-bodies-are-capped).

This page documents one partner model called through Comfy Router. The same `comfy-sdk` / `@comfyorg/sdk` package also ships a second client, for running a whole ComfyUI workflow graph on Comfy Cloud: `Comfy(api_key=...)` / `new Comfy({ apiKey })`, with `client.workflows`, `client.assets` and `client.jobs`. See [Comfy SDKs](/development/api-development/sdks).

<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>
