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

Function _refresh_active_pricing

uncommon_route/proxy.py:2838–2855  ·  view source on GitHub ↗

Merge dynamic pricing (from discovery) with static fallback.

()

Source from the content-addressed store, hash-verified

2836 _circuit_breaker = CircuitBreakerRegistry()
2837
2838 def _refresh_active_pricing() -> None:
2839 """Merge dynamic pricing (from discovery) with static fallback."""
2840 nonlocal _routing_config
2841 global _active_pricing
2842 merged = dict(DEFAULT_MODEL_PRICING)
2843 dynamic = _mapper.dynamic_pricing
2844 if dynamic:
2845 merged.update(dynamic)
2846 _active_pricing = merged
2847
2848 import copy
2849 updated = copy.deepcopy(_routing_store.config())
2850 dynamic_caps = _mapper.dynamic_capabilities
2851 if dynamic_caps:
2852 merged_caps = dict(updated.model_capabilities)
2853 merged_caps.update(dynamic_caps)
2854 updated.model_capabilities = merged_caps
2855 _routing_config = updated
2856
2857 def _reload_providers() -> ProvidersConfig:
2858 nonlocal _providers, _semantic

Callers 4

_on_startupFunction · 0.85
_rediscovery_loopFunction · 0.85
handle_routing_configFunction · 0.85

Calls 2

configMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected