ディスコードUse · Discord bots
Anime images in a Discord bot for $0.003 each.
- $0.003
- per image, any shape
- 1,666
- images for $5
- ~4s
- per image
- 3
- free images, no card
01What the bot costs to run
A bot for friends
20 images a day
$0.06 a day · $1.80 per 30 days
An active community server
50 images a day
$0.15 a day · $4.50 per 30 days
A busy server
500 images a day
$1.50 a day · $45.00 per 30 days
A public bot in many servers
3,000 images a day
$9.00 a day · $270.00 per 30 days
The bill cannot pass what you loaded. When the balance runs out the API answers 402 with a message the bot can show its owner, and nothing is charged. Failed generations are refunded.
02The shortest working bot
The starter is a complete bot with one slash command. Clone it, add two values, run it:
git clone https://github.com/animeapi-ai/discord-bot-starter
cd discord-bot-starter
cp .env.example .env # paste DISCORD_TOKEN and ANIMEAPI_KEY
npm install && npm startIf you already have a bot, this is the whole of the AnimeAPI part:
// anime-image.mjs · the part of the bot that talks to AnimeAPI
export async function animeImage(prompt, orientation = "square") {
const res = await fetch("https://animeapi.ai/api/generate", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ANIMEAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ prompt, model: "anime", orientation }),
});
const data = await res.json();
// 402: the balance is empty. 400: the prompt was refused. Neither is charged.
if (!res.ok) throw new Error(data.error);
// Download it: an uploaded file stays in the channel, the link is not storage.
const file = await fetch(data.image_url);
return Buffer.from(await file.arrayBuffer());
}// inside the /anime slash-command handler (discord.js v14)
await interaction.deferReply(); // Discord allows 3 seconds; an image takes about 4
try {
const image = await animeImage(interaction.options.getString("prompt", true));
await interaction.editReply({ files: [{ attachment: image, name: "anime.webp" }] });
} catch (err) {
await interaction.editReply(`Couldn't draw that: ${err.message}`);
}The Discord guide has the full walk-through, including registering the command.
03Things specific to Discord
- Defer first. Discord drops an interaction that is not answered within 3 seconds and an image takes about 4.
deferReply()buys 15 minutes. - Upload the file. Attach the downloaded image instead of embedding the link. An uploaded file stays in the channel; the link the API returns is not permanent storage.
- Square fits chat.
orientation: "square"gives 1024×1024, which Discord shows without cropping. Portrait and landscape cost the same. - Add a cooldown. One line per user stops a single member from spending the server’s balance. The starter uses 30 seconds.
- New commands appear slowly. A global slash command can take up to an hour to show. Register it for one server while you build.
04What comes back
Made through the API for this page with the prompts shown, unedited.

“a small dragon asleep on a pile of library books, warm lamp light”anime · $0.003 · 4.2s · 1024×1024 
“a mecha pilot giving a thumbs up from the cockpit”anime · $0.003 · 4.1s · 1024×1024
05Limits to know first
- AnimeAPI does not generate adult content. Explicit prompts are refused and not charged.
- It draws anime illustration. It is not a photo model and will not imitate one well.
- The anime model garbles words. For captions, signs or memes with text use
ultra($0.01, about 11 seconds) orultra-max($0.02). - Sizes are fixed per shape: 832×1280, 1024×1024 or 1280×832 on the anime model.
- Prompts are limited to 1,000 characters.
06Questions
- What is the cheapest way to add anime image generation to a Discord bot?
- One of the cheapest is AnimeAPI at $0.003 per image with no subscription. A bot that makes 50 images a day costs $0.15 a day, $4.50 per 30 days. $5 buys 1,666 images and a new account has 3 free ones.
- Discord needs a reply within 3 seconds. Is an image fast enough?
- An image takes about 4 seconds, so the bot must acknowledge first with interaction.deferReply() and then edit the reply when the image arrives. Discord allows 15 minutes after a deferral.
- Can someone run up a bill by spamming the command?
- No further than the balance you loaded. AnimeAPI is prepaid: when the balance is empty the API answers 402 and nothing is charged. The starter bot also has a per-user cooldown, 30 seconds by default.
- Is the output safe for a public server?
- AnimeAPI does not generate adult content. Explicit prompts are refused and not charged, and every image passes a safety check before it is returned.
07Links
- Discord bot starterTemplate repository: cooldown, balance message, retries
- Discord guideStep by step with discord.js v14
- Telegram guideThe same command in Python or Node
- For bots and roleplayPlugins for other chat platforms
- ErrorsEvery status and code a bot can meet
08Other uses
- SillyTavern and roleplay front endsScene and character images from the chat
- Visual novel and game artBackgrounds and sprites in a batch
- n8n workflowsCommunity node or the HTTP Request node
- AI agentsA remote MCP server and an agent skill
- OpenAI images API drop-inChange the base URL, keep the code