Image Generation
Supported Models
| Model | Provider | Max Size | Notes |
|---|---|---|---|
azure/flux-kontext-pro | Azure (FLUX) | 1440x1440 | Flux Kontext Pro, high quality |
azure/flux-2-pro | Azure (FLUX) | 1440x1440 | Flux 2 Pro |
google/imagen-4.0 | Google Vertex | 2048x2048 | Google Imagen 4 |
google/imagen-4.0-fast | Google Vertex | 2048x2048 | Faster variant |
google/imagen-4.0-ultra | Google Vertex | 2048x2048 | Highest quality |
bailian/wan2.7-image | Alibaba Bailian | 1024x1024 | Wanxiang image generation |
bailian/wan2.7-image-pro | Alibaba Bailian | 1024x1024 | Pro variant |
azure/mai-image-2 | Azure | 2048x2048 | Microsoft MAI Image 2 |
bedrock/stability-* | Amazon Bedrock | 1024x1024 | Stability AI models |
Text-to-Image
Request
POST https://api.chuizi.ai/v1/images/generations
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | -- | Model name |
prompt | string | Yes | -- | Image description |
size | string | No | "1024x1024" | Image dimensions |
n | integer | No | 1 | Number of images (1-4) |
response_format | string | No | "url" | url or b64_json |
Size Options
| Size | Aspect Ratio | Supported Models |
|---|---|---|
1024x1024 | 1:1 (square) | All models |
1792x1024 | 16:9 (landscape) | Most models |
1024x1792 | 9:16 (portrait) | Most models |
2048x2048 | 1:1 (large square) | Imagen, MAI Image |
Example
terminal
bash
curl -X POST https://api.chuizi.ai/v1/images/generations \ -H "Authorization: Bearer ck-your-key-here" \ -H "Content-Type: application/json" \ -d '{ "model": "azure/flux-kontext-pro", "prompt": "A minimalist logo design for a coffee shop called 'Morning Brew', clean lines, warm colors", "size": "1024x1024", "n": 1 }'
Response
config.json
json
{ "created": 1712000000, "data": [ { "url": "https://media.chuizi.ai/images/gen-xxxxxxxxxxxxxxxx.png" } ], "x_chuizi": { "generation_id": "gen-xxxxxxxxxxxxxxxx", "cost": "0.05000000", "latency_ms": 8500 } }
The url is a permanent link hosted on the R2 CDN. It does not expire.
Code Examples
example.py
python
from openai import OpenAI client = OpenAI( base_url="https://api.chuizi.ai/v1", api_key="ck-your-key-here", ) # Generate an image response = client.images.generate( model="azure/flux-kontext-pro", prompt="A futuristic cityscape at night, neon lights, cyberpunk style, detailed", size="1792x1024", n=1, ) print(f"Image URL: {response.data[0].url}") # Generate multiple images response = client.images.generate( model="google/imagen-4.0-fast", prompt="A watercolor painting of a mountain lake at sunrise", size="1024x1024", n=4, ) for i, image in enumerate(response.data): print(f"Image {i + 1}: {image.url}") # Edit an existing image response = client.images.edit( model="azure/flux-kontext-pro", image=open("photo.png", "rb"), prompt="Add a rainbow in the sky", size="1024x1024", ) print(f"Edited image: {response.data[0].url}")
Next Steps
- Image Generations API — full API reference
- Image Edits API — background removal, inpainting, and upscaling
- Video Generation — generate videos from text prompts