Generate high-quality AI images using Kling v2.1 Image with 4 reference modes for flexible image generation.

Model

kuaishou/kling-2.1-image

Parameters

ParameterTypeRequiredDefaultDescription
promptstringYes-Text description of the image to generate
reference_modestringNo"restyle"Reference strategy: "restyle", "portrait", "character", or "elements"
image_urlstringConditional-Source image URL. Required for restyle, portrait, and character modes
aspect_ratiostringNo"1:1""21:9", "16:9", "3:2", "4:3", "1:1", "3:4", "2:3", "9:16"
fidelityfloatNo0.5How closely to follow the reference image (0.0–1.0)
human_fidelityfloatNo0.65Face similarity preservation strength (0.0–1.0, portrait mode only)
elementsstring[]Conditional-Element image/video URLs (2–4 required for elements mode)
scene_urlstringNo-Background scene image URL (elements mode only)
style_urlstringNo-Style reference image URL (elements mode only)

Mode Requirements

  • restyle — requires image_url. Uses fidelity to control reference adherence
  • portrait — requires image_url. Uses fidelity and human_fidelity for face control
  • character — requires image_url. Uses fidelity only
  • elements — requires 2–4 elements URLs. Optionally accepts scene_url and style_url

Example - Restyle Mode

curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "kuaishou/kling-2.1-image",
    "input": {
      "prompt": "Transform into an oil painting with vivid colors",
      "reference_mode": "restyle",
      "image_url": "https://example.com/photo.jpg",
      "fidelity": 0.7,
      "aspect_ratio": "16:9"
    }
  }'

Example - Portrait Mode

curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "kuaishou/kling-2.1-image",
    "input": {
      "prompt": "Professional headshot in a modern office setting",
      "reference_mode": "portrait",
      "image_url": "https://example.com/face.jpg",
      "fidelity": 0.5,
      "human_fidelity": 0.8,
      "aspect_ratio": "1:1"
    }
  }'

Example - Elements Mode

curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "kuaishou/kling-2.1-image",
    "input": {
      "prompt": "Two characters standing in a futuristic city",
      "reference_mode": "elements",
      "elements": [
        "https://example.com/character1.jpg",
        "https://example.com/character2.jpg"
      ],
      "scene_url": "https://example.com/city-bg.jpg",
      "style_url": "https://example.com/cyberpunk-style.jpg",
      "aspect_ratio": "16:9"
    }
  }'

Response

{
  "code": 200,
  "success": true,
  "data": {
    "task_id": "abc123def456",
    "status": "pending"
  }
}