API

Generate images and video from code: the Airogenia API and CLI

Airogenia now has a public API and a command-line tool. One key, the same balance as the studio, and a render started from your own script in a few calls.

AAirogenia5 min read
An open laptop on a dark desk with a lime-green glowing screen, a stream of tiny mint and lime squares rising from it and forming a floating picture frame and a floating film frame in the dark teal air

Until now, making a picture or a clip on Airogenia meant opening the studio. That is the right tool for exploring and the wrong one the fifth time you do the same thing. The studio now has a door for code: a public API, and a command-line tool built on top of it.

Who this is for

  • App and site builders who want a generated image or clip inside their own product, made on demand.
  • People with a pipeline: a batch of prompts in a spreadsheet that should become files in a folder.
  • Script and CI users who would rather type one command than click through a form.
  • Coding agents. The command-line tool can write a skill file that teaches an agent to check the price first.

If you only want a few pictures, stay in the studio. The API is not cheaper or better for one-off work; it is simply automatable.

What you can do with it

The API covers the whole loop of a render:

  1. Look around. List the catalog, open one model to see its fields, and check who you are and what is left on your balance.
  2. Ask the price. Send the exact inputs you plan to use and get the cost back without starting anything.
  3. Start a render. One call, answered at once with the status queued while the work runs in the background.
  4. Check on it. Ask for the render by its id until it reports succeeded, failed or refunded.
  5. Fetch the result. Download the finished file with the same key, or delete the render when you are done with it.

Images, video, audio and 3D sit behind the same calls; you switch by changing the model id, and the fields follow the model. The models page lists every id, and the API docs build a ready request from any model's own fields.

How authentication works

There is no separate developer account. Sign in to the studio, open Settings, create an API key, and you have it. Every request carries that key as a Bearer token in the Authorization header. You can revoke any key at any time.

Keep the key on your server or in an environment variable, never in a browser page or a mobile app, because anyone who reads it can spend your balance.

Pay per render, from the balance you already have

API renders draw from the same balance as the studio, at the same price, and top-ups start from €3.00. Every amount in the API is in euro cents, so a price of one euro arrives as 100. If a render fails, it is refunded to your balance automatically.

A first render with curl

The base address is https://airogenia.com/api/v1/api/catalog. Put your key in an environment variable, pick a model id from the models page, and start a render. The Idempotency-Key header means that if your request is retried, it is not charged twice.

Prompt
curl -X POST https://airogenia.com/api/v1/api/catalog/generations \ -H "Authorization: Bearer $AIROGENIA_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{"modelId": "MODEL_ID", "inputs": {"prompt": "a lighthouse on a cliff at dusk, soft light"}}'
Replace MODEL_ID with an id from the models page. The answer holds the render's id and its status, queued.

Then poll the same path with the id from the answer, and add /content to download the file, with the same Authorization header. The API docs show each call in full.

Or skip the HTTP: the command-line tool

The CLI does the polling for you. It needs Node.js 18.3 or newer and signs in with the same key:

Prompt
npm install -g airogenia airogenia login airogenia run MODEL_ID -p "a lighthouse on a cliff at dusk, soft light" --dry-run airogenia run MODEL_ID -p "a lighthouse on a cliff at dusk, soft light" -o ./out/
The first run prints the exact price and spends nothing. The second renders and saves the file in the folder.

Every field of a model is a flag, and a local file is uploaded for you. Add --json for one JSON document on stdout, errors on stderr and a non-zero exit on failure, which is what a script wants. The CLI page lists every command, and the developers page puts the API, the CLI and a quickstart side by side.

Limits, and what it cannot do

  • Rate limits. Each key has a per-minute limit and an optional daily cap. Past the limit you get a 429; a reached daily cap is its own error. Back off rather than retry in a tight loop.
  • No balance, no render. With too little balance the API answers 402 and starts nothing.
  • Polling, not pushing. You ask for the status; the docs describe no other way to be told a render finished.
  • No client library. There is plain HTTP and the CLI.
  • Send your own User-Agent. The stock Python urllib one is stopped with a 403 page before it reaches the API; set a name for your app.
  • Explore in the studio. Trying prompts one at a time is faster there; move the one that works into a script.

Prompting works the same in code. Two posts that carry over directly: prompting light and widening a picture into a panorama.

Questions

Do I need a separate account or plan for the API?

No. You create an API key in Settings on the account you already use, and renders draw from the same balance as the studio, at the same price. Top-ups start from €3.00.

How do I know what a render will cost before I run it?

Ask the API for a quote with the exact inputs you plan to send; nothing is started or charged. The command-line tool does the same with the --dry-run flag.

What happens if a render fails?

It is refunded to your balance automatically, and the render reports a failed or refunded status when you poll it.

Can I use the key in a browser or a mobile app?

No. Keep it on your server or in an environment variable. Anyone who has the key can spend your balance until you revoke it in Settings.

#API#CLI#Developers

Keep reading

All articles →