All models
OpenAI
Image
Available
GPT-4o 4o Image
This is the new version of the API documentation; for the old version of the API, please see https://docs.kie.ai/old-model/4o-image-api/generate-4-o-image. Create a new 4o Image generation task. Generated images are stored for 14 days, after which they expire.
Text to Image
From 60 credits (≈ ₹60.00) per request.
Parameters
| Parameter | Type | Description |
|---|---|---|
prompt |
string | (Optional) Text prompt that conveys the creative idea you want the 4o model to render. Required if neither `files_url` nor `file_url` is supplied. At least one of `prompt` or `files_url` must be provided. |
files_url |
array<string> | (Optional) Up to 5 publicly reachable image URLs to serve as reference or source material. Use this when you want to edit or build upon an existing picture. If you don’t have reliable hosting, upload your images first via our File Upload API quick‑start: https://docs.kie.ai/file-upload-api/quickstart. Supported formats: .jfif, .pjpeg, .jpeg, .pjp, .jpg, .png, .webp. At least one of `prompt` or `files_url` must be provided. |
sizeRequired |
string | (Required) Aspect ratio of the generated image. Must be one of the listed values. one of: "1:1", "3:2", "2:3" |
file_url |
string | (Optional, Deprecated) File URL, such as an image URL. If file_url is provided, 4o image may create based on this image. This parameter will be deprecated in the future, please use files_url instead. format: uri |
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": "gpt-4o-4o-image",
"input": {
"size": "1: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": "gpt-4o-4o-image",
"input": {
"size": "1: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": "gpt-4o-4o-image",
"input": {
"size": "1: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": "gpt-4o-4o-image",
"input": {
"size": "1:1"
}
}
Response
{
"id": "6f1c…",
"object": "task",
"model": "gpt-4o-4o-image",
"status": "succeeded",
"output": {
"files": [
{
"url": "https://…signed…",
"mime": "…",
"size": 0
}
]
},
"estimated_cost": "…",
"charged": "…"
}