Chat API

Call the same models that power the chat window, programmatically — from a script, a bot, or another app (e.g. captradeai.com).

The API is available to registered users. Log in or create a free account, then generate a token on your Account page.
Authentication

Every request needs your API token in an Authorization header:

Authorization: Bearer YOUR_API_TOKEN

Get your token from Account → API Access. Generating a new one invalidates the old one immediately.

Endpoint

POST https://www.aimitatio.com/api/chat.php

FieldTypeRequiredDescription
messagestringyesYour message (max 4000 characters).
modelstringno One of: teuken, qwen . Defaults to teuken. See model comparison.
historyarraynoPrior turns as [{"role": "user"|"assistant", "content": "..."}], oldest first — the API is stateless, so send this yourself for multi-turn context.
temperaturenumberno0–1. Default 0.7.
max_lengthintegernoMax response tokens. Default 1024 (each model caps this server-side too).
Example
curl -X POST https://www.aimitatio.com/api/chat.php \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Write a Python function that reverses a linked list.",
    "model": "qwen"
  }'

Response:

{
  "status": "success",
  "response": "...",
  "model": "qwen",
  "generation_time": 5.42
}
Status codes & responses
HTTPstatusMeaning
200successResponse ready.
401errorMissing or invalid token.
400errorBad request — missing/invalid field.
429errorDaily free-tier limit reached.
503loading / busyModel is (re)loading on our small GPU, or handling another request — retry shortly. This is routine, not a failure: the two models share one GPU and swap in on demand.
502errorCould not reach the model service — retry later.
Rate limits

Free accounts: 50 requests/day. This runs on our own small home server, so limits keep it usable for everyone — get in touch if you need a higher-volume Pro plan.

Image & Video Generation

Same token, same auth header, a different pair of endpoints — POST /api/generate.php to submit a job, GET /api/generate_status.php?job_id=... to poll it. Unlike chat, generation is asynchronous: it can take from a few seconds (image) to a few minutes (video) on our shared GPU, so the submit call returns a job_id immediately rather than making you wait on the connection.

Submit — POST /api/generate.php

FieldTypeRequiredDescription
typestringyes"image" or "video".
promptstringyesMax 2000 characters.
width / heightintegernoImage: 256–1024 (default 1024). Video: 256–768 (default 768).
stepsintegernoImage: 1–8 (default 4, or 8 for edits — see strength below). Video: 20–50 (default 30) — not yet verified against real output on this hardware.
source_image_base64stringnoBase64-encoded JPEG/PNG/WebP, max 10MB decoded. Image: edits this image instead of generating from scratch (the prompt becomes the edit instruction). Video: animates this image. Takes priority over source_job_id/source_image_url if more than one is sent.
strengthnumbernoImage edits only, 0–1 (default 0.6). How much the source image is allowed to change — low is a subtle edit, high is closer to a fresh image using it as a starting point. Only used when source_image_base64/source_image_url is set on an image request. Edits also default steps to 8 instead of 4 — FLUX img2img only actually runs steps×strength denoising steps against your image, so too few steps means the edit barely resembles the source.
source_job_idintegervideo: one of these threeA prior image job of yours (chain a generated image straight into a video).
source_image_urlstringvideo: one of these threeOr animate any externally-hosted image instead.
duration_secondsintegernoVideo only, 1–4 (default 3).

Response: {"status": "queued", "job_id": 123, "poll_url": "/api/generate_status.php?job_id=123"}


Poll — GET /api/generate_status.php?job_id=123

job_status is one of queued / processing / success / error. On success the response includes a result_url you can fetch directly (a PNG for images, an MP4 for video).

Image/video rate limits

Free accounts: 8 images/day and 2 videos/day — much lower than chat's limit, since each job occupies the whole (shared, 12GB) GPU for the duration of generation rather than a few seconds of a text reply.