tx: add claude-sonnet-5 pricing entries - #34
Merged
Conversation
Match upstream main's post-v0.8.7 additions. Rates are the current promotional pricing (through 2026-08-31): - base: $2 prompt / $10 completion per MTok - cache: $2.50 write / $0.20 read per MTok Without these entries, LibreChat's balance meter falls back to `defaultRate = 6` for both prompt and completion — flat $6/M applied to Sonnet 5 traffic instead of the correct 2/10 split. That over-meters input tokens (esp. the cached 40k system-prompt prefix) so users hit the balance cap earlier than the actual AWS spend justifies. Post-2026-09-01 the Anthropic rate flips to $3/$15 + $3.75/$0.30 cache. Upstream may or may not update these constants on that date — worth re-checking around then.
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.
Two-line addition to
packages/data-schemas/src/methods/tx.tsmatching upstream main's post-v0.8.7 pricing additions for Sonnet 5:prompt: 2, completion: 10(per MTok, promo)write: 2.5, read: 0.2(per MTok, promo)Why
Prod flipped all 6 modelSpec agents to
us.anthropic.claude-sonnet-5today. Our fork's tx.ts pricing table was missing the entry, so LibreChat's balance-meter fallback (defaultRate = 6) was charging users a flat $6/M for BOTH input and output. That over-counts cached input especially — the 40k system-prompt prefix gets billed at 60x its actual read rate.Net effect: users hit their 20M (203) or 80M (666) weekly token cap faster than they should.
Post-Sept 1 note
Anthropic's promo pricing ends 2026-08-31. On Sept 1 the rate flips to $3/$15 base + $3.75/$0.30 cache. Upstream may or may not push the update on that date — check back around then and bump these constants if upstream lags.