xAI
Usage-based pricing
ae_xai
Create up to four images from a text prompt, with your choice of aspect ratio, resolution, and file format.
Usage-based pricing
Pricing
| Condition | Charge |
|---|---|
| image resolution is 1k | 60 AE credits per image, based on actual successfully generated images. |
| image resolution is 2k | 84 AE credits per image, based on actual successfully generated images. |
| image resolution not supplied | 60 AE credits per image, based on actual successfully generated images. |
If no resolution is supplied, 1k pricing applies. Each request generates 1 image by default. Charges depend on the selected resolution and the number of images successfully generated. Aspect ratio, output format, and sync mode are configurable.
Parameters
Optional parameters use the platform defaults when omitted.
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
request_body | object | Yes | No parameter description. | — |
request_body.prompt | string | Yes | Text description of the desired image. | — |
request_body.sync_mode | boolean | No | If `True`, the media will be returned as a data URI and the output data won't be available in the request history. | false |
request_body.num_images | integer | No | Number of images to generate. | 1 |
request_body.resolution | enum (1k | 2k) | No | Resolution of the generated image. `1k` for standard resolution, `2k` for high resolution. | 1k |
request_body.aspect_ratio | enum (2:1 | 20:9 | 19.5:9 | 16:9 | 4:3 | 3:2 | 1:1 | 2:3 | 3:4 | 9:16 | 9:19.5 | 9:20 | 1:2) | No | Aspect ratio of the generated image. | 1:1 |
request_body.output_format | enum (jpeg | png | webp) | No | The format of the generated image. | jpeg |
Invocation example
Copy the request and explore its response example.
POST
/agent-api/v1/tool/executeX-Api-KeySubmit first, then query with the returned task_id until the task completes.
Request coderequest.sh
curl --request POST \
--url 'https://agentearth.ai/agent-api/v1/tool/execute?tool_name=ae_xai' \
--header "X-Api-Key: $AGENTEARTH_API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"params": {
"request_body": {
"aspect_ratio": "9:16",
"num_images": 1,
"output_format": "png",
"prompt": "Vertical 9:16 cinematic still, exterior of a fictional ancient Chinese county yamen at early morning. A weathered dark wooden horizontal plaque hangs above a grey stone doorway, mounted visibly three degrees off level, its surface BLANK with absolutely NO characters, NO calligraphy, NO symbols. Pale plaster wall, grey stone steps, a few sparrows on the lintel edge, soft cold morning light from the left. Restrained earth-tone palette, film grain, shallow depth of field. No text, no watermark, no people, no readable characters anywhere.",
"resolution": "2k"
}
}
}'Response exampleresponse.json
{
"description": "task accepted; poll the result via query_tool with this task_id",
"query_tool": "ae_get_result",
"status": "created",
"task_id": "806dd5d2-ca46-426b-8f1b-8ccbe1dca8b3"
}





