API & MCP
Generate video, images and audio from your scripts, n8n and Make workflows or right from AI agents — Claude, Cursor and others. Same models, settings and prices as on the site; credits come from your account balance.
Quick start
- Sign in and open Settings → API & MCP. Create a key — it is shown only once, save it.
- Connect your AI agent to the MCP server (next section) — or call the REST API:
curl https://genomake.io/api/v1/generations \
-H "Authorization: Bearer gm_live_…" \
-H "Content-Type: application/json" \
-d '{"model": "seedream-5-flash:text-to-image", "prompt": "Рыжий кот в скафандре на Луне"}'{"data": {"id": 28409, "status": "processing", "model": "seedream-5-flash:text-to-image",
"model_name": "Seedream 5.0 Flash - Text to Image", "type": "image",
"credits_charged": 7, "balance": 11327, "callback_url": null, "warnings": []}}curl "https://genomake.io/api/v1/generations/28409?wait=30" -H "Authorization: Bearer gm_live_…"{"data": {"id": 28409, "status": "completed", "type": "image",
"model": "seedream-5-flash:text-to-image", "model_name": "Seedream 5.0 Flash - Text to Image",
"prompt": "Рыжий кот в скафандре на Луне",
"results": ["https://tempfile.aiquickdraw.com/seedream5flash/1794906829684-j7xlut2xeu.jpg"],
"cover_url": null, "error": null, "credits_charged": 7, "created_at": "2026-11-17T12:13:31+00:00"}}Result links are temporary — download the file if you need to keep it. If a generation fails, credits are refunded automatically and credits_charged becomes 0.
MCP for AI agents
MCP (Model Context Protocol) is the standard AI agents use to plug in external tools. Connect GENOMAKE once and the agent finds a model, checks the price, generates an image or video and waits for the result by itself. Great for content pipelines and for generating assets while coding.
| URL | https://genomake.io/mcp |
| Transport | Streamable HTTP (stateless, JSON responses) |
| Auth | Authorization: Bearer gm_live_… |
claude mcp add --transport http genomake https://genomake.io/mcp --header "Authorization: Bearer gm_live_…"{
"mcpServers": {
"genomake": {
"url": "https://genomake.io/mcp",
"headers": { "Authorization": "Bearer gm_live_…" }
}
}
}n8n: AI Agent node → “MCP Client Tool”, HTTP Streamable transport, URL https://genomake.io/mcp, Bearer auth with your key.
Tools the agent gets:
get_account | Balance, key limits, tasks running now |
list_models | Models with starting price and accepted files |
get_model | Exact model params, defaults, file slots |
estimate_cost | Price in credits for these settings (free) |
generate | Start a generation, spends credits; waits up to wait_seconds |
get_generation | Status and result links |
list_generations | Generation history |
upload_file | Re-host a file from a public URL |
list_tools / get_tool | Ready-made site tools and their fields |
run_tool / get_tool_run | Run a tool (spends credits) and its status |
Tools that spend credits are marked as non-read-only, so Claude and Cursor ask for confirmation before running them unless you allowed it in advance.
Authentication
Every request carries the key in Authorization: Bearer gm_live_… (or X-Api-Key: gm_live_…). The key spends your balance: keep it like a password and never put it into website or mobile app code your users can see.
- Up to 10 active keys per account — e.g. one per workflow.
- A key can have a daily credit limit — protection from a looping agent.
- A revoked key stops working immediately.
- Model parameter labels and provider error texts follow
Accept-Languageor?lang=ru; API service messages are in English.
Models and parameters
A model is addressed by key: family:variant (kling-3-0:standard) or a plain name (runway). List them with GET /api/v1/models, filter ?type=image|video|audio.
{"model": "kling-3-0:standard", "name": "Kling 3.0 — Standard (HD)", "type": "video",
"description": "Standard quality generation", "price_from": 151, "prompt": "required",
"files": {"image": {"min": 0, "max": 2}}}GET /api/v1/models/{model} returns everything a request needs: parameters with allowed values (params), provider-level extras (advanced_params — seed, negative_prompt, etc.), file slots, defaults and which parameters affect the price.
{
"params": {
"duration": {"type": "string", "enum": ["3", "4", "5", "…", "15"], "default": "5"},
"aspect_ratio": {"type": "string", "enum": ["16:9", "9:16", "1:1"], "default": "16:9"},
"sound": {"type": "boolean", "default": false}
},
"file_slots": [
{"slot": "start_image", "title": "Start Frame", "accepts": ["image"], "max_files": 1, "required": false},
{"slot": "end_image", "title": "End Frame", "accepts": ["image"], "max_files": 1, "required": false}
],
"prompt": {"supported": true, "required": true, "max_length": 2500},
"price": {"from": 151, "depends_on": ["duration", "sound"]}
}- Pass parameters in
paramsunder the same names; omitted ones use defaults. Unknown names are dropped with a note inwarnings; invalid values return 422 with the allowed list. - Text-to-… / image-to-… pairs switch automatically: attach a file to the text variant and the request goes to the file variant, and vice versa (same as the site). The response notes it in warnings.
- URLs that
filesdoes not fill (e.g. themask_urlmask of Ideogram Edit) are listed infile_params— pass them inparams. Other URLs inparamsare not accepted: files go throughfilesonly. - Exact price for specific settings —
POST /api/v1/estimatewith the same body as a launch. Free.
Input files
Images, video and audio are passed as public URLs in files — in two ways:
"files": ["https://example.com/photo.jpg"]
"files": [{"url": "https://example.com/clip.mp4", "type": "video", "duration": 8}]"files": {
"start_image": "https://example.com/first-frame.jpg",
"end_image": "https://example.com/last-frame.jpg"
}- File type comes from the extension; add
typeif the URL has none. - For input video and audio pass
durationin seconds. If the model prices by input length (price.input_duration_requiredin the model description), requests without it are rejected. The final charge is reconciled with the provider’s actual usage. - A result URL of one generation can go straight into the next one: image → video.
- A local file:
POST /api/v1/files(multipart, fieldfile, up to 100 MB) or{"url": "…"}— returns a URL forfiles.
Generations
POST /api/v1/generations charges credits and immediately answers 202 with an id. Images usually take 10–60 seconds, video 1–10 minutes. Get the result by polling, waiting or a callback.
| Field | Description |
|---|---|
| model | Model key — required |
| prompt | Prompt text; required by most models |
| params | Model parameters |
| files | Input files |
| callback_url | Where to POST the result when the task finishes |
- Statuses:
processing→completedorfailed. GET /api/v1/generations/{id}?wait=0..45— waits for completion up to that many seconds. For video, repeat while the status isprocessing. When the server is busy the answer may come earlier — just repeat.- The
Idempotency-Keyheader prevents double charges: a retry with the same key returns the first response instead of starting a second generation. - API generations show up in the site history like regular ones.
import requests
API = "https://genomake.io/api/v1"
H = {"Authorization": "Bearer gm_live_…"}
start = requests.post(f"{API}/generations", headers=H, json={
"model": "kling-3-0:standard",
"prompt": "Кот в скафандре медленно машет в камеру, Земля в небе",
"params": {"duration": "5", "aspect_ratio": "9:16"},
"files": {"start_image": "https://example.com/cat.jpg"},
}).json()["data"]
while True:
gen = requests.get(f"{API}/generations/{start['id']}", headers=H, params={"wait": 45}).json()["data"]
if gen["status"] != "processing":
break
print(gen["status"], gen["results"], gen["error"])const API = "https://genomake.io/api/v1";
const headers = { Authorization: "Bearer gm_live_…", "Content-Type": "application/json" };
const { data: start } = await (await fetch(`${API}/generations`, {
method: "POST",
headers: { ...headers, "Idempotency-Key": crypto.randomUUID() },
body: JSON.stringify({ model: "seedream-5-flash:text-to-image", prompt: "Flat icon of a rocket" }),
})).json();
let gen;
do {
({ data: gen } = await (await fetch(`${API}/generations/${start.id}?wait=45`, { headers })).json());
} while (gen.status === "processing");
console.log(gen.results);Completion callback
Instead of polling, pass callback_url when starting a generation or a tool. When the task finishes we POST the same JSON as the status endpoint there. Handy for n8n and Make: a Webhook node receives the finished clip and passes it down the workflow.
POST https://your-server.example/genomake-hook
Content-Type: application/json
User-Agent: GENOMAKE-Webhooks/1.0
X-Genomake-Event: generation.completed
X-Genomake-Delivery: 25
X-Genomake-Timestamp: 1794914215
X-Genomake-Signature: sha256=5f0c…
{"event": "generation.completed", "delivery_id": 25,
"data": {"id": 28429, "status": "completed", "type": "image", "results": ["https://…"], "…": "…"}}- Events:
generation.completed,generation.failed,tool_run.completed,tool_run.failed. - Only public https URLs. Reply 2xx within 10 seconds; otherwise we retry after 1 min, 5 min, 30 min and 2 h (5 attempts total). Redirects are not followed.
- A notice may arrive twice — use
delivery_idto skip duplicates.
Verifying the signature. Each key has a signing secret (Settings → API & MCP). The signature is sha256= + HMAC-SHA256 of X-Genomake-Timestamp + "." + raw body. Reject stale timestamps to block replays.
$body = file_get_contents('php://input');
$ts = $_SERVER['HTTP_X_GENOMAKE_TIMESTAMP'] ?? '';
$expected = 'sha256=' . hash_hmac('sha256', $ts . '.' . $body, $secret);
if (!hash_equals($expected, $_SERVER['HTTP_X_GENOMAKE_SIGNATURE'] ?? '') || abs(time() - (int) $ts) > 300) {
http_response_code(401);
exit;
}
$event = json_decode($body, true);import crypto from "node:crypto";
// rawBody — тело запроса как строка, до JSON.parse
function verify(rawBody, headers, secret) {
const ts = headers["x-genomake-timestamp"];
const expected = "sha256=" + crypto.createHmac("sha256", secret).update(`${ts}.${rawBody}`).digest("hex");
const got = headers["x-genomake-signature"] || "";
return got.length === expected.length
&& crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected))
&& Math.abs(Date.now() / 1000 - Number(ts)) < 300;
}import hashlib, hmac, time
def verify(raw_body: bytes, headers, secret: str) -> bool:
ts = headers.get("X-Genomake-Timestamp", "")
expected = "sha256=" + hmac.new(secret.encode(), ts.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, headers.get("X-Genomake-Signature", "")) and abs(time.time() - int(ts or 0)) < 300Tools
Tools are the site’s ready-made pipelines: background removal, upscaling, product covers, try-on and more. One run may include several steps with different models.
GET /api/v1/tools → id, slug, title, description
GET /api/v1/tools/removebackground → fields, presets, price_from
POST /api/v1/tools/removebackground/runs → {"images": {"photo": ["https://…/photo.jpg"]}}
GET /api/v1/tool-runs/{run_id}?wait=45 → status, steps, resultsText and select fields go to fields by field key, images to images by field key, the style to preset_id. callback_url and Idempotency-Key work the same as for generations.
Pricing and limits
- Same prices as on the site, Premium included. Credits are charged at launch and refunded on failure.
- Up to 5 tasks at once per account; start the next one when a running task finishes.
- Up to 30 launches per minute per key.
- Waiting for a result within one request — up to 45 seconds.
- Optional daily credit limit, per key.
- Result links are temporary and history entries older than 14 days may be deleted — keep your files.
Errors
{"error": {"code": "INSUFFICIENT_CREDITS", "message": "Not enough credits", "details": {"required": 151, "balance": 40}}}| HTTP | Code | Meaning |
|---|---|---|
| 401 | UNAUTHORIZED | Missing, invalid or revoked key |
| 402 | INSUFFICIENT_CREDITS | Not enough credits; details show how many are needed |
| 403 | FORBIDDEN | Account blocked or key lacks permission |
| 404 | NOT_FOUND | Model, generation or tool not found (or not yours) |
| 409 | IDEMPOTENCY_CONFLICT | Idempotency-Key already used with another request |
| 422 | VALIDATION | Invalid parameters — the message says what to fix |
| 429 | TOO_MANY_ACTIVE | 5 tasks already running — wait for one to finish |
| 429 | RATE_LIMIT | Too many launches per minute |
| 429 | DAILY_LIMIT | Key daily limit reached |
| 502 | GENERATION_FAILED | Provider rejected the task; no credits charged |
| 503 | API_DISABLED | API temporarily unavailable |
If a generation fails mid-way, the status returns status: "failed" with a readable error; credits are already refunded by then.
Reference
| Request | What it does |
|---|---|
GET /api/v1/me | Account, balance, key limits |
GET /api/v1/models | Model list (?type=image|video|audio) |
GET /api/v1/models/{model} | Model parameters |
POST /api/v1/estimate | Price for settings |
POST /api/v1/generations | Start a generation |
GET /api/v1/generations/{id} | Status and result (?wait=0..45) |
GET /api/v1/generations | History (?status, ?type, ?limit, ?before) |
POST /api/v1/files | Upload a file for model input |
GET /api/v1/tools | Tool list |
GET /api/v1/tools/{id|slug} | Tool fields and styles |
POST /api/v1/tools/{id|slug}/runs | Run a tool |
GET /api/v1/tool-runs/{id} | Run status (?wait=0..45) |
POST /mcp | MCP server (JSON-RPC) |