Skip to main content

Common Params

LLMGrid supports OpenAI-compatible image generation and forwards provider-specific fields when applicable. Base URL: https://api.llmgrid.ai/v1
Endpoint: POST /images/generations
Auth: Authorization: Bearer <LLMGRID_API_KEY>

Usage

cURL
Input Params

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 (commonly 1–10, model-dependent).
  • size: string (optional) — Output dimensions (model-dependent).
    • Common values: 1024x1024, plus portrait/landscape variants if supported.
  • 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" → returned data[].url
    • "b64_json" → returned data[].b64_json (base64-encoded image)
  • user: string (optional) — End-user identifier for tracking and governance.
  • timeout: number (optional) — Request timeout (seconds).
:::note Any non-standard parameters (fields not part of the OpenAI-compatible schema) are treated as provider-specific and forwarded in the request body as-is. :::

Response

A typical response includes a data 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
Example prompt
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)