Nexus
All models
Kling Image Available

Kling 4.0 Image

Generate images with Kling Image 4.0. One endpoint covers both text-to-image and image-to-image: omit `image_urls` for pure text-to-image, or provide reference images and mention them in `prompt` as `@image_1`, `@image_2` …. Use `mode=series` to generate a coherent set of images.

Text to Image

From 60 credits (≈ ₹60.00) per request.

Parameters

ParameterTypeDescription
promptRequired string Text prompt describing the image to generate (required, max 20000 characters). - When reference images are provided, mention them as `@image_1`, `@image_2` … in the same order as `image_urls`; mention elements as `@name`. Mentioning an image that was not provided returns a parameter error and the task is not created. - To render text in the image, put the text inside quotation marks.
max length 20000
image_urls array<string> Reference images (optional, up to 10). - Omit for pure text-to-image; provide images for image-to-image and mention them in `prompt` as `@image_1`, `@image_2` … in array order. - Must be publicly accessible http/https URLs. Supported formats: jpg, jpeg, png; max 20MB each.
default []
elements array<object> Subjects created for this task only (optional). Mention them in `prompt` as `@name`. - `image_urls` and `elements` together cannot exceed 10 items. - Mentions use longest match: if both `Hero` and `Hero2` are declared, `@Hero2` matches `Hero2`. An English name followed directly by a letter, digit or underscore is not a match; a Chinese name may be followed directly by Chinese text. - Mentioning an undeclared element returns a parameter error and the task is not created.
default []
mode string Generation mode. - `default`: standard generation; `count` can be 1–9. - `series`: generates a coherent set of images (e.g. the same character from morning to night); `count` is required and can be 2–10.
one of: "default", "series" · default "default"
resolution string Output resolution. `2k` / `4k` usually return PNG, `8k` returns JPEG — do not hard-code the file extension.
one of: "2k", "4k", "8k" · default "2k"
aspect_ratio string Aspect ratio of the output image. `auto` lets the model choose based on the prompt and reference images.
one of: "auto", "9:16", "2:3", "3:4", "1:1", "4:3", "3:2", "16:9", "21:9" · default "auto"
count integer Number of images to generate (integer). - `mode=default`: 1–9, defaults to 1. - `mode=series`: **required**, 2–10. The result contains one URL per generated image.
min 1 · max 10 · default 1

What you get back

Files arrive in output.files[] as private links that expire, with their type and size.

Use it from your code

# 1. Create the task
curl https://nexus.promptscenes.in/api/v1/tasks \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "model": "kling-4.0-image",
    "input": {
        "prompt": "A cinematic shot of a lighthouse at dawn",
        "image_urls": [],
        "elements": [],
        "mode": "default",
        "resolution": "2k",
        "aspect_ratio": "auto",
        "count": 1
    },
    "callback_url": "https://your-app.com/webhooks/nexus"
}'

# 2. Poll for the result
curl https://nexus.promptscenes.in/api/v1/tasks/TASK_ID \
  -H "Authorization: Bearer $NEXUS_API_KEY"
import os, time, uuid, requests

API = "https://nexus.promptscenes.in/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['NEXUS_API_KEY']}"}

task = requests.post(
    f"{API}/tasks",
    headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
    json={
        "model": "kling-4.0-image",
        "input": {
            "prompt": "A cinematic shot of a lighthouse at dawn",
            "image_urls": [],
            "elements": [],
            "mode": "default",
            "resolution": "2k",
            "aspect_ratio": "auto",
            "count": 1,
        },
        "callback_url": "https://your-app.com/webhooks/nexus",
    },
).json()

while task["status"] not in ("succeeded", "failed", "cancelled"):
    time.sleep(3)
    task = requests.get(f"{API}/tasks/{task['id']}", headers=HEADERS).json()

print(task["status"], task.get("output"))
const API = "https://nexus.promptscenes.in/api/v1";
const headers = {
  Authorization: `Bearer ${process.env.NEXUS_API_KEY}`,
  "Content-Type": "application/json",
};

let task = await fetch(`${API}/tasks`, {
  method: "POST",
  headers: { ...headers, "Idempotency-Key": crypto.randomUUID() },
  body: JSON.stringify({
      "model": "kling-4.0-image",
      "input": {
          "prompt": "A cinematic shot of a lighthouse at dawn",
          "image_urls": [],
          "elements": [],
          "mode": "default",
          "resolution": "2k",
          "aspect_ratio": "auto",
          "count": 1
      },
      "callback_url": "https://your-app.com/webhooks/nexus"
  }),
}).then((r) => r.json());

while (!["succeeded", "failed", "cancelled"].includes(task.status)) {
  await new Promise((r) => setTimeout(r, 3000));
  task = await fetch(`${API}/tasks/${task.id}`, { headers }).then((r) => r.json());
}
console.log(task.status, task.output);

Request

{
    "model": "kling-4.0-image",
    "input": {
        "prompt": "A cinematic shot of a lighthouse at dawn",
        "image_urls": [],
        "elements": [],
        "mode": "default",
        "resolution": "2k",
        "aspect_ratio": "auto",
        "count": 1
    }
}

Response

{
    "id": "6f1c…",
    "object": "task",
    "model": "kling-4.0-image",
    "status": "succeeded",
    "output": {
        "files": [
            {
                "url": "https://…signed…",
                "mime": "…",
                "size": 0
            }
        ]
    },
    "estimated_cost": "…",
    "charged": "…"
}