One call, finished media
run submits the generation, polls with the backoff the API recommends, and resolves to the completed request with result.url.
At a glance
Mage publishes open-source SDKs for its API: @mage-space/sdk on npm for TypeScript and JavaScript, mage-space on PyPI for Python, and the comfyui-mage node pack for ComfyUI. Each wraps the REST API with typed configs for all 28 models, automatic polling, idempotent retries, and uploads.
3
SDKs and integrations
28
Typed models
MIT
Open source
$0
To install
Pick yours
npm install @mage-space/sdk
Generate images, video, and audio from Node.js with typed configs for every Mage model. One call submits, waits, and returns the result.
pip install mage-space
Generate images, video, and audio from Python with sync and asyncio clients and typed configs for every Mage model.
comfy node install comfyui-mage
Mango, Cherry, Seed Audio, and every other Mage model as ComfyUI nodes. No GPU, no model downloads.
Quick start
Install the package, export MAGE_API_KEY, and run a model.
// npm install @mage-space/sdk
import Mage from '@mage-space/sdk';
const mage = new Mage(); // reads MAGE_API_KEY
const request = await mage.run('mango', {
prompt: 'Editorial portrait in soft daylight, 35mm film look',
aspect_ratio: '4:5',
model_id: 'mango-v3',
});
console.log(request.result.url);# pip install mage-space
from mage_space import Mage
mage = Mage() # reads MAGE_API_KEY
request = mage.run("mango", {
"prompt": "Editorial portrait in soft daylight, 35mm film look",
"aspect_ratio": "4:5",
"model_id": "mango-v3",
})
print(request["result"]["url"])Built in
run submits the generation, polls with the backoff the API recommends, and resolves to the completed request with result.url.
Every submission carries an idempotency key. Network errors and server errors are retried with backoff, and a retried submission is never charged again.
Files too large for a data URL go through a signed upload, with the ticket, the PUT, and the size check handled for you.
API refusals carry their HTTP status, error code, and request id; failed or cancelled generations and timeouts have their own error types.
Packages
| SDK | Package | Install | Source |
|---|---|---|---|
| TypeScript SDK | @mage-space/sdk | npm install @mage-space/sdk | GitHub |
| Python SDK | mage-space | pip install mage-space | GitHub |
| Mage for ComfyUI | comfyui-mage | comfy node install comfyui-mage | GitHub |
FAQ
Yes. The SDKs and the ComfyUI nodes are MIT-licensed on GitHub, and installing them is free. You pay only for the generations you run, in Gems, at each model’s listed price.
Yes. Pass the new model’s id as a string and it runs; the SDK checks its config against the fields every model shares. A bot updates the types whenever the API reference changes, so new models arrive with their own types in the next release.
Every submission carries an Idempotency-Key. The SDK makes a new key per call and reuses it when it retries that call itself, so a retried submission returns the original request and charges nothing.
They are in beta at 0.x, so a minor version may still change them. The API itself is versioned separately and stays stable within v1.
There is no subscription or monthly fee. Each generation is paid in Gems at its model's listed price, and 1,000 Gems cost $1 on the standard pack. Every model page lists its default-settings price, and each response reports the exact charge. A generation that fails is refunded; one Mage's content policy blocks is not. A request your balance cannot cover is refused before anything is charged.
No. The API runs on Gems alone. Membership plans and their unlimited in-app generation do not apply to API requests, so any Mage account with Gems can call it.
Yes. Content you create with Mage, including through the API and MCP server, can be used commercially. Attribution is appreciated but not required.
One account, one Gems balance, every model. Pay only for what you generate.