feat: model limit config + /v1/models cost+limit metadata #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "trevin/feat/model-limits-cost-metadata"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
limitconfig (context/input/outputtoken limits) with per-provider override support, mirroring the existingpricingresolution chain (provider override → model default →None).GET /v1/modelsto exposecostandlimitas additive non-standard fields, sourced from the primary (highest-priority) provider's resolved values.opencode-aorplugin) populate cost-tracking and context-window displays without a separate catalog like models.dev.Changes
aor/config.py:LimitConfigpydantic model, added toModelConfig,ModelProviderOverride,CandidateProvider, andResolvedModel. Resolution: provider override → model default →None.aor/models_endpoint.py:costandlimitfields exposed in/v1/modelsresponse (omitted when not set).config.example.toml: limit examples at model level + per-provider override.docs/requirements-key-budgets.md: new section documenting limit config,/v1/modelsmetadata exposure, and when to split models with greatly varying limits/pricing into separate catalog entries.tests/test_config.py: 6 new tests for limit config resolution.tests/test_proxy.py: 1 new test for/v1/modelscost+limit exposure.When to split models
When limits or pricing vary greatly across providers for the same model, consider splitting into separate catalog models so downstream clients get deterministic metadata per model selection. See
docs/requirements-key-budgets.mdfor details.Testing
Depends on
PR #4 (
trevin/feat/key-budgets-spend-visibility) — this branch is based on it sincepricingconfig andPricingConfiglive there.