How to estimate your LLM API bill
- Measure real token counts. Log
usagefrom a sample of real requests, or paste representative prompts into the token counter. Include the system prompt, tool schemas, conversation history, and retrieved context. - Separate input from output. Output costs several times more than input, so a chatty model or high reasoning effort can dominate the bill.
- Estimate your cache-hit share. A stable system prompt and tool list in front of a short user message can mean 70–90% of input tokens are cache hits.
- Multiply by volume. Requests per day × 30. For agents, one user task can mean 10–50 model calls, so use the agent cost calculator.
Ways to cut LLM API costs
- Prompt caching: put static content first and variable content last so the prefix can be reused.
- Batch APIs: Anthropic and OpenAI give 50% off for asynchronous jobs that can wait up to 24 hours.
- Model routing: send classification, extraction, and sub-agent work to a small model, and keep the frontier model for planning and hard reasoning.
- Shorter outputs: ask for structured, concise answers and tune reasoning effort per route.
Long-context pricing
Some models charge more once a prompt passes a threshold. Gemini Pro models bill prompts over 200K tokens at higher rates, and OpenAI's GPT-5.4 and later charge 2× input and 1.5× output above 272K input tokens. Claude 4.6 and later bill the full 1M context window at standard rates. The table uses short-context prices; check the notes in the pricing tab for each model's long-context rates.