Call the same models that power the chat window, programmatically — from a script, a bot, or another app (e.g. captradeai.com).
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.
POST https://www.aimitatio.com/api/chat.php
| Field | Type | Required | Description |
|---|---|---|---|
message | string | yes | Your message (max 4000 characters). |
model | string | no |
One of:
teuken, qwen . Defaults to teuken. See model comparison.
|
history | array | no | Prior turns as [{"role": "user"|"assistant", "content": "..."}], oldest first — the API is stateless, so send this yourself for multi-turn context. |
temperature | number | no | 0–1. Default 0.7. |
max_length | integer | no | Max response tokens. Default 1024 (each model caps this server-side too). |
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
}
| HTTP | status | Meaning |
|---|---|---|
| 200 | success | Response ready. |
| 401 | error | Missing or invalid token. |
| 400 | error | Bad request — missing/invalid field. |
| 429 | error | Daily free-tier limit reached. |
| 503 | loading / busy | Model 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. |
| 502 | error | Could not reach the model service — retry later. |
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.
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
| Field | Type | Required | Description |
|---|---|---|---|
type | string | yes | "image" or "video". |
prompt | string | yes | Max 2000 characters. |
width / height | integer | no | Image: 256–1024 (default 1024). Video: 256–768 (default 768). |
steps | integer | no | Image: 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_base64 | string | no | Base64-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. |
strength | number | no | Image 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_id | integer | video: one of these three | A prior image job of yours (chain a generated image straight into a video). |
source_image_url | string | video: one of these three | Or animate any externally-hosted image instead. |
duration_seconds | integer | no | Video 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).
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.