Commit 5608fb2
[OPIK-8242] fix: price models with compact YYYYMMDD date suffixes
DATE_SUFFIX_PATTERN only stripped hyphen-separated dates (-2025-12-17),
but Anthropic ships compact dates on every dated model id
(claude-haiku-4-5-20251001). The date fallback in findModelPrice therefore
never fired for them, so a compact-dated name priced correctly only when it
was present verbatim in the price table. Any name needing normalization fell
through every fallback to DEFAULT_COST and reported $0 -- silently, with
token counts still captured.
Most visible via the alias_of entries: "claude-4-6-opus" -> "claude-opus-4-6"
already exists for reversed family/version ordering, so
anthropic/claude-4.6-opus prices at $5/$25, but
anthropic/claude-4.6-opus-20260205 resolved to $0 because the compact date
could not be stripped before the alias lookup. Also hit new releases before
the daily LiteLLM sync picks them up, and is not Anthropic-specific.
Observed in production: 71,442 of ~131,000 LLM spans in one project priced at
$0, hiding ~$4,470 of spend and inflating a 60-day cost delta to +573,216%
where actual spend was flat (~+3%).
Make both separators optional. Month/day ranges are kept so an arbitrary
8-digit build number is not mistaken for a date and cannot collapse a distinct
model onto another model's price row.
The pricing arithmetic itself was verified correct and is unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 867d65e commit 5608fb2
2 files changed
Lines changed: 80 additions & 3 deletions
File tree
- apps/opik-backend/src
- main/java/com/comet/opik/domain/cost
- test/java/com/comet/opik/domain/cost
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
| |||
276 | 281 | | |
277 | 282 | | |
278 | 283 | | |
279 | | - | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
280 | 289 | | |
281 | 290 | | |
282 | 291 | | |
| |||
Lines changed: 69 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
375 | 376 | | |
376 | 377 | | |
377 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
378 | 441 | | |
379 | 442 | | |
380 | 443 | | |
| |||
965 | 1028 | | |
966 | 1029 | | |
967 | 1030 | | |
968 | | - | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
969 | 1037 | | |
970 | 1038 | | |
971 | 1039 | | |
| |||
0 commit comments