# xAI Grok Imagine Image 2.0 Text to Image API

> Grok Imagine Image 2.0 by xAI - generate stunning images from text prompts with state-of-the-art AI. Supports multiple aspect ratios, styles, and high-resolution output for creative and commercial use.

Source: https://www.sandbase.ai/models/xai/grok-imagine-image/2.0/text-to-image
API reference: https://www.sandbase.ai/models/xai/grok-imagine-image/2.0/text-to-image/docs

## Facts

- Provider: xAI
- Type: Image model
- Model ID: `xai/grok-imagine-image/2.0/text-to-image`
- Price: From $0.06 per run
- Capabilities: text to image
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

- Unified Run API: `POST https://api.sandbase.ai/v1/run`

```bash
curl -X POST https://api.sandbase.ai/v1/run \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "xai/grok-imagine-image/2.0/text-to-image",
  "prompt": "Abstract human silhouette, golden particles ready to burst outward representing joy, data visualization style, emotional expression through particles, artistic scientific",
  "quality": "medium",
  "resolution": "1k",
  "output_format": "jpeg"
}'
```

The response returns a run id; poll `GET https://api.sandbase.ai/v1/run/{id}` until the status is `completed` or `failed`.

## FAQ

### How do I call xAI Grok Imagine Image 2.0 Text to Image through SandBase?

Create a SandBase API key, then send requests with the model ID "xai/grok-imagine-image/2.0/text-to-image" to Unified Run API (/v1/run) at https://api.sandbase.ai. The request examples on this page show the exact payload.

### Do I need a separate xAI account?

No. One SandBase API key and balance gives you access to xAI Grok Imagine Image 2.0 Text to Image and the other models in the catalog; you do not need to sign up with xAI separately.

## README

### Grok Imagine Image 2.0 Text to Image

Grok Imagine Image 2.0 generates images at two quality levels and 1K or 2K.

#### Fields

| Field | Type | Default | Notes |
|---|---|---|---|
| `prompt` | string, required | — | Up to 8,000 characters. |
| `aspect_ratio` | `21:9` / `16:9` / `3:2` / `4:3` / `5:4` / `1:1` / `4:5` / `3:4` / `2:3` / `9:16` | — | Output shape. |
| `resolution` | `1k` / `2k` | `1k` | Sets the per-image rate. |
| `output_format` | `jpeg` / `png` | `jpeg` | Output file format. |
| `quality` | `low` / `medium` | `medium` | Sets the per-image rate. |

#### Billing

Per image: $0.04 (low) or $0.06 (medium) at 1K; $0.06 or $0.08 at 2K.

| Request | 1k | 2k |
|---|---|---|
| low | $0.04 | $0.06 |
| medium | $0.06 | $0.08 |

Failed runs are not charged.

#### Prompting

- Quote any text that must appear.

#### Limits

- One output image per request.

#### Also on SandBase

Other Grok Imagine Image endpoints: `xai/grok-imagine-image/quality`, `xai/grok-imagine-image/quality/edit`, `xai/grok-imagine-image/edit`, `xai/grok-imagine-image/2.0/edit`.
