[management, proxy] Management-owned LLM pricing: file-backed defaults +

operator prices, delivered via cost_meter middleware config

  Operator-pinned model prices (ProviderModel.InputPer1k/OutputPer1k) were
  stored and round-tripped through the API but never consumed for billing:
  the proxy priced exclusively from a defaults_pricing.yaml embedded in
  its binary. Any model outside that file recorded $0 spend, price changes
  required a proxy release, and the catalog and the YAML were two
  hand-synced copies of the same rates, guarded only by a manually
  maintained coverage list that had already drifted.
This commit is contained in:
braginini
2026-07-29 16:49:37 +02:00
parent dd2bdc0de3
commit 2316c20a2b
39 changed files with 2362 additions and 1526 deletions
+1 -5
View File
@@ -246,10 +246,6 @@ type Server struct {
// in processMappings before the receive loop reconnects to resync.
// Zero uses defaultMappingBatchWatchdog.
MappingBatchWatchdog time.Duration
// MiddlewareDataDir is the base directory the middleware system uses to
// resolve file-backed configuration (e.g. the cost_meter pricing table).
// Empty means any middleware that requires a file fails at configure time.
MiddlewareDataDir string
// MiddlewareCaptureBudgetBytes overrides the proxy-wide in-flight capture
// budget passed to middleware.NewManager. Zero or negative values fall
// back to defaultMiddlewareCaptureBudgetBytes (256 MiB).
@@ -2093,7 +2089,7 @@ func (s *Server) initMiddlewareManager(ctx context.Context) error {
return fmt.Errorf("middleware manager requires metrics bundle")
}
otelMeter := s.meter.Meter()
mwbuiltin.Configure(ctx, s.MiddlewareDataDir, otelMeter, s.Logger, s.mgmtClient)
mwbuiltin.Configure(ctx, otelMeter, s.Logger, s.mgmtClient)
mwMetrics, err := middleware.NewMetrics(otelMeter)
if err != nil {