ApiframeApiframe Docs
Image GenerationKling Image

Kling Image

Kling's image generation model with text-to-image and image editing via reference images.

Use in Apiframe Studio

POST /v2/images/generatemodel: "kling-image"

Kling Image generates high-quality images from text prompts with support for reference image editing, negative prompts, and multiple aspect ratios.

See Image Generation overview for common request fields, response format, and error codes.

Model-specific parameters

ParameterTypeDescription
klingImageParams.model_namestringKling model variant. Values: "kling-v1", "kling-v1-5", "kling-v2" (default "kling-v1")
klingImageParams.negative_promptstringNegative text prompt, max 2500 characters
klingImageParams.imagestringReference image URL for image-to-image generation
klingImageParams.image_fidelitynumberReference image strength, 0–1
klingImageParams.nintegerNumber of images to generate (1–4, default 1)
klingImageParams.aspect_ratiostringAspect ratio. Values: "16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3"

Credit cost

Credits are 2 per image, multiplied by n (the number of images requested).

nCredits
12
24
36
48

Code examples

curl -X POST https://api.apiframe.ai/v2/images/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A serene Japanese garden with cherry blossoms falling into a koi pond",
    "model": "kling-image",
    "klingImageParams": {
      "aspect_ratio": "16:9",
      "n": 1
    }
  }'
import requests

response = requests.post(
    "https://api.apiframe.ai/v2/images/generate",
    headers={
        "X-API-Key": "afk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "A serene Japanese garden with cherry blossoms falling into a koi pond",
        "model": "kling-image",
        "klingImageParams": {
            "aspect_ratio": "16:9",
            "n": 1,
        },
    },
)
print(response.json())
const response = await fetch("https://api.apiframe.ai/v2/images/generate", {
  method: "POST",
  headers: {
    "X-API-Key": "afk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    prompt: "A serene Japanese garden with cherry blossoms falling into a koi pond",
    model: "kling-image",
    klingImageParams: { aspect_ratio: "16:9", n: 1 },
  }),
});
console.log(await response.json());

Try it

POST/v2/images/generateTry it

On this page