Kling AI’s image generation endpoint creates high-quality images from text descriptions, optionally guided by a reference image for character consistency or face preservation. All requests are asynchronous: submit a task and poll for results using the returned task_id. The request format is fully compatible with the official Kling API.
export TOKEN="oh-xxxxxxxxxxxxxxxx"
Authorization: Bearer <TOKEN>
Content-Type: application/json
Endpoints
| Action | Method | Path |
|---|
| Generate images | POST | /kling/v1/images/generations |
| Multi-image reference | POST | /kling/v1/images/multi-image2image |
| Omni image (o1) | POST | /kling/v1/images/omni-image |
| Query task | GET | /kling/v1/images/generations/{task_id} |
Request Parameters
| Parameter | Type | Required | Description |
|---|
model_name | string | No | Model to use (default: kling-v1). See models below. |
prompt | string | Yes | Text description of the image. Max 2500 characters. |
negative_prompt | string | No | Elements to exclude. Not supported in image-to-image mode (when image is set). |
image | string | No | Reference image — HTTPS URL or base64. Enables image-to-image mode. |
image_reference | string | No | Reference type: subject (character features) or face (facial appearance). Required when image is set and kling-v1-5 is used. |
image_fidelity | number | No | How closely to follow the reference image [0, 1]. |
human_fidelity | number | No | Face similarity strength when image_reference: face[0, 1]. |
resolution | string | No | Output resolution: 1k (standard) or 2k (high-definition). Default: 1k. |
n | integer | No | Number of images to generate [1, 9]. Default: 1. |
aspect_ratio | string | No | Aspect ratio — see options below. Default: 16:9. |
watermark_info | object | No | Watermark settings. |
callback_url | string | No | Webhook URL for completion notifications. |
external_task_id | string | No | Your own task ID for idempotency and tracking. |
Aspect Ratio Options
16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9
Supported Models
| Model | Capabilities |
|---|
kling-v1 | Text-to-image, image-to-image |
kling-v1-5 | Text-to-image, image-to-image with subject/face reference |
kling-v2 | Text-to-image, multi-image reference |
kling-v2-new | Style transfer (image-to-image) |
kling-v2-1 | Text-to-image, multi-image reference |
kling-image-o1 | Omni image generation |
When using kling-v1-5 with image set, you must also set image_reference to either subject or face. Other models do not support image_reference.
Examples
Text-to-Image
Generate a single high-resolution image from a text prompt:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v1",
"prompt": "A beautiful sunset over the ocean, vibrant colors, photorealistic, high detail",
"resolution": "2k",
"n": 1,
"aspect_ratio": "16:9"
}'
Character Reference (Subject)
Use a reference image to preserve a character’s visual appearance:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v1-5",
"prompt": "The character holding a glowing magic wand in an enchanted forest",
"image": "https://example.com/character-reference.jpg",
"image_reference": "subject",
"image_fidelity": 0.8,
"resolution": "2k",
"aspect_ratio": "3:4"
}'
Face Reference
Generate a portrait that preserves facial features from a reference photo:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v1-5",
"prompt": "A professional business headshot portrait, studio lighting, clean background",
"image": "https://example.com/face-photo.jpg",
"image_reference": "face",
"human_fidelity": 0.9,
"resolution": "2k",
"aspect_ratio": "1:1"
}'
Batch Generation
Generate multiple image variations from a single prompt:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v2",
"prompt": "Abstract colorful digital artwork, modern minimalist style",
"n": 4,
"resolution": "1k",
"aspect_ratio": "1:1"
}'
Style Transfer (kling-v2-new)
Apply the visual style of a reference image to a new composition:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v2-new",
"prompt": "A futuristic cityscape at night with neon reflections",
"image": "https://example.com/style-reference.jpg",
"resolution": "2k",
"aspect_ratio": "16:9"
}'
Omni Image (kling-image-o1)
Use the Omni image model for complex, instruction-following generation:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/images/omni-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-image-o1",
"prompt": "A vintage bicycle leaning against a cobblestone wall in a European alley, afternoon sunlight, film grain",
"resolution": "2k",
"aspect_ratio": "3:2"
}'
Responses
Task Created
{
"code": 0,
"message": "success",
"request_id": "req_1735558800_img123",
"data": {
"task_id": "task_01JGHP...",
"task_status": "submitted",
"created_at": 1735558800000,
"updated_at": 1735558800000
}
}
Task Succeeded
When you poll and task_status is succeed:
{
"code": 0,
"message": "success",
"data": {
"task_id": "task_01JGHP...",
"task_status": "succeed",
"task_result": {
"images": [
{"index": 0, "url": "https://cdn.example.com/image-0.jpg"},
{"index": 1, "url": "https://cdn.example.com/image-1.jpg"}
]
}
}
}
Polling for Results
Query a task using either task_id or the Fhddos platform_id:
# Single task
curl "https://aiapi.fhddos.com/kling/v1/images/generations/$TASK_ID" \
-H "Authorization: Bearer $TOKEN"
# Task list
curl "https://aiapi.fhddos.com/kling/v1/images/generations?pageNum=1&pageSize=30" \
-H "Authorization: Bearer $TOKEN"
For the full response schema across all task states, see Task Query.
Multi-Image Reference
To fuse elements from multiple reference images, use the dedicated endpoint:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/images/multi-image2image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v2-1",
"prompt": "Combine these visual styles into a cohesive product photo",
"images": [
"https://example.com/ref1.jpg",
"https://example.com/ref2.jpg"
],
"resolution": "2k",
"aspect_ratio": "1:1"
}'
Refer to the official Kling documentation for the exact field schema for multi-image2image.
Constraints Summary
prompt must be 2500 characters or fewer
negative_prompt is not supported in image-to-image mode (when image is provided)
image_reference is required when using kling-v1-5 with an image — and is not supported on other models
n range is 1–9