Image Generation
Generate images from text prompts using multiple AI providers with a unified API.
Supported Models
OpenAI removed dall-e-3 and dall-e-2 from its API on 12 May 2026. A request for either returns 400 model_retired.
Usage
SDK
const response = await cencori.ai.generateImage({
prompt: "A futuristic city at sunset with flying cars",
model: "gpt-image-1",
size: "1024x1024",
quality: "high"
});
console.log(response.images[0].b64_json);API Request
POST https://api.cencori.com/v1/images/generations
Headers: { "CENCORI_API_KEY": "csk_..." }
Body: {
"prompt": "A futuristic city at sunset",
"model": "gpt-image-1",
"size": "1024x1024"
}Parameters
OpenAI's image models always return the image as base64 in b64_json; there is no hosted URL.
Response
{
"images": [
{
"b64_json": "iVBORw0KGgo..."
}
],
"model": "gpt-image-1",
"provider": "openai"
}Auto-router (auto / cencori-auto)
Pass model: 'auto' to resolve a quality-ordered BYOK image model for the project (gpt-image-1 → gpt-image-1-mini → Google), verified against image pricing for the requested size/quality. Google-incompatible options match OpenAI only. BYOK-only: no usable key returns 402 byok_required, and it never falls back to managed keys. Details: BYOK auto-router.

