Common Params
LLMGrid supports OpenAI-compatible image generation and forwards provider-specific fields when applicable. Base URL:https://api.llmgrid.ai/v1Endpoint:
POST /images/generationsAuth:
Authorization: Bearer <LLMGRID_API_KEY>
Usage
Required Fields
prompt: string — Text description of the image you want to generate.
Optional Fields
model: string (optional) — Image model to use (depends on your enabled providers/models).n: integer (optional) — Number of images to generate (commonly1–10, model-dependent).size: string (optional) — Output dimensions (model-dependent).- Common values:
1024x1024, plus portrait/landscape variants if supported.
- Common values:
quality: string (optional) — Output quality (supported values vary by model/provider).style: string (optional) — Style hint (if supported).response_format: string (optional) — Output format:"url"→ returneddata[].url"b64_json"→ returneddata[].b64_json(base64-encoded image)
user: string (optional) — End-user identifier for tracking and governance.timeout: number (optional) — Request timeout (seconds).
Response
A typical response includes adata array containing either url or b64_json depending on response_format.
URL Response Example
Base64 Response Example (b64_json)
Decode b64_json (Python)
Prompt Tips
- Be explicit about subject + environment + style + lighting + composition
- Add constraints like camera angle, color palette, branding, or background
- If output needs to be consistent, specify same style and repeatable structure
Text
Common Errors
- 400 — Invalid payload / unsupported params for chosen model/provider
- 401 — Missing/invalid Virtual Key
- 403 — Key lacks access to the model/provider
- 429 — Rate limit / quota exceeded (retry with backoff)
- 5xx — Transient error (retry with backoff)

