Nexus
All models
xAI Image Available

Grok Imagine Text to Image

Text to Image

From 60 credits (≈ ₹60.00) per request.

Parameters

ParameterTypeDescription
promptRequired string Text prompt describing the desired image. Required field. - Should be detailed and specific about the desired visual elements - Describe composition, style, lighting, mood, and other visual details - Maximum length: 5000 characters - Supports English language prompts
aspect_ratioRequired string Required. Aspect ratio of the output image: 2:3, 3:2, 1:1, 16:9, 9:16.
one of: "2:3", "3:2", "1:1", "16:9", "9:16"
nsfw_checker boolean Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model.
enable_pro boolean Controls the request processing strategy. - `false`: Corresponds to **speed mode**. The system prioritizes response time and throughput, suitable for latency-sensitive scenarios. - `true`: Corresponds to **quality mode**. The system prioritizes processing quality and precision, suitable for scenarios requiring higher accuracy.

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": "grok-imagine-text-to-image",
    "input": {
        "prompt": "A cinematic shot of a lighthouse at dawn",
        "aspect_ratio": "2:3"
    },
    "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": "grok-imagine-text-to-image",
        "input": {
            "prompt": "A cinematic shot of a lighthouse at dawn",
            "aspect_ratio": "2:3",
        },
        "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": "grok-imagine-text-to-image",
      "input": {
          "prompt": "A cinematic shot of a lighthouse at dawn",
          "aspect_ratio": "2:3"
      },
      "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": "grok-imagine-text-to-image",
    "input": {
        "prompt": "A cinematic shot of a lighthouse at dawn",
        "aspect_ratio": "2:3"
    }
}

Response

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