# AniworldAI NovelAI API > Image generation with NovelAI V4.5 Full and V5 Medium. One API key works in four formats: OpenAI (Images, Chat Completions, Responses), Naistera (sillyimages), Stable Diffusion WebUI / AUTOMATIC1111 (the way SillyTavern connects) and MCP over Streamable HTTP. Keys are sold at https://novelai.aniworldai.org/#plans: sign in with Telegram, pay by SBP, crypto or Telegram Stars, and the key is shown right after payment. - API base: https://novelai.api.aniworldai.org - OpenAI: base_url `https://novelai.api.aniworldai.org/v1`, the key as `api_key`. Endpoints: POST /v1/images/generations, POST /v1/images/edits, POST /v1/chat/completions, POST /v1/responses, GET /v1/models, GET /v1/account. - Model IDs: `nai-v4.5-full` and `nai-v5-medium`. GET /v1/models lists the same two models as `nai-v4.5-full-image` and `nai-v5-medium-image` (image clients pick models by the word "image" in the ID; `canonical_model` names the plain ID). Both spellings are accepted by every OpenAI endpoint; MCP and SD WebUI list the plain IDs. - Images: `size` is `WIDTHxHEIGHT`, 832x1216 when omitted. Any size is accepted and fitted, keeping its aspect ratio, to a 64-pixel grid within 1 megapixel: 1024x1024, 832x1216 and 1216x832 are drawn as asked, 1536x1536 becomes 1024x1024, 1024x1792 becomes 768x1344. A larger size is not refused; the fitted picture is one image of the allowance. The answer is `data[0].b64_json` (PNG), or `data[0].url` with `response_format: "url"`; the job ID is in the `X-Job-ID` header. POST /v1/images/edits takes one source image (multipart `image` or JSON `images`) and redraws it by the prompt. - Chat Completions: the text of the last user message is the prompt. `choices[0].message.content` is a Markdown image, `![Картинка](https://novelai.api.aniworldai.org/media/?expires=...&signature=...)`: a signed link that opens without the key for 7 days. `stream: true` sends the same as SSE. This is an image model: requests for text (titles, summaries, translations) are answered 400. - Responses: `input` is the prompt, `tools: [{"type": "image_generation"}]` is optional. The picture is the `output` item of type `image_generation_call`, base64 PNG in its `result`. - Naistera: base `https://novelai.api.aniworldai.org`, `Authorization: Bearer `. GET /api/models returns exactly the permitted models with their parameter limits; IDs `novelai-v4.5` and `novelai-v5-medium`. POST /api/generate returns a PNG data_url; `sync:false` returns job_id for GET /api/generate/jobs/{job_id}. No video, references or presets in this format. - Picture by link: GET https://novelai.api.aniworldai.org/prompt/?token=&aspect_ratio=2:3[&model=novelai-v4.5|novelai-v5-medium][&seed=][&negative_prompt=][&reroll=] returns the image itself (for chat presets that write ). The same link is drawn and charged once; a reroll is the same link with any new `reroll` value (a counter, Date.now()), the same value again returns the same picture uncharged; a refusal is returned as a picture with header X-AniworldAI-Notice. - Stable Diffusion WebUI (AUTOMATIC1111): base `https://novelai.api.aniworldai.org`, auth `api:` (HTTP Basic) or `Authorization: Bearer `. Endpoints: POST /sdapi/v1/txt2img, POST /sdapi/v1/img2img, GET /sdapi/v1/sd-models. - MCP: `https://novelai.api.aniworldai.org/mcp` (Streamable HTTP, stateless, JSON responses), header `Authorization: Bearer `. Every model of the key is drawn here. Tools and their arguments (the full schemas are in tools/list): - `get_models()`: the models this key may use; pass an `id` from it as `request.model`. - `generate_image(request, idempotency_key)`, both required. `request` is an object: `model`, `prompt` (required), `width` and `height` (832 and 1216 when omitted; fitted to 1 megapixel like `size` above), optional `negative_prompt`, `seed`. There is no `size` here. For a GPU model leave `width` and `height` out (the model's own size) or give multiples of 16; `images` is a list of base64 source pictures for an edit. `model` is `nai-v5-medium` when omitted. `idempotency_key` is any string unique to the picture (this is the `Idempotency-Key` of the HTTP formats, here an argument): a call repeated with the same key and the same request returns the same job and charges nothing. The call returns the job at once: `id`, `state` (`queued`), `created_at`, `updated_at`, `completed_at`, `expires_at`, `seed`, `error`. - `get_job(job_id)` (the job's `id`): poll every few seconds until `state` is `completed`; a picture usually takes 5 to 25 seconds. States: `queued`, `dispatching`, `pending` (being drawn), then `completed`, or `failed` / `cancelled` (nothing is charged), `uncertain` (the provider did not confirm the result; nothing is charged), `expired` (the picture was kept for 7 days and is gone). - `get_image(job_id)`: the PNG as MCP image content. `get_image_link(job_id)`: a signed URL that opens without the key. - `get_account()`: what is left (`daily_left`, `next_free_at`). `cancel_job(job_id)`: a picture already being drawn cannot be stopped, check the final state. - GPU models (OpenAI format, the Naistera mode of sillyimages and MCP; not in SD WebUI): `qwen-image-2.1` (recommended; generation/edit, up to 3 references), `flux-3-klein-image` (fastest; generation/edit, up to 10 references). Shared allowance by plan: 15, 50, 75 or 120 requests per day per account, separately from NovelAI; the day starts with the first GPU image and the whole allowance returns 24 hours later. GET /v1/account includes gpu_daily_images, gpu_daily_used, gpu_daily_left. Use size=auto; the first reference defines the edit canvas. Prompt adaptation is on by default; prompt_adaptation=false preserves the original text. - Limits: one image per request (`n` is 1). NovelAI: up to 1 megapixel and one source image, with the plan's daily allowance: the day starts with the first image and the whole allowance returns 24 hours later. A V5 Medium image takes two images of it, a V4.5 Full image one (keys paid before 12 November 2026: after the paid term; `medium_cost` in GET /v1/account says 1 or 2). Masks are not supported. GET /v1/account shows what is left: `daily_images`, `daily_used`, `daily_left`, `next_free_at`. - Retries: repeating a request after a dropped connection returns the image already drawn, without a second charge; send the `Idempotency-Key` header to make any retry safe: the repeat answers with the same `X-Job-ID` and the same picture. - Errors: OpenAI format, `error.code`, `error.message` (in Russian), `error.param`. 401 `invalid_api_key` or `missing_api_key`; 400 `model_not_found`, `invalid_size`, `invalid_parameters`; 403 `model_not_allowed`; 402 `trial_exhausted` (do not retry); 429 `key_daily_limit` with `Retry-After`; 429 `account_busy` (too many pictures at once: wait for one to finish); 503 when the queue is full or a GPU model is unavailable: repeat later. ## Docs - [OpenAPI schema](https://novelai.api.aniworldai.org/openapi.json): every endpoint, parameter and error - [Swagger UI](https://novelai.api.aniworldai.org/docs): the same schema with "Try it out" (in Russian) ## Buy a key - [Plans and free seats](https://novelai.aniworldai.org/#plans): Telegram sign-in, payment, the key right away (Russian and English)