互換Reference · OpenAI-compatible
Change the base URL. Keep your code.
AnimeAPI answers the OpenAI images request shape at
https://animeapi.ai/v1. If a library or tool lets you set a custom OpenAI-compatible image endpoint, paste that URL and an AnimeAPI key and it works. Same price as the native endpoint: $0.003 per image on the anime model.01Set it up
| Setting | Value | Notes | |
|---|---|---|---|
| Base URL | https://animeapi.ai/v1 | Not www: the www host redirects and clients drop the key on the way. | |
| API key | ank_... | Create one on the keys page. New accounts include 3 free images. | |
| Model | anime | Or ultra ($0.01) or ultra-max ($0.02). Any other name is treated as anime, so tools with a fixed model name still work. |
02Examples
from openai import OpenAI
client = OpenAI(base_url="https://animeapi.ai/v1", api_key="ank_...")
image = client.images.generate(
model="anime",
prompt="a girl with a red umbrella at a rainy bus stop",
size="1024x1536",
)
print(image.data[0].url)import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://animeapi.ai/v1", apiKey: process.env.ANIMEAPI_KEY });
const image = await client.images.generate({
model: "anime",
prompt: "a girl with a red umbrella at a rainy bus stop",
size: "1024x1536",
});
console.log(image.data[0].url);curl https://animeapi.ai/v1/images/generations \
-H "Authorization: Bearer $ANIMEAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "anime", "prompt": "a girl with a red umbrella at a rainy bus stop", "size": "1024x1024"}'{
"created": 1794291556,
"data": [
{
"url": "https://animeapi.ai/i/Qm3kZ8…x2Lw.webp",
"revised_prompt": "masterpiece, best quality, 1girl, solo, red_umbrella, bus_stop, rain, ..."
}
],
"model": "anime",
"balance_usd": 4.997
}03Request fields
POST /v1/images/generations
| Field | Type | Default | Description |
|---|---|---|---|
| prompt | string | required | What to draw, up to 1,000 characters. Plain English is fine. |
| model | string | anime | anime, ultra or ultra-max. Unknown names fall back to anime. |
| size | string | portrait | Width×height such as 1024x1024, 1024x1536 or 1536x1024, or auto. Only the shape is used: taller than wide is portrait, wider is landscape, equal is square. The image comes back at the model’s own size for that shape. |
| n | integer | 1 | 1 to 4 images. Each is charged separately. |
| response_format | string | url | url or b64_json. |
| orientation | string | — | Extension. portrait, square or landscape; overrides size. |
| enhance | boolean | true | Extension. Rewrite the prompt into tags on the anime model. The result is returned as revised_prompt. |
GET /v1/models lists the three models with their prices.
04Differences from OpenAI
- Only image generation is implemented. There are no edits, variations, chat or embeddings endpoints.
quality,style,backgroundanduserare accepted and ignored.- The response adds
modelandbalance_usd. OpenAI clients ignore fields they don’t know. - Image URLs are not permanent storage. Download the file if you need to keep it.
05Errors
Errors use OpenAI’s envelope, so client libraries raise their usual exceptions. code is the AnimeAPI error code in lower case; the statuses are the same as the native endpoint.
{
"error": {
"message": "Insufficient balance: this request costs $0.003 and the account has $0.000. Add funds at https://animeapi.ai/dashboard/billing (from $5; the balance never expires).",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_balance"
}
}