remagicaDocs home

Quickstart

Create an API key, generate your first image and download it.

This takes about five minutes. You need a Remagica account with some credits.

1. Create a key

  1. Open Remagica, go to Settings, and find API keys.
  2. Select Create API key, give it a name, and keep the API preset. It can generate, upload, make clips and run workflows and apps.
  3. Copy the key. It starts with rmg_ and is shown only once.

Keep the key secret. Anyone who has it can spend your workspace's credits. Store it in an environment variable, not in your code. Pick the tab for your terminal, since each shell sets variables differently:

export REMAGICA_API_KEY="rmg_..."

The variable lasts until you close the terminal. Never paste the key on a line by itself: the shell runs it as a command and fails, and the key ends up in your shell history.

Using Remagica from Claude?

Claude Code, Claude Desktop and claude.ai connect through the MCP server and sign you in with your Remagica account, so they don't need a key. See Connect to Claude.

2. Check the key works

List the models you can use:

curl https://api.remagica.com/api/v1/models \
  -H "x-api-key: $REMAGICA_API_KEY"

In Windows PowerShell, curl on its own is a different command, so type curl.exe. Each shell also ends a continued line differently: \ in macOS and Linux, a backtick in PowerShell and ^ in cmd (Command Prompt).

Each model has an id, the kind of thing it makes, what it accepts (capabilities) and what it costs in credits (pricing).

3. Generate an image

curl https://api.remagica.com/api/v1/generations/images \
  -H "x-api-key: $REMAGICA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/nano-banana-pro",
    "prompt": "A lighthouse on a cliff at dusk, cinematic, 35mm"
  }'

You get 202 Accepted with the new generation. Note its id and status (queued).

4. Wait for it

Poll the generation until status is completed or failed. Images take a few seconds.

curl https://api.remagica.com/api/v1/generations/GENERATION_ID \
  -H "x-api-key: $REMAGICA_API_KEY"

The other guides show sh commands. On Windows, change them the same way: $REMAGICA_API_KEY becomes $env:REMAGICA_API_KEY in PowerShell or %REMAGICA_API_KEY% in Command Prompt, and the line endings change as above.

The same steps in JavaScript:

const API = "https://api.remagica.com/api/v1";
const headers = {
  "Content-Type": "application/json",
  "x-api-key": process.env.REMAGICA_API_KEY,
};

const created = await fetch(`${API}/generations/images`, {
  body: JSON.stringify({
    model: "google/nano-banana-pro",
    prompt: "A lighthouse on a cliff at dusk, cinematic, 35mm",
  }),
  headers,
  method: "POST",
}).then((response) => response.json());

let generation = created;
while (generation.status === "queued" || generation.status === "running") {
  await new Promise((resolve) => setTimeout(resolve, 2000));
  generation = await fetch(`${API}/generations/${created.id}`, {
    headers,
  }).then((response) => response.json());
}

console.log(generation.status, generation.outputs[0]?.url);

5. Download the result

A completed generation lists its files in outputs. Each has a url you can download, and a storage key you can pass to another generation. Download URLs expire, so fetch the generation again for a fresh one.

Next

On this page