Pricing admission for budgeted native streams (CORE-48)¶
The opt-in native compatibility /stream route requires a price for the
configured model whenever a TokenBudgetTracker is installed. It resolves the
model from the composed Agent before creating a session or calling the
provider, then asks calculate_cost_with_meta whether pricing is known. An
unknown model returns HTTP 503 with native_stream_unavailable. Install a
full row with register_pricing_overrides before serving that model. An app
that already applies FrameworkConfig.pricing_overrides can use that path to
populate the same registry. A row whose rates are explicitly zero is a known
free model and is admitted; a missing row that calculates to zero is not.
This check uses the same pricing registry and override precedence as the
TokenBudgetTracker cost calculation. The existing streaming usage contract
still requires measured input or output usage on every model round before a
successful SSE terminal. A priced stream can exceed a budget on its last call;
the breaker refuses the next request after that usage is recorded.
The pre-model check can attest only the model name resolved in the Agent
plan. A dynamic gateway may route that name to another billed SKU, change
rates during a stream, or report usage for a model different from the plan.
The current telemetry stage bills the plan's model name and does not publish
the gateway's final SKU as an authenticated per-round pricing identity. An
operator using such a gateway must pin its routing and maintain a matching
price override, or keep the budgeted native route disabled until the actual
SKU can be attested per round. A matching override is an operator price
contract for the configured name, not proof of a gateway's downstream bill.