feat: configurable model pricing source#971
Open
Spherrrical wants to merge 1 commit into
Open
Conversation
Add models.dev as a built-in cost provider alongside DigitalOcean, each with an optional url override, honored by both brightstaff routing and the planoai obs cost column. DigitalOcean remains the default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes Plano's model pricing source configurable. Adds models.dev as a built-in cost provider alongside DigitalOcean (each with an optional
urloverride), honored by both brightstaff routing and theplanoai obscost column. DigitalOcean remains the default, and the source is swappable to models.dev or any endpoint exposing a supported pricing structure.Config
Changes
crates/common/src/configuration.rs—ModelsDevvariant onCostProvider(#[serde(rename = "models.dev")]) +url: Option<String>onCostMetricsConfig.crates/brightstaff/src/router/model_metrics.rs— provider-awarefetch_cost_pricingdispatcher, per-provider default URLs +urloverride, andfetch_models_dev_pricing(composesprovider/modelkeys to match Plano routing names; sums input+output per-million for ranking).config/plano_config_schema.yaml—models.devin the provider enum + optionalurl.cli/planoai/obs/pricing.py—_parse_models_dev_pricing(per-million → per-token,cache_read→ cached rate, 0-rate skip) andPricingCatalog.fetch(provider, url)dispatch; DigitalOcean default.cli/planoai/obs_cmd.py— reads the cost source from config with--config/--pricing-provider/--pricing-urloverrides; startup log names the active provider.docs/source/guides/llm_router.rst(DigitalOcean default, swappability, supported structures, model_aliases, obs cost column);model_metrics_sourcesexample added to the full reference config (+ regenerated_rendered.yaml).Test plan
cargo test -p common -p brightstaff --lib(incl. new models.dev parser + config deserialize tests)cargo fmt --checkandcargo clippy -D warningscleanpytest cli/test/test_obs_pricing.py(incl. new models.dev tests) — 10 passed; Black cleanconfig/validate_plano_config.sh— all configs validate, rendered reference matchesrouting_preferencesmodel names (usemodel_aliasesfor version skew)