Skip to content

互換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

Settings for an OpenAI-compatible client
SettingValueNotes
Base URLhttps://animeapi.ai/v1Not www: the www host redirects and clients drop the key on the way.
API keyank_...Create one on the keys page. New accounts include 3 free images.
ModelanimeOr 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

Python · openai
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)
Node · openai
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
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"}'
200 OK
{
  "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

Fields of POST /v1/images/generations
FieldTypeDefaultDescription
promptstringrequiredWhat to draw, up to 1,000 characters. Plain English is fine.
modelstringanimeanime, ultra or ultra-max. Unknown names fall back to anime.
sizestringportraitWidth×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.
ninteger11 to 4 images. Each is charged separately.
response_formatstringurlurl or b64_json.
orientationstring—Extension. portrait, square or landscape; overrides size.
enhancebooleantrueExtension. 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, background and user are accepted and ignored.
  • The response adds model and balance_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.

402
{
  "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"
  }
}