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

Function _estimate_cost_from_usage

uncommon_route/proxy.py:330–340  ·  view source on GitHub ↗
(model: str, usage: UsageMetrics)

Source from the content-addressed store, hash-verified

328
329
330def _estimate_cost_from_usage(model: str, usage: UsageMetrics) -> float | None:
331 pricing = _get_pricing().get(model)
332 if pricing is None:
333 return None
334 return estimate_usage_cost(
335 input_tokens_uncached=usage.input_tokens_uncached,
336 output_tokens=usage.output_tokens,
337 cache_read_input_tokens=usage.cache_read_input_tokens,
338 cache_write_input_tokens=usage.cache_write_input_tokens,
339 pricing=pricing,
340 )
341
342
343def _parse_usage_cost(content: bytes, model: str) -> float | None:

Callers 3

_parse_usage_costFunction · 0.85
_record_stream_successFunction · 0.85
_handle_chat_coreFunction · 0.85

Calls 3

estimate_usage_costFunction · 0.90
_get_pricingFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected