What an AI NPC costs per player and how to keep it sane
An LLM-driven NPC costs between less than one cent and about 40 cents per player hour at October 2026 list prices. Model size and prompt caching decide most of that range. The figures come from the worked example below, which assumes 60 NPC turns an hour with about 3,000 input tokens and 60 output tokens per turn.
Change those assumptions and the answer moves, so the formula matters more than any single number. Rick Vu’s studio Red Dog builds AI-native NPCs. None of the figures here come from Red Dog. Each one is either a labeled assumption or a public list price you can check yourself.
The formula
Every provider in this article lists prices in US dollars per million tokens. One NPC turn is one model call that reads a prompt and writes a reply.
cost per turn = ( fresh input tokens x input price
+ cached input tokens x cached input price
+ output tokens x output price ) / 1,000,000
cost per player hour = cost per turn x NPC turns per player hour
A token is a piece of text, often a short word or part of a longer one. Tokenizers differ, and Anthropic’s pricing page notes that Claude 4.7 and later models produce about 30% more tokens for the same text. Count tokens with the provider you plan to use, not with a rule of thumb.
The assumptions in the example
Every number in this list is an assumption. Replace each one with your own.
- The persona, voice, and rules in the system prompt take 1,500 tokens.
- Retrieved memories and world facts take 500 tokens.
- Recent conversation history and the player’s new line take 1,000 tokens.
- The NPC replies with 60 tokens, about 45 words, or two or three spoken sentences.
- The player triggers 60 NPC turns per hour, one exchange a minute. That fits a dialogue-heavy game. A shooter with occasional barks may see fewer than 10.
- With caching on, 2,500 of the 3,000 input tokens hit the cache, because the persona, memories, and older history form a stable prefix.
- A player plays 20 hours a month.
Three models at list price
These are the list prices on 9 October 2026:
- Claude Sonnet 5.5 costs $2 input, $0.10 for cache hits, and $10 output, per Anthropic’s pricing page.
- Gemini 3.1 Flash-Lite costs $0.25 input, $0.025 cached, and $1.50 output for text on the paid tier, per Google’s Gemini API pricing.
- gpt-6-luna costs $0.10 input, $0.01 cached, and $0.50 output at the standard short-context rate, per OpenAI’s API pricing.
Here is the arithmetic for Claude Sonnet 5.5 without caching:
(3,000 x 2 + 60 x 10) / 1,000,000 = $0.0066 per turn
$0.0066 x 60 turns = $0.396 per player hour
With caching, 500 tokens are fresh and 2,500 are cache hits:
(500 x 2 + 2,500 x 0.10 + 60 x 10) / 1,000,000 = $0.00185 per turn
$0.00185 x 60 turns = $0.111 per player hour
The same steps give the full table. All figures are estimates built on the assumptions above.
| Model | Per hour, no cache | Per hour, cached | Per month, cached |
|---|---|---|---|
| Claude Sonnet 5.5 | $0.40 | $0.11 | $2.22 |
| Gemini 3.1 Flash-Lite | $0.050 | $0.017 | $0.33 |
| gpt-6-luna | $0.020 | $0.0063 | $0.13 |
Look at where the money goes. In the uncached Sonnet case, input accounts for $0.006 of the $0.0066 per turn, about 91%. The NPC rereads its whole persona on every line. That is why caching and a shorter prompt come before almost any other change.
The example leaves out several costs. Anthropic’s pricing page charges 1.25 times the input price to write a 5-minute cache entry, and Google’s Gemini API pricing adds an hourly storage charge for cached tokens. Reasoning tokens bill as output, and Google’s pricing table states its output price includes thinking tokens. A model that thinks for 500 tokens before a 60-token line multiplies output cost about ninefold. Speech recognition and text-to-speech have their own prices. Memory summaries, moderation checks, and retries are extra calls, and each one adds another line to the formula.
What moves the number
Model size changes the cost the most. Input on gpt-6-luna costs a twentieth of input on Claude Sonnet 5.5. A smaller model may hold a persona less well over a long conversation, so test it on your own characters before you commit.
Caching cut the Sonnet example from $0.40 to $0.11 per hour. To get cache hits, keep the persona and rules at the start of the prompt and put changing content last. OpenAI’s latency optimization guide gives the same advice for a shared prompt prefix. Cache lifetime matters for games. Anthropic’s pricing page lists a 5-minute and a 1-hour cache. A player who walks away from an NPC for ten minutes misses a 5-minute cache.
Routing sends each turn to the cheapest model that can handle it. Greetings, shop talk, and barks can go to a small model, and quest-critical scenes to a larger one. With an 80/20 split between the cached gpt-6-luna and cached Sonnet rows, the cost is 0.8 x $0.0063 + 0.2 x $0.111, or about $0.027 per player hour. The game already knows which NPC is speaking and what quest state applies, so a rule in game code can make the routing decision. It does not need another model call.
Capping output length is the simplest change. Output costs five to six times as much as input on all three models in the table. Set a maximum output length on every call. The same cap also cuts latency, as the next section shows.
Batch pricing helps work that can wait. Anthropic’s pricing page and OpenAI’s API pricing both list batch rates at half the standard price. Live dialogue cannot wait, but memory summaries written between play sessions can.
On-device inference removes the API bill and moves the cost to the player’s hardware. NVIDIA’s post on the In-Game Inferencing SDK lists Mistral-Nemo-Minitron models at 2B, 4B, and 8B parameters, a VRAM budget setting, and support for both local and cloud inference. The same post says AI work runs alongside rendering, so GPU scheduling matters for frame rate. A paper on fixed-persona small language models tested NPC dialogue with TinyLlama-1.1B and Mistral-7B on consumer hardware. Local inference has its own costs. Your minimum spec rises, the model competes with textures for VRAM, and phones and consoles get harder. You also ship model weights that a server-side config change cannot update.
Latency is the second budget
The second budget is time, measured in seconds per reply. A 2009 PNAS study of turn-taking in 10 languages by Tanya Stivers and colleagues found that speakers in every language minimize silence between turns. The average gap varied by language, but only within 250 milliseconds of the cross-language mean. A cloud model adds a network round trip, prompt processing, generation, and often speech synthesis. It will not match that gap, so design around it.
The OpenAI guide gives the order of effort. It says generating tokens is almost always the slowest step, and that cutting 50% of output tokens may cut about 50% of latency. Cutting 50% of the prompt may only gain 1 to 5%. The same guide calls streaming the most effective way to reduce waiting, to “a second or less”.
For an NPC, that points to a few concrete moves:
- Keep lines short. Two sentences cost less and arrive sooner than a paragraph.
- Stream text into the dialogue box as the model writes it.
- Start text-to-speech on the first finished sentence, not the whole reply.
- Play a canned in-character reaction, like a nod or “Hm”, while the model works.
- Route fast exchanges to a small model or a local one.
A reasonable target, as an opinion and not a measured threshold, is a visible or audible reaction within about one second. The reaction can be canned. The real line can follow.
How to cap spend in a free-to-play game
A free player costs the same per token as a paying one. In a free-to-play game, payers fund every hour that non-payers spend talking to NPCs. Run the formula against your own revenue per player hour before you ship. These controls keep the worst case bounded:
- Give each player a daily token budget and enforce it on your server, never in the client. Count tokens from the usage fields in each API response.
- When a player runs out, step down to the small model, then to authored lines. Make the fallback fit the fiction, such as a shopkeeper who is busy with another customer.
- Cap turns per conversation, and summarize old history so input size stays flat instead of growing each turn.
- Set a maximum output length on every call.
- Track AI cost per daily active user next to revenue per daily active user. Alert on outliers, such as a bot or a player who talks to one NPC for hours.
- Set a hard monthly limit in your provider’s console where one is available.
Prices change often. Gemini’s pricing page already lists Flash models whose prices double on 1 January 2027. Recheck the three price inputs before each budget review, because the formula stays the same while the prices move.
Related reading
- How AI NPCs work, for what each block of tokens in the prompt is for.
- What is an AI-native game studio, for why a studio would build its games around this cost line.
- Game design lifecycle vs software lifecycle, Rick’s essay on trying an experience before you commit to building it.
Questions
How much does an LLM NPC cost per player hour?
In a worked example at October 2026 list prices, with 60 NPC turns an hour, 3,000 input tokens and 60 output tokens per turn, the cost runs from about $0.006 to $0.40 per player hour. Small models with prompt caching sit at the low end and mid-size models without caching at the high end. Plug in your own token counts to get your own number.
What latency feels acceptable for a talking NPC?
People leave only a short gap between turns in conversation, so no cloud model matches a human reply. A practical target is a visible or audible reaction within about a second, from streamed text or a canned in-character reaction, with the full line following. Shorter replies cut latency the most because output generation is the slowest step.
Can small local models replace cloud APIs?
For some NPCs, yes. NVIDIA's In-Game Inferencing SDK runs 2B to 8B parameter models on the player's PC, and published research shows fine-tuned small models holding NPC personas on consumer hardware. The cost moves to the player's GPU memory and your minimum spec, so many games will mix local and cloud models.
How do you cap AI spend in a free-to-play game?
Give each player a daily token budget that your server enforces, cap reply length and conversation length, and route small talk to a cheap model. When the budget runs out, fall back to a smaller model or to authored lines that fit the fiction. Track AI cost per daily active user next to revenue per daily active user.