Provides Anthropic cache pricing calculations and checks for standard pricing.
// Source: https://github.com/PrimeIntellect-ai/prime-agent | License: MIT | Copyright 2025-2026 Prime Intellect Ltd
// Provided via justclaw.it.com; keep this notice with the code.
//! Anthropic prompt-cache pricing helpers.
use crate::types::Model;
pub type AnthropicCacheDuration = &'static str; // "5m" | "1h"
pub const ANTHROPIC_CACHE_READ_COST_MULTIPLIER: f64 = 0.1;
pub const ANTHROPIC_FIVE_MINUTE_CACHE_WRITE_COST_MULTIPLIER: f64 = 1.25;
pub const ANTHROPIC_ONE_HOUR_CACHE_WRITE_COST_MULTIPLIER: f64 = 2.0;
/// Anthropic `cache_creation` usage block carried on the wire.
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AnthropicCacheCreationUsage {
#[serde(rename = "ephemeral_5m_input_tokens", default)]
pub ephemeral_5m_input_tokens: u6
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key