MORGANE · API

Generate images and text from your code… or a simple link

A simple HTTP API: a prompt gives a PNG (50 points, free while your worker is connected) or an answer from the text model (paid per token, in points).

Create an API key

Quick start

  1. Sign in and create a key on /workers (3 keys max). It starts with ma_ and is shown only once: keep it safe.
  2. Send POST /images with your prompt. The response gives an id (status 202).
  3. Poll GET /images/{id} every 2 to 5 seconds until completed or failed.
  4. Download the PNG with GET /images/{id}/file.

Base URL: https://aiworkerinfo.com/api/v1/public

Pricing and free use

Active worker = free API. While one of your workers is connected and ready on /workers, your API images cost no points. As soon as it disconnects, normal pricing applies again.

Without an active worker: 50 points per image, debited at launch and refunded automatically if generation fails.

Earn points: /points quotidien (10 to 30 a day), time in the voice channels your server picked (/economie, up to 20 an hour), /bump, generating on Discord, or lending your PC to the network (40 to 900 per generation).

GET /me tells you live whether you generate for free (workerActive) and the price applied (cost).

Authentication

Send your key in every request header. It is personal: never publish it (Git repository, browser code…). If it leaks, delete it on /workers and create a new one.

Authorization: Bearer ma_…

Endpoints

MethodURLPurpose
GET/meBalance, applied price and worker state
GET/modelsAvailable models and default model
POST/imagesStart an image (−50 pts, free with an active worker)
GET/images/{id}Image status
GET/images/{id}/fileDownload the PNG
GET/ask?q=…Simple link: text answer from the model
GET/image?prompt=…Simple link: waits and returns the PNG
POST/chatText model answer (2 pts / 1000 input tokens, 8 pts / 1000 output tokens), live with stream
GET/conversationsConversations kept by Morgane
GET · DELETE/conversations/{id}Read or delete a conversation

GET /me

{"points": 340, "imageCost": 50, "workerActive": true, "cost": 0,
 "textPrice": {"input": 2, "output": 8, "per": 1000}, "key": "mon-script"}

GET /models

{"default": "…safetensors", "models": [{"id": "…safetensors", "family": "sdxl"}]}

POST /images → 202

{"id": "4f0c…", "status": "queued", "cost": 0, "free": true, "points": 340,
 "statusUrl": "/api/v1/public/images/4f0c…"}

GET /images/{id}

{"id": "4f0c…", "status": "queued" | "running"}
{"id": "4f0c…", "status": "completed", "fileUrl": "/api/v1/public/images/4f0c…/file"}
{"id": "4f0c…", "status": "failed", "refunded": true}

A key only sees images started by its own account through the API.

POST /images parameters

JSON body (Content-Type: application/json, 32 KB max).

FieldTypeDefaultDescription
promptstringrequired3 to 2000 characters, English or French.
negativestring—What to avoid (1000 characters max).
width, heightinteger1024Multiples of 64 between 512 and 1536.
seedintegerrandomInteger ≥ 0 to reproduce a result.
modelstringdefault modelAn id returned by GET /models.

Text: the language model

POST /chat answers directly (no polling). Price: 2 points per 1000 input tokens and 8 points per 1000 output tokens, rounded up, 1 point minimum per answer. A token is about 3 to 4 characters.

Model: Qwen3.5 9B, running on Morgane’s server (nothing is sent to an external service). About 8,000 input tokens of context.

The maximum price (with max_tokens) is reserved first, then only the tokens really used are billed. If the model fails or you close the connection before the answer, everything is refunded. A worker does not make text free: the model runs on Morgane’s server.

FieldTypeDefaultDescription
messagesarrayrequired (or prompt)1 to 40 messages {"role": "system" | "user" | "assistant", "content": "…"}, the last one from user. 24,000 characters max in total.
prompt, systemstring—Shortcut for a single question, with an optional system instruction.
max_tokensinteger512Maximum answer length (1 to 2048).
temperaturenumber0.70 = precise and stable, 2 = very creative.
streambooleanfalsetrue: the answer arrives live, piece by piece (see below).
rememberbooleanfalsetrue: Morgane keeps the conversation and returns a conversation_id.
conversation_idstring—Continues a kept conversation: send only the new message.

POST /chat → 200

{"id": "9b1e…", "model": "morgane-text",
 "message": {"role": "assistant", "content": "…"}, "finish": "stop" | "length",
 "usage": {"input_tokens": 41, "output_tokens": 180, "total_tokens": 221},
 "cost": 2, "points": 338}
curl -X POST https://aiworkerinfo.com/api/v1/public/chat \
  -H "Authorization: Bearer $MORGANE_KEY" -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"Explain DNS in two sentences"}],"max_tokens":300}'

One answer in progress at a time per account. Safe-for-work content only, as for images.

Live answer (streaming)

With "stream": true, the answer is sent as Server-Sent Events while it is written. Each data: line holds a JSON object: start (id), then delta events (a piece of text in content), then done (the same content as the normal answer: usage, cost, points) or error. The stream ends with data: [DONE]. If you hang up midway, only the part already received is billed.

curl -N -X POST https://aiworkerinfo.com/api/v1/public/chat \
  -H "Authorization: Bearer $MORGANE_KEY" -H "Content-Type: application/json" \
  -d '{"prompt":"Write a poem about the sea","stream":true}'

data: {"type":"start","id":"9b1e…","model":"morgane-text","conversation_id":null}
data: {"type":"delta","content":"The sea"}
data: {"type":"delta","content":" whispers…"}
data: {"type":"done","message":{…},"usage":{…},"cost":2,"points":336}
data: [DONE]

Simple link: /ask?q=…&stream=1&key=… sends the plain text as it comes (handy with curl -N).

Conversation memory

Send "remember": true with the first message: the answer contains a conversation_id. Then pass that conversation_id with only the new message, and Morgane adds the history herself. The history is sent to the model at each turn, so it counts as input tokens. Morgane keeps the last 40 messages (24,000 characters), 50 conversations per account, deleted after 30 days of inactivity. A new system message replaces the conversation’s one.

curl -X POST https://aiworkerinfo.com/api/v1/public/chat -H "Authorization: Bearer $MORGANE_KEY" -H "Content-Type: application/json" \
  -d '{"prompt":"My name is Sam.","remember":true}'
→ {"conversation_id": "conv_5f2c…", "message": {…}, …}

curl -X POST https://aiworkerinfo.com/api/v1/public/chat -H "Authorization: Bearer $MORGANE_KEY" -H "Content-Type: application/json" \
  -d '{"prompt":"What is my name?","conversation_id":"conv_5f2c…"}'

Simple link: /ask?q=…&remember=1&key=… returns the id in the X-Morgane-Conversation header, then /ask?q=…&c=conv_…&key=…. List, read and delete: GET /conversations, GET /conversations/{id}, DELETE /conversations/{id}.

Official libraries

A single file, no dependencies: it handles the key, waiting for the result, retries (429 / 503) and errors.

Python 3.8+

from morgane import Morgane, MorganeError

api = Morgane("ma_...")          # or the MORGANE_API_KEY variable
print(api.me())                  # points, price, active worker
png = api.generate("a red fox in the snow, watercolor", width=1024, height=768)
open("fox.png", "wb").write(png)
print(api.ask("Give me three name ideas for a ginger cat", max_tokens=200))

From the command line: python morgane.py "a red fox" -o fox.png

Node.js 18+

import {Morgane} from './morgane.mjs';
import fs from 'node:fs';

const api = new Morgane('ma_...');
const png = await api.generate('a red fox in the snow, watercolor', {width: 1024, height: 768});
fs.writeFileSync('fox.png', png);
const r = await api.chat([{role: 'user', content: 'Hello!'}], {maxTokens: 200});
console.log(r.message.content, r.cost);

Methods: me() · models() · submit(prompt, options) · status(id) · file(id) · wait(id) · generate(prompt, options) · chat(messages, options) · ask(prompt, options). Errors are MorganeError with status, code and message.

Examples

curl

curl -X POST https://aiworkerinfo.com/api/v1/public/images \
  -H "Authorization: Bearer $MORGANE_KEY" -H "Content-Type: application/json" \
  -d '{"prompt":"a ginger cat on a sunny windowsill","width":1024,"height":1024}'

curl -H "Authorization: Bearer $MORGANE_KEY" https://aiworkerinfo.com/api/v1/public/images/ID
curl -H "Authorization: Bearer $MORGANE_KEY" -o image.png https://aiworkerinfo.com/api/v1/public/images/ID/file

Python

import os, time, requests

API = "https://aiworkerinfo.com/api/v1/public"
H = {"Authorization": f"Bearer {os.environ['MORGANE_KEY']}"}

r = requests.post(f"{API}/images", headers=H, json={"prompt": "a lighthouse at dusk"})
r.raise_for_status()
job = r.json()
while True:
    s = requests.get(f"{API}/images/{job['id']}", headers=H).json()
    if s["status"] not in ("queued", "running"):
        break
    time.sleep(3)
if s["status"] == "completed":
    open("image.png", "wb").write(requests.get(f"{API}/images/{job['id']}/file", headers=H).content)

JavaScript (Node 18+)

const API = "https://aiworkerinfo.com/api/v1/public";
const H = { Authorization: `Bearer ${process.env.MORGANE_KEY}`, "Content-Type": "application/json" };

const job = await (await fetch(`${API}/images`, { method: "POST", headers: H,
  body: JSON.stringify({ prompt: "a lighthouse at dusk" }) })).json();
let s;
do { await new Promise(r => setTimeout(r, 3000));
  s = await (await fetch(`${API}/images/${job.id}`, { headers: H })).json();
} while (s.status === "queued" || s.status === "running");
if (s.status === "completed") {
  const png = Buffer.from(await (await fetch(`${API}/images/${job.id}/file`, { headers: H })).arrayBuffer());
  (await import("node:fs")).writeFileSync("image.png", png);
}

Errors

Every error has the same shape: {"error": "code", "message": "human-readable text"}.

HTTPCodeMeaning
400invalid_promptPrompt empty, too short or too long.
400invalid_size · invalid_seed · invalid_modelParameter out of range.
400invalid_messages · too_long · invalid_max_tokens · invalid_temperatureInvalid POST /chat body.
400refused_promptRefused by the content policy (no adult content).
401unauthorizedKey missing, invalid or deleted.
402not_enough_pointsNot enough points and no active worker.
403blockedGeneration access suspended by staff.
404not_foundUnknown image or owned by another account.
404conversation_not_foundUnknown or expired conversation, or another account’s.
409not_readyImage not finished yet.
410goneFile deleted.
429rate_limited · too_many_jobsToo many requests or too many images in progress.
503 · 504unavailableGeneration unavailable or too slow; points refunded. Retry later.

Limits and rules

  • 30 requests per minute per key. The RateLimit and RateLimit-Policy headers show what is left.
  • At most 2 images and 1 text answer in progress per account: wait for one to finish before starting another.
  • Safe-for-work content only, with the same checks as on Discord.
  • Images stay private and appear in “My generations”. See the Terms.