How much does it cost to run a chatbot with an LLM API?
Typical cost ranges
Most LLM APIs charge per token, with prices ranging from about $0.0001 to $0.03 per 1,000 tokens for input and $0.0002 to $0.06 per 1,000 tokens for output. A simple chatbot exchange might use 100–500 tokens, costing fractions of a cent to a few cents per interaction.
For example, using a mid-tier model like GPT-3.5 Turbo, 1,000 conversations with 3 messages each could cost around $0.50 to $2. Using a high-end model like GPT-4, the same volume might cost $10 to $30 or more.
What drives the cost
The main factors are the model you choose, the number of tokens per request (including conversation history), and the number of requests. Longer prompts and responses increase costs linearly.
Some providers also charge for fine-tuning or additional features like embeddings, but for a basic chatbot, token usage is the primary cost.
- Model tier: cheaper models cost 10–100x less than top-tier ones.
- Token count: each word is roughly 1–2 tokens; longer chats add up.
- Conversation history: including past messages increases input tokens.
- Request volume: more users mean higher bills.
- Output length: generating longer replies costs more than input.
Common mistakes
- Assuming all LLM APIs cost the same; prices differ significantly between providers and models.
- Forgetting that output tokens often cost more than input tokens, so verbose responses can inflate costs.
- Ignoring the cost of conversation history, which can double or triple token usage in long chats.
