MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / estimate_usage_cost

Function estimate_usage_cost

uncommon_route/cache_support.py:431–444  ·  view source on GitHub ↗
(
    *,
    input_tokens_uncached: int,
    output_tokens: int,
    cache_read_input_tokens: int,
    cache_write_input_tokens: int,
    pricing: ModelPricing,
)

Source from the content-addressed store, hash-verified

429
430
431def estimate_usage_cost(
432 *,
433 input_tokens_uncached: int,
434 output_tokens: int,
435 cache_read_input_tokens: int,
436 cache_write_input_tokens: int,
437 pricing: ModelPricing,
438) -> float:
439 return estimate_input_cost(
440 input_tokens_uncached=input_tokens_uncached,
441 cache_read_input_tokens=cache_read_input_tokens,
442 cache_write_input_tokens=cache_write_input_tokens,
443 pricing=pricing,
444 ) + ((output_tokens / 1_000_000) * pricing.output_price)
445
446
447def _stable_prompt_cache_key(

Callers 3

parse_usage_metricsFunction · 0.85

Calls 1

estimate_input_costFunction · 0.85

Tested by

no test coverage detected