Skip to main content
API Reference for kling/kling-image-o1, served by Comfy Router from Kling.

Quick start

Create a key in your Comfy workspace 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: kling/kling-image-o1 Endpoint: POST https://api.comfy.org/v2/models/kling/kling-image-o1

Schema

Input

string
default:"\"auto\""
Aspect ratio of the generated images (width:height). auto is to intelligently generate images based on incoming content.Possible values: 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9, auto
string (uri)
The callback notification address for the result of this task. If configured, the server will actively notify when the task status changes.Format: uri
object[]
Reference Element List based on element ID configuration. The sum of reference elements and reference images shall not exceed 10.
integer
required
Element IDFormat: int64
string
Customized Task ID. Must be unique within a single user account.
object[]
Reference Image List. Supports inputting image Base64 encoding or image URL (ensure accessibility). Supported formats include .jpg/.jpeg/.png. File size cannot exceed 10MB. Width and height dimensions shall not be less than 300px, aspect ratio between 1:2.5 ~ 2.5:1. The sum of reference elements and reference images shall not exceed 10.
string
required
Image Base64 encoding or image URL (ensure accessibility)
string
Model name. Omit it or send null when using Comfy Router; the model is selected by the request path. A supplied name must match that path.
integer
default:"1"
Number of generated images. Value range [1,9].Range: 1 to 9
string
required
Text prompt words, which can include positive and negative descriptions. Must not exceed 2,500 characters. The Omni model can achieve various capabilities through Prompt with elements and images. Specify an image in the format of <<<>>>, such as <<<image_1>>>.
string
default:"\"1k\""
Image generation resolution. 1k is 1K standard, 2k is 2K high-res, 4k is 4K high-res.Possible values: 1k, 2k, 4k
string
default:"\"single\""
Control whether to generate a single image or a series of images.Possible values: single, series
integer
default:"4"
Number of images in a series. Value range [2,9].Range: 2 to 9
Generated from the schema Router serves at GET /v2/models/kling/kling-image-o1/openapi.json, the same document it validates a call against before the request reaches the provider.

Output

integer
Error code
object
integer
Task creation time, Unix timestamp in milliseconds
string
The deduction units of task
string
Task ID
object
string
Customer-defined task ID
object
object[]
integer
Image Number (0-9)
string (uri)
URL for generated imageFormat: uri
string
Whether the result is a single image or a series of imagesPossible values: single, series
object[]
Series images result list
integer
Series-image sequence number
string (uri)
URL for generated imageFormat: uri
string
Task StatusPossible values: submitted, processing, succeed, failed
string
Task status information, displaying the failure reason when the task fails (such as triggering the content risk control of the platform, etc.)
integer
Task update time, Unix timestamp in milliseconds
string
Error message
string
Request ID

Examples

Input

Output

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.

Headers

Authentication, idempotency, request IDs, error buckets, retry pacing, spend limits.

Using the Router API

Model discovery, validation errors, retries, and billing.

Limitations

What Router does not do today, and what to use instead.