Mage API · Image generation
The AI image generation API for every model
Text-to-image, image editing, and consistent characters from 17 models, including Mage's flagship Mango 4, through one key and one balance.
POST https://api.mage.space/v1/{model}/generateAt a glance
The Mage image generation API is a REST API at https://api.mage.space/v1 that runs 17 text-to-image and image-editing models, including Mango 4, Guava 2 Pro, GPT Image 2.6, Nano Banana 2, Flux 2, and Krea 2. You POST a prompt to /{model}/generate, poll the request, and download the image. Each image is paid in Gems, with no subscription.
- 17image models
- $0.009Cheapest default, per image
- 20Concurrent generations
- $0Monthly fee
Models
Every image model in the Mage API
Prices are per generation, in Gems. 1,000 Gems cost $1 on the standard pack, and larger packs add bonus Gems. The price depends on the model, resolution, and duration; the default-settings price is shown, and every response reports the exact charge in billing.gems_charged. A generation that fails is refunded; one Mage's content policy blocks is not.
| Model | Best for | model_id values | Default price |
|---|---|---|---|
| Anima | Purpose-built for anime | anima-v1 | 20 Gems ($0.02) |
| Chroma | Open-weights, built on Flux | chroma-v1-hd | 35 Gems ($0.035) |
| Flux 2 | Long prompts and multi-reference edits | flux2-dev | 40 Gems ($0.04) |
| GPT Image 2 | Precise prompts and readable text | gpt-image-2, gpt-image-2.5-flare, gpt-image-2.5-sunburst, gpt-image-2.6-flare, gpt-image-2.6-sunburst | 9 Gems ($0.009) |
| Grok Image | Grok Imagine, in two tiers | grok-imagine-image, grok-imagine-image-2.0 | 90 Gems ($0.09) |
| Guava | Photorealism that passes for a photograph | guava, guava-pro, guava-pro-v1-5, guava-2, guava-2-pro | 37 Gems ($0.037) |
| HiDream | Fast and versatile, with negative prompts | hidream-fast | 20 Gems ($0.02) |
| Krea 2 | Gorgeous aesthetics in seconds | krea-2-turbo | 20 Gems ($0.02) |
| Mango | Our flagship image family | mango, mango-v2, mango-v3s, mango-v3, mango-v3-turbo, mango-v4 | 42 Gems ($0.042) |
| MOSS-Image | Long prompts and bilingual text, open weights | moss-image | 25 Gems ($0.025) |
| Nano Banana 2 | Crisp, readable text, up to 4K | nano-banana-v2, nano-banana-v2.1 | 51 Gems ($0.051) |
| SDXL Plus | SDXL with faces and hands fixed | 6A35A7855770AE9820A3C931D4964C3817B6D9E3C6F9C4DABB5B3A94E5643B80 | 15 Gems ($0.015) |
| Seedream | Seedream, with a strict filter | seedream-4.0, seedream-4.5, seedream-5.0-lite, seedream-5.0-pro, seedream-5.0-flash, seedream-5.5 | 42 Gems ($0.042) |
| Stable Diffusion v1.5 | The classic, on a budget | 15012C538F503CE2EBFC2C8547B268C75CCDAFF7A281DB55399940FF1D70E21D | 10 Gems ($0.01) |
| Stable Diffusion v3.5 Large | The Stable Diffusion that listens best | sd-3-5-large | 10 Gems ($0.01) |
| Stable Diffusion XL | Photoreal-tuned SDXL | 6A35A7855770AE9820A3C931D4964C3817B6D9E3C6F9C4DABB5B3A94E5643B80 | 10 Gems ($0.01) |
| Z-Image | The fastest image model on Mage | z-image-turbo | 10 Gems ($0.01) |
Quick start
Generate an image with Anima v1
Set MAGE_API_KEY, submit the request, and poll until it completes. Swap anima in the URL for any model above.
cURL
STATUS_URL=$(curl --request POST 'https://api.mage.space/v1/anima/generate' \
--header "Authorization: Bearer $MAGE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"prompt": "Editorial portrait in soft daylight, 35mm film look",
"aspect_ratio": "4:5",
"model_id": "anima-v1"
}' | jq -r '.status_url')
# Repeat until status is "completed"; result.url is the file
curl "$STATUS_URL" --header "Authorization: Bearer $MAGE_API_KEY"TypeScript
// npm install @mage-space/sdk
import Mage from '@mage-space/sdk';
const mage = new Mage(); // reads MAGE_API_KEY
const request = await mage.run('anima', {
prompt: 'Editorial portrait in soft daylight, 35mm film look',
aspect_ratio: '4:5',
model_id: 'anima-v1',
});
console.log(request.result.url);Python
# pip install mage-space
from mage_space import Mage
mage = Mage() # reads MAGE_API_KEY
request = mage.run("anima", {
"prompt": "Editorial portrait in soft daylight, 35mm film look",
"aspect_ratio": "4:5",
"model_id": "anima-v1",
})
print(request["result"]["url"])How it works
From API key to finished media in three calls
Every model shares one authentication scheme, one asynchronous request lifecycle, and the same field names.
Create an API key
Sign in to Mage, open API → API Keys, and create a key. It starts with mage_sk_ and is shown once. An account can hold 10 active keys.
Submit a generation
POST a JSON body to https://api.mage.space/v1/{model}/generate with an Authorization: Bearer header. The response returns at once with a request_id, a status, and a status_url. Send an Idempotency-Key header so a retry never pays twice.
Poll and download
Poll status_url until the status is completed, failed, or cancelled. A completed request carries result.url with the image, video, or audio file, kept for 30 days.
Built for production
What every Mage API request gets
One key, every model
35 image, video, and audio models behind one REST API and one Gems balance. Switch models by changing the URL path.
Pay per generation
No subscription and no minimum spend. You buy Gems, and each request is charged its listed price. A generation that fails is refunded, unless Mage's content policy blocked it.
Safe retries
Idempotency keys make a retried submit return the original request without charging again.
Consistent characters
Save a character or reference once, then write @handle in any prompt to use it with every model that supports it.
Large inputs
Send image, video, and audio inputs as URLs or data URLs, or upload files up to 100 MB through a signed upload.
20 generations in flight
Each account can run 20 generations at once, and the limit can be raised for your use case. Refused requests are never charged.
Use cases
What developers build with the image API
Product and marketing images
Render product shots, ad variants, and social posts on demand, with readable text from GPT Image 2.6 or Nano Banana 2.
Consistent characters
Save a character once and keep the same face across a whole set with Mango 4, Guava 2 Pro, and other models that take @handle mentions.
Image editing pipelines
Send a source image with an instruction to change exactly what you ask and keep the rest in place.
Apps and games
Generate avatars, stickers, cards, and scenes inside your product without hosting a single GPU.
Photoreal portraits
Guava 2 Pro renders portraits, fashion, and lifestyle shots with true-to-life skin, fabric, and light.
Fast drafts at scale
Z-Image Turbo and Krea 2 keep prices low for high-volume thumbnails and first passes.
FAQ
Frequently asked questions
What is the best AI image generation API?
Does the image API support image editing and reference images?
What resolutions does the image API support?
How much does the Mage API cost?
Do I need a Mage membership to use the API?
Can I use API outputs commercially?
What are the rate limits?
Can my AI agent use the Mage API?
Is there an SDK for the Mage API?
I already use another generation API. What do I have to change?
Start building with Mage
One account, one Gems balance, every model. Pay only for what you generate.