API Reference

Complete reference for the AnimeAPI endpoints

Base URL

https://api.animeapi.com

Authentication

All API requests require authentication using a Bearer token in the Authorization header.

Authorization: Bearer ank_your_api_key

API keys can be generated from your dashboard.

POST

/api/generate

Generate an anime image from a text prompt.

Request

Headers

HeaderRequiredDescription
AuthorizationYesBearer token with your API key
Content-TypeYesapplication/json

Body Parameters

ParameterTypeRequiredDescription
promptstringYesText description of the image to generate (max 1000 characters)
orientationstringNoImage orientation: portrait (832x1280), square (1024x1024), or landscape (1280x832). Default: portrait
allowNSFWbooleanNoWhether to allow NSFW content. Default: true
enhancebooleanNoWhether to auto-enhance the prompt with AI using Danbooru-style tags for better results. Default: true

Example Request (minimal)

curl -X POST https://api.animeapi.com/api/generate \
  -H "Authorization: Bearer ank_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "anime girl with blue hair"}'

Example Request (with options)

curl -X POST https://api.animeapi.com/api/generate \
  -H "Authorization: Bearer ank_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "anime girl with blue hair, magical forest",
    "orientation": "landscape",
    "allowNSFW": false,
    "enhance": true
  }'

Example Request (raw prompt, no enhancement)

curl -X POST https://api.animeapi.com/api/generate \
  -H "Authorization: Bearer ank_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "masterpiece, best quality, 1girl, blue_hair, forest, magical",
    "enhance": false
  }'

Response

Success Response (200)

FieldTypeDescription
image_urlstringURL of the generated image
enhanced_promptstringThe prompt actually used for generation (includes AI enhancements if enhance: true)
balance_usdnumberYour account balance in USD
generation_time_msnumberTime taken to generate the image in milliseconds

Example Success Response

{
  "image_url": "https://cdn.runware.ai/image/...",
  "enhanced_prompt": "masterpiece, best quality, absurdres, 1girl, solo, blue_hair, long_hair, forest, magical, glowing, fantasy, nature, trees, soft_lighting",
  "balance_usd": 9.99,
  "generation_time_ms": 4200
}

Error Responses

401Unauthorized

Invalid or missing API key

{"error": "Invalid API key", "code": "INVALID_KEY"}
402Payment Required

Insufficient balance

{"error": "Insufficient balance", "code": "INSUFFICIENT_BALANCE"}
429Too Many Requests

Rate limit exceeded or daily limit reached

{"error": "Daily limit exceeded", "code": "DAILY_LIMIT_EXCEEDED"}
500Server Error

Image generation failed

{"error": "Generation failed", "code": "GENERATION_FAILED"}

Rate Limits

LimitValue
Requests per minute (per API key)10
Daily limit (per user)5,000 images

Image Specifications

OrientationDimensionsBest For
portrait832 x 1280 pixelsCharacter art, wallpapers (default)
square1024 x 1024 pixelsProfile pictures, icons
landscape1280 x 832 pixelsScenes, backgrounds, banners
PropertyValue
FormatWEBP
Generation time4-8 seconds
Cost per image$0.009