Skip to content

Price cache writes separately (cacheWrite column) #53

Open

Description

@solvyxtech

The cost meter bills Anthropic cache-write tokens at the base input rate. Anthropic publishes 1.25x base input for 5-minute cache writes and 2x for 1-hour writes, so sessions that write a lot of cache are under-counted, which is the unsafe direction for a /budget ceiling.

The engine already tracks cacheWriteTokens (src/stream.ts, src/anthropic.ts usageFor), but Pricing (src/providers.ts) has only in, out and cached, and costUsd() in src/engine.ts prices written tokens as fresh input.

Proposed: add a cacheWrite rate to Pricing and to ANTHROPIC_PRICES (1.25x input for the 5-minute cache Maat uses), carry it through setPricing / /price / the stored endpoint, and bill sessionCacheWrite at that rate in costUsd().

Raised in review of #52, which left cache writes unchanged on purpose.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claudeOwned by claude

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions