Documentation Index
Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Grok Image is an xAI image model for text-to-image generation and single-reference image-to-image workflows. Use this page when you are ready to call the API after trying the model in the APIXO playground.| Capability | Value |
|---|---|
| Model ID | grok-image |
| Modes | text-to-image, image-to-image |
| Prompt length | 1-5000 characters |
| Reference images | 1 URL for image-to-image |
| Aspect ratios | 1:1, 3:2, 2:3 for text-to-image |
| Output | Image URL in resultJson.resultUrls |
Endpoint and authentication
Base URL:| Method | Endpoint | Purpose |
|---|---|---|
POST | /generateTask/grok-image | Submit a generation task |
GET | /statusTask/grok-image?taskId={taskId} | Poll task status and retrieve results |
Copy-paste async quickstart
This minimal request submits a text-to-image task and returns ataskId.
taskId; you need it to poll for the final result.
Poll for result
resultJson after state becomes success:
Request body
Text-to-image
Image-to-image
Parameters
Result delivery mode. Omit this field or use
async for polling with statusTask, or use callback for webhook delivery.Required when
request_type is callback. Provide a public HTTPS URL that can receive the final task payload. See Webhooks.Grok Image input parameters.
Response format
Submit task response
POST /generateTask/grok-image returns a task ID when the task is accepted:
API status code.
200 means the task was accepted.Human-readable status message.
Unique task identifier used with the status endpoint.
Status response fields
Unique task identifier.
Current task state:
pending, processing, success, or failed.JSON string containing the generated image URLs. Present when
state is success.Machine-readable failure code. Present when
state is failed.Human-readable failure message. Present when
state is failed.Task creation timestamp in Unix milliseconds.
Task completion timestamp in Unix milliseconds. Present after completion.
Processing duration in milliseconds. Present after completion.
Webhook callback mode
Use callback mode when your backend should receive the final result automatically instead of polling.Billing
Grok Image is billed per generated image. Both supported modes use the same APIXO public price.| Mode | APIXO price |
|---|---|
text-to-image | $0.10 / image |
image-to-image | $0.10 / image |
Latency and polling
Actual latency may vary by prompt complexity, reference image access, provider queue load, and result storage time.| Mode | Typical generation time | Recommended first poll | Poll interval |
|---|---|---|---|
text-to-image | About 25s on average | 15s after task creation | 3s |
image-to-image | About 25s on average | 15s after task creation | 3s |
429, slow down requests and retry with backoff. For account-level details, see System APIs.
Errors and troubleshooting
HTTP errors
| Code | Meaning | What to do |
|---|---|---|
400 | Invalid request body, missing mode, missing prompt, invalid aspect_ratio, malformed image_urls, or inaccessible image URL | Fix the request before retrying |
401 | Missing or invalid API key | Check the Authorization header |
402 | Insufficient balance or quota | Add balance or switch account/key |
429 | Rate limit or concurrency limit reached | Retry with exponential backoff |
500 | Internal error or unknown task failure | Retry with backoff or contact support if it persists |
502 | Upstream provider or network error | Retry with backoff |
Validation notes
| Parameter | Backend behavior |
|---|---|
input.mode | Required for routing. Must be text-to-image or image-to-image. |
input.prompt | Required string. Must not be empty and must not exceed 5000 characters. |
input.aspect_ratio | Optional for text-to-image. Must be 1:1, 3:2, or 2:3 if provided. Defaults to 1:1 for text-to-image. |
input.image_urls | Required and non-empty for image-to-image. Must be an array of strings and cannot contain more than 1 image. |
Task failure codes
failCode is generated from APIXO’s mapped provider error. Common values include:
| Fail code | Meaning | What to do |
|---|---|---|
PromptInvalid | Prompt was invalid or rejected by the provider | Rewrite the prompt and retry |
SensitiveContent | Prompt or input/output content was rejected by safety checks | Change the prompt or reference image |
ImageFormatIncorrect | Reference image format could not be processed | Use a public, direct image URL in a common image format |
RateLimited | Provider rate limit was reached | Retry with exponential backoff |
Timeout | Provider timeout | Retry later or use callback mode |
Unknown error | Provider returned an unmapped failure | Retry with backoff or contact support with the taskId |