|
17 | 17 | _BYTES_PER_TOKEN = 4 # ~4 bytes per token (rough but consistent) |
18 | 18 |
|
19 | 19 | # Input token pricing ($ per token). Update as models reprice. |
20 | | -_PRICING = { |
21 | | - "claude_opus": 15.00 / 1_000_000, # Claude Opus — $15/1M input tokens |
22 | | - "gpt4o": 2.50 / 1_000_000, # GPT-4o — $2.50/1M input tokens |
| 20 | +PRICING = { |
| 21 | + "claude_opus": 5.00 / 1_000_000, # Claude Opus 4.6 — $5.00 / 1M input tokens |
| 22 | + "gpt5_latest": 1.75 / 1_000_000, # GPT-5.2 (latest flagship GPT) — $1.75 / 1M input tokens |
23 | 23 | } |
24 | 24 |
|
25 | 25 |
|
@@ -66,18 +66,18 @@ def cost_avoided(tokens_saved: int, total_tokens_saved: int) -> dict: |
66 | 66 | """Return cost avoided estimates for this call and the running total. |
67 | 67 |
|
68 | 68 | Returns a dict ready to be merged into a _meta envelope: |
69 | | - cost_avoided: {claude_opus: float, gpt4o: float} |
70 | | - total_cost_avoided: {claude_opus: float, gpt4o: float} |
| 69 | + cost_avoided: {claude_opus: float, gpt5_latest: float} |
| 70 | + total_cost_avoided: {claude_opus: float, gpt5_latest: float} |
71 | 71 |
|
72 | 72 | Values are in USD, rounded to 4 decimal places. |
73 | 73 | """ |
74 | 74 | return { |
75 | 75 | "cost_avoided": { |
76 | 76 | model: round(tokens_saved * rate, 4) |
77 | | - for model, rate in _PRICING.items() |
| 77 | + for model, rate in PRICING.items() |
78 | 78 | }, |
79 | 79 | "total_cost_avoided": { |
80 | 80 | model: round(total_tokens_saved * rate, 4) |
81 | | - for model, rate in _PRICING.items() |
| 81 | + for model, rate in PRICING.items() |
82 | 82 | }, |
83 | 83 | } |
0 commit comments