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

Function _pricing_for_model

uncommon_route/router/selector.py:61–71  ·  view source on GitHub ↗

Use conservative pricing for unknown models instead of treating them as free.

(model: str, pricing: dict[str, ModelPricing])

Source from the content-addressed store, hash-verified

59
60
61def _pricing_for_model(model: str, pricing: dict[str, ModelPricing]) -> ModelPricing:
62 """Use conservative pricing for unknown models instead of treating them as free."""
63 candidate = pricing.get(model) or DEFAULT_MODEL_PRICING.get(model) or _UNKNOWN_MODEL_PRICING
64 if (
65 candidate.input_price < 0
66 or candidate.output_price < 0
67 or not math.isfinite(candidate.input_price)
68 or not math.isfinite(candidate.output_price)
69 ):
70 return _UNKNOWN_MODEL_PRICING
71 return candidate
72
73
74def _stabilize_agent_step_selection(features: RoutingFeatures) -> bool:

Callers 2

_calc_costFunction · 0.85
_normalized_costsFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected