AI Agent API Pricing Comparator
Compare LLM API costs for your agent workload. Pick providers, set your token volume, and see the cheapest option ranked by monthly cost.
Workload
Prices per 1M tokens. Last updated: 2026-06-29. See notes.
| Provider / Model | Input | Cached input | Output | Monthly cost | Best for |
|---|---|---|---|---|---|
| OpenAI GPT-4o gpt-4o | $2.50 | $1.250 | $10.00 | — | General agent tasks, vision, tool use |
| OpenAI GPT-4o-mini gpt-4o-mini | $0.15 | $0.075 | $0.60 | — | Cheap high-volume agents |
| Anthropic Claude 3.5 Sonnet claude-3-5-sonnet-20240620 | $3.00 | $3.750 | $15.00 | — | Long context, reasoning, coding |
| Anthropic Claude 3 Haiku claude-3-haiku-20240307 | $0.25 | $0.030 | $1.25 | — | Fast, cheap agent calls |
| Google Gemini 1.5 Pro gemini-1.5-pro | $3.50 | — | $10.50 | — | Massive context, multimodal |
| Google Gemini 1.5 Flash gemini-1.5-flash | $0.35 | — | $1.05 | — | Low-latency, high-volume |
| Groq Llama 3.1 70B llama-3.1-70b-versatile | $0.59 | — | $0.79 | — | Fast open-weight inference |
| Together AI Llama 3.1 70B llama-3.1-70b | $0.90 | — | $0.90 | — | Open-weight fine-tuning hub |
| Cohere Command R+ command-r-plus | $2.50 | — | $10.00 | — | RAG and enterprise search |
Cheapest option
Enter a workload to see the cheapest provider.
Frequently asked questions
Which LLM API is cheapest for high-volume agents?
For most high-volume text agents, GPT-4o-mini, Claude 3 Haiku, and Gemini 1.5 Flash are the cheapest per 1M tokens. Groq Llama 3.1 70B is competitive for fast open-weight inference. Use this calculator with your actual token counts to find the cheapest provider for your workload.
How does cached input pricing work?
OpenAI and Anthropic discount input tokens that hit a context cache. Enter your typical cache-hit percentage and the calculator applies the cached-input rate to that portion while billing the rest at the standard input rate.
What is not included in this estimate?
This estimate covers token and request fees only. It does not include image/audio tokens, fine-tuning, storage, bandwidth, vector DB, or fallback/retry overhead. Use the LLM Cost Calculator and Agent Memory Cost Calculator for full agent TCO.
How often are prices updated?
Prices are reviewed monthly. Last updated: 2026-06-29. Always confirm current rates on the provider's pricing page before committing to a budget.
Prices are per 1M tokens in USD. Check provider sites for current rates.
🤖 Use this tool in your agent
✓ Agent-ready codeCopy the snippet below into your agent, newsletter, or script. The tool page at hermesdispatch.dev/tools/agent-api-pricing-comparator/ is the canonical contract: inputs, outputs, and formulas.
# Hermes Dispatch Tool — Agent API Pricing Comparator
# Source: https://hermesdispatch.dev/tools/agent-api-pricing-comparator/
# Description: Compare LLM API pricing across providers for a given token volume.
# License: MIT (generated by hermesdispatch.dev)
#
# INSTALL:
# 1. Save this file as ~/.hermes/hermes-agent/tools/agent_api_pricing_comparator.py
# 2. Restart Hermes or run /reset in a session
# 3. The tool auto-registers if Hermes uses auto-discovery of tools/*.py
#
# MANUAL REGISTRY (if auto-discovery is off):
# from tools.agent_api_pricing_comparator import register
# register()
import json
DATA = {"last_updated": "2026-06-29", "note": "Prices are per 1M tokens in USD. Check provider sites for current rates.", "providers": [{"name": "OpenAI GPT-4o", "model": "gpt-4o", "input_per_1m": 2.5, "output_per_1m": 10.0, "cached_input_per_1m": 1.25, "request_fee": 0.0, "context_window": 128000, "best_for": "General agent tasks, vision, tool use", "url": "https://openai.com/api/pricing/"}, {"name": "OpenAI GPT-4o-mini", "model": "gpt-4o-mini", "input_per_1m": 0.15, "output_per_1m": 0.6, "cached_input_per_1m": 0.075, "request_fee": 0.0, "context_window": 128000, "best_for": "Cheap high-volume agents", "url": "https://openai.com/api/pricing/"}, {"name": "Anthropic Claude 3.5 Sonnet", "model": "claude-3-5-sonnet-20240620", "input_per_1m": 3.0, "output_per_1m": 15.0, "cached_input_per_1m": 3.75, "request_fee": 0.0, "context_window": 200000, "best_for": "Long context, reasoning, coding", "url": "https://www.anthropic.com/pricing"}, {"name": "Anthropic Claude 3 Haiku", "model": "claude-3-haiku-20240307", "input_per_1m": 0.25, "output_per_1m": 1.25, "cached_input_per_1m": 0.03, "request_fee": 0.0, "context_window": 200000, "best_for": "Fast, cheap agent calls", "url": "https://www.anthropic.com/pricing"}, {"name": "Google Gemini 1.5 Pro", "model": "gemini-1.5-pro", "input_per_1m": 3.5, "output_per_1m": 10.5, "cached_input_per_1m": 0.0, "request_fee": 0.0, "context_window": 2000000, "best_for": "Massive context, multimodal", "url": "https://ai.google.dev/pricing"}, {"name": "Google Gemini 1.5 Flash", "model": "gemini-1.5-flash", "input_per_1m": 0.35, "output_per_1m": 1.05, "cached_input_per_1m": 0.0, "request_fee": 0.0, "context_window": 1000000, "best_for": "Low-latency, high-volume", "url": "https://ai.google.dev/pricing"}, {"name": "Groq Llama 3.1 70B", "model": "llama-3.1-70b-versatile", "input_per_1m": 0.59, "output_per_1m": 0.79, "cached_input_per_1m": 0.0, "request_fee": 0.0, "context_window": 131072, "best_for": "Fast open-weight inference", "url": "https://groq.com/pricing"}, {"name": "Together AI Llama 3.1 70B", "model": "llama-3.1-70b", "input_per_1m": 0.9, "output_per_1m": 0.9, "cached_input_per_1m": 0.0, "request_fee": 0.0, "context_window": 131072, "best_for": "Open-weight fine-tuning hub", "url": "https://www.together.ai/pricing"}, {"name": "Cohere Command R+", "model": "command-r-plus", "input_per_1m": 2.5, "output_per_1m": 10.0, "cached_input_per_1m": 0.0, "request_fee": 0.0, "context_window": 128000, "best_for": "RAG and enterprise search", "url": "https://cohere.com/pricing"}]}
def _ok(result):
return json.dumps({"success": True, "data": result}, indent=2)
def _err(message):
return json.dumps({"success": False, "error": message}, indent=2)
TOOL_NAME = "agent_api_pricing_comparator"
TOOLSET = "agents"
SCHEMA = {
"type": "function",
"function": {
"name": "agent_api_pricing_comparator",
"description": "Compare LLM API pricing across providers for a given token volume.",
"parameters": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"description": "Input tokens per request."
},
"output_tokens": {
"type": "integer",
"description": "Output tokens per request."
},
"provider": {
"type": "string",
"description": "Optional provider name: OpenAI GPT-4o, OpenAI GPT-4o-mini, Anthropic Claude 3.5 Sonnet, Anthropic Claude 3 Haiku, Google Gemini 1.5 Pro, Google Gemini 1.5 Flash, Groq Llama 3.1 70B, Together AI Llama 3.1 70B, Cohere Command R+"
}
},
"required": []
}
}
}
def _run(args):
input_tokens = int(args.get("input_tokens", 1000))
output_tokens = int(args.get("output_tokens", 500))
provider_name = args.get("provider", None)
providers = [p for p in DATA["providers"] if p["name"] == provider_name] if provider_name else DATA["providers"]
results = []
for p in providers:
in_cost = (input_tokens / 1_000_000) * p.get("input_per_1m", 0)
out_cost = (output_tokens / 1_000_000) * p.get("output_per_1m", 0)
results.append({
"provider": p["name"],
"model": p.get("model", ""),
"input_cost": round(in_cost, 5),
"output_cost": round(out_cost, 5),
"total_cost": round(in_cost + out_cost, 5),
})
results.sort(key=lambda x: x["total_cost"])
return _ok({"results": results[:5], "input_tokens": input_tokens, "output_tokens": output_tokens})
def HANDLER(args):
try:
return _run(args)
except Exception as e:
return _err(str(e))
def register():
"""Manual registry hook. Import and call this to register with Hermes."""
try:
from tools.registry import registry
registry.register(
name=TOOL_NAME,
toolset=TOOLSET,
schema=SCHEMA,
handler=HANDLER,
)
except ImportError:
print("Hermes registry not found; skipping manual registration.")
if __name__ == "__main__":
# CLI smoke test
print(HANDLER({}))
Want early access to the next locked tool? Subscribe to The Hermes Dispatch.