Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generative/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def is_maintainer() -> bool:
# cache_write = 1,25x Input-Preis (bei 1h-TTL wären es 2x — hier nicht der Fall, #240).
MODEL_PRICING: dict[str, dict[str, float]] = {
# Claude (Anthropic API) — https://anthropic.com/pricing
"claude-opus-4-7": {"input": 15.0, "output": 75.0, "cache_read": 1.50, "cache_write": 18.75},
"claude-opus-4-7": {"input": 5.0, "output": 25.0, "cache_read": 0.50, "cache_write": 6.25},
"claude-sonnet-4-6": {"input": 3.0, "output": 15.0, "cache_read": 0.30, "cache_write": 3.75},
"claude-haiku-4-5": {"input": 0.80, "output": 4.0, "cache_read": 0.03, "cache_write": 1.0},
# Gemini (Google API) — https://ai.google.dev/pricing
Expand Down
4 changes: 2 additions & 2 deletions generative/tests/test_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ def test_opus_cost():
cost = compute_cost_per_call(
model="claude-opus-4-7", input_tokens=1_000_000, output_tokens=1_000_000, cache_read_tokens=0
)
assert abs(cost - 90.0) < 0.01 # $15 input + $75 output per M
assert abs(cost - 30.0) < 0.01 # $5 input + $25 output per M


def test_opus_cost_with_prefix():
with patch("generative.config.BACKEND", "api"):
cost = compute_cost_per_call(
model="anthropic/claude-opus-4-7", input_tokens=1_000_000, output_tokens=1_000_000, cache_read_tokens=0
)
assert abs(cost - 90.0) < 0.01 # provider-Prefix wird gestrippt
assert abs(cost - 30.0) < 0.01 # provider-Prefix wird gestrippt


def test_haiku_cache_read():
Expand Down
Loading