Bildgenerierungs-APIs
GPT Images, Wan und Seedream über /v1/images/generations aufrufen, Gemini-Bildmodelle über natives generateContent. Media-Gruppen-Key verwenden.
Image generation uses two public contracts. They share your Modelflare API key and Credits, but the request formats are not interchangeable.
- OpenAI-compatible image models use POST /v1/images/generations and POST /v1/images/edits.
- Gemini image models use native POST /v1beta/models/{model}:generateContent.
Create the API key on the media routing group (Image / Video in the console). Do not send image models to /v1/chat/completions or /v1/responses. Wrong-endpoint requests return unsupported_endpoint and name the required API.
1. OpenAI-compatible Images API
This path covers gpt-image-2, gpt-image-2.5-sunburst, gpt-image-2.5-flare, Wan Image, and Seedream. The gateway keeps the provider JSON or multipart body and bills through the media quote. Exact fields and live prices are on each model page.
Generate
curl https://modelflare.dev/v1/images/generations \
-H "Authorization: Bearer YOUR_MODELFLARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.5-sunburst",
"prompt": "A white cat runs through a neon-lit street in the rain",
"size": "1024x1024",
"n": 1
}'
Use /v1/images/edits when the selected model documents reference-image editing. Channel-pinned keys are rejected.
Model pages and prices:
2. Gemini native image API
Gemini image models do not use /v1/images/generations, /v1/images/edits, or OpenAI /v1/responses.
- Synchronous: POST https://modelflare.dev/v1beta/models/{model}:generateContent
- Recommended for long jobs: POST https://modelflare.dev/v1beta/models/{model}:streamGenerateContent?alt=sse
- origin.modelflare.dev does not expose /v1beta
curl -N "https://modelflare.dev/v1beta/models/gemini-3.1-flash-image:streamGenerateContent?alt=sse" \
-H "x-goog-api-key: YOUR_MODELFLARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"role": "user",
"parts": [{"text": "Create a clean blue circle centered on a white background. No text."}]
}],
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"],
"imageConfig": {"aspectRatio": "1:1", "imageSize": "1K"}
}
}'
Each SSE data: event is native Gemini JSON. The image is base64 in candidates[].content.parts[].inlineData.data. Use a media-group key through x-goog-api-key. Current prices are on Models & Pricing.