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.

Image
Usage-based pricing

Pricing

ConditionCharge
image resolution is 1k60 AE credits per image, based on actual successfully generated images.
image resolution is 2k84 AE credits per image, based on actual successfully generated images.
image resolution not supplied60 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.

ParameterTypeRequiredDescriptionDefault
request_bodyobjectYesNo parameter description.—
request_body.promptstringYesText description of the desired image.—
request_body.sync_modebooleanNoIf `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_imagesintegerNoNumber of images to generate.1
request_body.resolutionenum (1k | 2k)NoResolution of the generated image. `1k` for standard resolution, `2k` for high resolution.1k
request_body.aspect_ratioenum (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)NoAspect ratio of the generated image.1:1
request_body.output_formatenum (jpeg | png | webp)NoThe format of the generated image.jpeg

Invocation example

Copy the request and explore its response example.

POST/agent-api/v1/tool/executeX-Api-Key

Submit 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
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"
}