cache-tax 1.0.3: price Sonnet 5, date the lapse from expiry - #65
Merged
Merged
Conversation
Sonnet 5 matched the generic sonnet row and was priced at Sonnet 4.x rates. A sonnet-5 row with the platform list prices (0.20 read, 2.50 5m write, 4 1h write, dollars per million tokens) now wins the longest-key match, and sonnet-4-6 still lands on the old row. The guard, the card and the status line said "lapsed X ago" with X being the time since the last request, not the time since the cache expired. The state now carries lapsedSec, the age minus the tier TTL clamped at zero, and all three use it. A session three hours old on the 1h tier reads "lapsed 2h00m ago", not "3h00m ago". README: Sonnet 5 listed separately in the built-in rates, the verbatim guard example updated, and the decision section says what the lapsed figure measures. Plugin version 1.0.2 to 1.0.3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sonnet-5price row[0.2, 2.5, 4](cache read, 5m write, 1h write, dollars per million tokens) now takes precedence through the longest-key match;claude-sonnet-4-6still resolves tosonnet.Details
plugins/cache-tax/cache-tax.jsDEFAULT_PRICESgains'sonnet-5': [0.2, 2.5, 4]above thesonnetrow; the matcher comment now cites sonnet-5 over sonnet as its example.stateFromaddslapsedSec: Math.max(0, -leftSec)to the live state (andlapsedSec: 0on the compacted branch so the shape is stable).leftSecand the warm "cache Nm left" text are unchanged.statusLine("cache LAPSED X ago"),guardMessage("the 1h prompt cache lapsed X ago") andrenderCard("COLD, lapsed X ago") formatst.lapsedSecinstead ofst.ageSec. The compacted "reset by /compact X ago" line still usesageSec, which is correct there.plugins/cache-tax/README.md[0.2, 2.5, 4]separately from Sonnet 4.x[0.3, 3.75, 6].plugins/cache-tax/.claude-plugin/plugin.jsonversion1.0.2 to 1.0.3.plugins/cache-tax/tests/cache-tax.test.jsclaude-sonnet-5maps tosonnet-5,claude-sonnet-4-6tosonnet.prices Sonnet 5 below Sonnet 4.x:priceForreturns[0.2, 2.5, 4]for sonnet-5 and[0.3, 3.75, 6]for sonnet-4-6.lapsedSecis about 3600 for a two-hour-old block on the 1h tier.cache LAPSED 1h00m ago.the 1h prompt cache lapsed 2h00m ago.COLD, lapsed 2h00m ago; cost and session totals unchanged.Test plan
npm testfrom the repo root: 1929 pass, 0 fail, 0 skipped (1928 before this change, one test added).git diff --check origin/main: clean.