API Reference
Complete reference for the AnimeAPI endpoints
Base URL
https://api.animeapi.comAuthentication
All API requests require authentication using a Bearer token in the Authorization header.
Authorization: Bearer ank_your_api_keyAPI keys can be generated from your dashboard.
POST
/api/generate
Generate an anime image from a text prompt.
Request
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer token with your API key |
| Content-Type | Yes | application/json |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Text description of the image to generate (max 1000 characters) |
| orientation | string | No | Image orientation: portrait (832x1280), square (1024x1024), or landscape (1280x832). Default: portrait |
| allowNSFW | boolean | No | Whether to allow NSFW content. Default: true |
| enhance | boolean | No | Whether 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)
| Field | Type | Description |
|---|---|---|
| image_url | string | URL of the generated image |
| enhanced_prompt | string | The prompt actually used for generation (includes AI enhancements if enhance: true) |
| balance_usd | number | Your account balance in USD |
| generation_time_ms | number | Time 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
| Limit | Value |
|---|---|
| Requests per minute (per API key) | 10 |
| Daily limit (per user) | 5,000 images |
Image Specifications
| Orientation | Dimensions | Best For |
|---|---|---|
| portrait | 832 x 1280 pixels | Character art, wallpapers (default) |
| square | 1024 x 1024 pixels | Profile pictures, icons |
| landscape | 1280 x 832 pixels | Scenes, backgrounds, banners |
| Property | Value |
|---|---|
| Format | WEBP |
| Generation time | 4-8 seconds |
| Cost per image | $0.009 |