Skip to content

Replay your coding agent sessions as a map and a timeline

Price six unpriced models from their providers' pages

Muhammad Aiman4c0f18ccedff
diff --git a/python/src/agentplay/_core/pricing.py b/python/src/agentplay/_core/pricing.py
index d8c633d..aa4c348 100644
--- a/python/src/agentplay/_core/pricing.py
+++ b/python/src/agentplay/_core/pricing.py
@@ -98,6 +98,15 @@ MODEL_RATES: dict[str, dict[str, float] | None] = {
# Verified 2026-09-11: the planned September increase was cancelled.
# https://platform.claude.com/docs/en/about-claude/pricing
"claude-sonnet-5": {"input": 2.0, "output": 10.0},
+ # Verified 2026-10-26: https://platform.claude.com/docs/en/about-claude/pricing
+ # $2/$10, 5m write $2.50 (default 1.25x). Cache reads are 0.05x input
+ # ($0.10), NOT the default 0.1x - same rule as Opus 5.5.
+ "claude-sonnet-5-5": {
+ "input": 2.0,
+ "output": 10.0,
+ "cache_read": 0.10,
+ "cache_write": 2.50,
+ },
"claude-sonnet-4-6": {"input": 3.0, "output": 15.0},
"claude-sonnet-4-5": {"input": 3.0, "output": 15.0},
"claude-sonnet-4-5-20250929": {"input": 3.0, "output": 15.0},
@@ -108,6 +117,17 @@ MODEL_RATES: dict[str, dict[str, float] | None] = {
"claude-sonnet-4": {"input": 3.0, "output": 15.0},
"claude-haiku-4-5": {"input": 1.0, "output": 5.0},
"claude-haiku-4-5-20251001": {"input": 1.0, "output": 5.0},
+ # Verified 2026-10-26: https://platform.claude.com/docs/en/about-claude/pricing
+ # $0.10/$0.50 for prompts up to 100K tokens (cache read $0.01 and 5m write
+ # $0.125 are the default multipliers). Prompts over 100K are $0.50/$2.50
+ # with cache rates scaled the same way: 5x input, cache and output.
+ "claude-haiku-5-5": {
+ "input": 0.10,
+ "output": 0.50,
+ "long_context_threshold": 100_000,
+ "long_context_input_multiplier": 5.0,
+ "long_context_output_multiplier": 5.0,
+ },
"claude-3-7-sonnet-latest": {"input": 3.0, "output": 15.0},
"claude-3-5-sonnet-20241022": {"input": 3.0, "output": 15.0},
# Haiku 3.5 (not 4.5) really is $0.80/$4.00 — do not "fix" to match 4.5.
@@ -181,6 +201,23 @@ MODEL_RATES: dict[str, dict[str, float] | None] = {
"long_context_input_multiplier": 2.0,
"long_context_output_multiplier": 1.5,
},
+ # Verified 2026-10-26: https://developers.openai.com/api/docs/models/gpt-6-sol
+ # $2/$10, cached input $0.20, cache writes $2.50 (1.25x). Above 272K input
+ # tokens: 2x input and cache, 1.5x output for the full request.
+ "gpt-6-sol": {
+ "input": 2.0,
+ "output": 10.0,
+ "cache_read": 0.20,
+ "cache_write": 2.50,
+ "long_context_threshold": 272_000,
+ "long_context_input_multiplier": 2.0,
+ "long_context_output_multiplier": 1.5,
+ },
+ # Verified 2026-10-26: https://developers.openai.com/api/docs/models/o3 and
+ # https://developers.openai.com/api/docs/models/o4-mini (Standard tier).
+ # No cache-write rate is published, so writes bill as ordinary input.
+ "o3": {"input": 2.0, "output": 8.0, "cache_read": 0.50, "cache_write": 2.0},
+ "o4-mini": {"input": 1.10, "output": 4.40, "cache_read": 0.275, "cache_write": 1.10},
# GPT-5.3-Codex-Spark is a RESEARCH PREVIEW with no OpenAI-published rate
# card as of 2026-07. ESTIMATE: priced at the base gpt-5.3-codex API card
# ($1.75/$14) — the assumption third-party estimators also make — because a
@@ -220,6 +257,17 @@ MODEL_RATES: dict[str, dict[str, float] | None] = {
"gemini-3-flash": {"input": 0.5, "output": 3.0},
"gemini-2.0-flash": {"input": 0.1, "output": 0.4},
"gemini-1.5-pro": {"input": 1.25, "output": 5.0},
+ # Verified 2026-10-26: https://ai.google.dev/gemini-api/docs/pricing
+ # $1.25/$10 and cache read $0.125 for prompts up to 200K tokens; above
+ # that $2.50/$15 and $0.25: 2x input and cache, 1.5x output.
+ "gemini-2.5-pro": {
+ "input": 1.25,
+ "output": 10.0,
+ "cache_read": 0.125,
+ "long_context_threshold": 200_000,
+ "long_context_input_multiplier": 2.0,
+ "long_context_output_multiplier": 1.5,
+ },
"gemini-1.5-flash": {"input": 0.075, "output": 0.3},
# ── Zhipu (Z.ai) ────────────────────────────────────────────────────────
# GLM-5.2 — $1.40/$4.40 on the official Z.ai API, per
diff --git a/python/tests/core/test_pricing.py b/python/tests/core/test_pricing.py
new file mode 100644
index 0000000..e7bc6d5
--- /dev/null
+++ b/python/tests/core/test_pricing.py
@@ -0,0 +1,45 @@
+from __future__ import annotations
+
+import pytest
+
+from agentplay import builder as sm
+from agentplay._core.pricing import MODEL_RATES, normalize_model_key
+
+M = 1_000_000
+
+# Published per-1M prices (input, cache read, output), copied from each
+# provider's page rather than derived from the card, so a wrong multiplier
+# fails here. A second row is the long-context tier where one exists.
+PUBLISHED = {
+ "claude-sonnet-5-5": [(2.0, 0.10, 10.0)],
+ "claude-haiku-5-5": [(0.10, 0.01, 0.50), (0.50, 0.05, 2.50)],
+ "gpt-6-sol": [(2.0, 0.20, 10.0), (4.0, 0.40, 15.0)],
+ "o3": [(2.0, 0.50, 8.0)],
+ "o4-mini": [(1.10, 0.275, 4.40)],
+ "gemini-2.5-pro": [(1.25, 0.125, 10.0), (2.50, 0.25, 15.0)],
+}
+
+
[email protected]("model", PUBLISHED)
+def test_model_resolves_to_a_rate(model):
+ assert MODEL_RATES.get(normalize_model_key(model))
+
+
[email protected]("model", PUBLISHED)
+def test_base_tier_matches_the_published_price(model):
+ # 10K input tokens: below every long-context threshold.
+ inp, read, out = PUBLISHED[model][0]
+ n = 10_000
+ assert sm.estimate_cost_usd(model, n, 0, 0, 0) == pytest.approx(inp * n / M)
+ assert sm.estimate_cost_usd(model, 0, 0, n, 0) == pytest.approx(read * n / M)
+ assert sm.estimate_cost_usd(model, 0, 0, 0, M) == pytest.approx(out)
+
+
[email protected]("model", [m for m, rows in PUBLISHED.items() if len(rows) > 1])
+def test_long_context_tier_matches_the_published_price(model):
+ # One request one token over the threshold is billed entirely at the
+ # published long-context prices; one at the threshold is not.
+ threshold = MODEL_RATES[normalize_model_key(model)]["long_context_threshold"]
+ for tokens, (inp, read, out) in ((threshold, PUBLISHED[model][0]), (threshold + 1, PUBLISHED[model][1])):
+ cost = sm.estimate_cost_usd(model, 1, 0, tokens - 1, M)
+ assert cost == pytest.approx((inp + (tokens - 1) * read + M * out) / M)