Skip to content

mohdel v0.104.0

Choose a tag to compare

@clbrge clbrge released this 09 May 17:10
· 50 commits to main since this release

Added

  • Anthropic prompt caching. splitPrompt translates structured system
    messages with cache: '5m' | '1h' markers into Anthropic's typed
    cache_control: { type: 'ephemeral', ttl?: '1h' } blocks. The adapter
    now extracts cache_creation_input_tokens and cache_read_input_tokens
    from message_start.usage and surfaces them on AnswerResult and via
    costFor.
  • OpenAI / chat-completions cache reporting. OpenAI Responses,
    cerebras, fireworks, and xAI adapters extract
    prompt_tokens_details.cached_tokens and convert the OpenAI "subset
    of prompt_tokens" convention into mohdel's additive
    cacheReadInputTokens field. Caller code sees one consistent shape
    regardless of provider semantics.
  • AnswerResult.cacheWriteInputTokens / cacheReadInputTokens
    added to the type definition. Symmetric write/read pair matching
    catalog cacheWritePrice/cacheReadPrice; Anthropic's
    cache_creation_input_tokens is normalized into cacheWriteInputTokens
    at the adapter boundary.
  • computeCost honours cacheWritePrice and cacheReadPrice in
    catalog specs, falling back to inputPrice when absent so non-caching
    providers degrade gracefully. Pricing is additive: i*ip + cw*cwp + cr*crp + o*op + t*tp.

Changed

  • Deps: @google/genai ^2.0.0 → ^2.0.1.