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

Quick start

Create a key at 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: 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 snippets above are the shortest working call. Three things are the same for every model and are documented once on the Comfy Router headers page: send an Idempotency-Key on every paid call and reuse it when you retry, expect the connection to be held up to Router’s 10 minute deadline, and keep X-Comfy-Request-Id from every response. The SDKs do all three for you; the cURL tab does none of them. On failure, X-Comfy-Error-Type names the bucket, and a 422 means the body failed the model’s schema and was never billed.

Headers

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

Quick Start

Typed error handling in Python and TypeScript, reading the 422, walking the catalog.

Limitations

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