[PR #6904] [management, proxy] Meter custom provider model costs #29218

Open
opened 2026-08-05 08:07:41 -04:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/6904

State: open
Merged: No


Summary

  • propagate valid configured provider model prices into synthesized cost-meter middleware config
  • meter prices by the router-resolved provider ID and model, with static pricing as the fallback
  • preserve provider cache-token semantics using configured input prices

Closes #6888

Testing

  • go test ./management/internals/modules/agentnetwork ./proxy/internal/middleware/builtin/cost_meter -count=1
  • go test ./proxy/... -count=1

Checklist

  • Documentation is not needed

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features
    • Added provider- and model-specific pricing overrides for cost calculations.
    • Exact pricing can be applied when provider and model details are available.
    • Generated pricing configuration now includes valid pricing for reachable, enabled providers and configured models.
  • Bug Fixes
    • Invalid, placeholder, or zero-value overrides no longer replace built-in pricing.
    • Cache-related costs now use the appropriate configured input rates when applicable.
  • Tests
    • Expanded coverage for pricing overrides, cache fallback behavior, and zero-price fallback.
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/6904 **State:** open **Merged:** No --- ## Summary - propagate valid configured provider model prices into synthesized cost-meter middleware config - meter prices by the router-resolved provider ID and model, with static pricing as the fallback - preserve provider cache-token semantics using configured input prices Closes #6888 ## Testing - `go test ./management/internals/modules/agentnetwork ./proxy/internal/middleware/builtin/cost_meter -count=1` - `go test ./proxy/... -count=1` ## Checklist - [x] Documentation is **not needed** <!-- codesmith:footer --> --- <a href="https://app.blacksmith.sh/netbirdio/codesmith/netbird/pr/6904"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v2.svg"><img alt="View with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1787652786&installation_model_id=427504&pr_number=6904&repository=netbirdio%2Fnetbird&return_to=https%3A%2F%2Fgithub.com%2Fnetbirdio%2Fnetbird%2Fpull%2F6904&signature=b71e0492609813cea64ea43d33e17148c64387cd174d6a5beb2b6022966c242c"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"></picture></a> <sup>Need help on this PR? Tag <code>@codesmith-bot</code> with what you need. Autofix is disabled.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added provider- and model-specific pricing overrides for cost calculations. * Exact pricing can be applied when provider and model details are available. * Generated pricing configuration now includes valid pricing for reachable, enabled providers and configured models. * **Bug Fixes** * Invalid, placeholder, or zero-value overrides no longer replace built-in pricing. * Cache-related costs now use the appropriate configured input rates when applicable. * **Tests** * Expanded coverage for pricing overrides, cache fallback behavior, and zero-price fallback. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
saavagebueno added the pull-request label 2026-08-05 08:07:41 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#29218