Image Generations

POST /v1/images/generations

Generate images from text prompts using Imagen, Flux, and MAI models, with CDN-hosted output URLs.

Request

POST https://api.chuizi.ai/v1/images/generations

Authentication

Authorization: Bearer ck-your-api-key

Parameters

ParameterTypeRequiredDefaultDescription
modelstringYesModel name, e.g. google/imagen-4.0, azure/flux-kontext-pro
promptstringYesText description of the image to generate
sizestringNo"1024x1024"Image dimensions. Options vary by model

Request Example

config.json
json
{
  "model": "google/imagen-4.0",
  "prompt": "A futuristic city skyline at sunset, digital art style",
  "size": "1024x1024",
  "n": 1,
  "response_format": "url"
}

Response

config.json
json
{
  "created": 1712000000,
  "data": [
    {
      "url": "https://media.chuizi.ai/images/gen-xxxxxxxx.png",
      "revised_prompt": "A futuristic city skyline at sunset with neon lights..."
    }
  ],
  "x_chuizi": {
    "generation_id": "gen-xxxxxxxxxxxxxxxx",
    "latency_ms": 8500,
    "cost": "0.04000000"
  }
}

Code Examples

terminal
bash
curl -X POST https://api.chuizi.ai/v1/images/generations \
  -H "Authorization: Bearer ck-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/imagen-4.0",
    "prompt": "A futuristic city skyline at sunset",
    "size": "1024x1024"
  }'

Next Steps