[GH-ISSUE #6888] Agent Network: use configured custom-provider model prices for cost metering #12272

Open
opened 2026-08-05 01:32:46 -04:00 by saavagebueno · 2 comments
Owner

Originally created by @dyld-w on GitHub (Jul 24, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/6888

Scenario

I use Fireworks through an Agent Network custom/OpenAI-compatible provider. I define models on that provider with non-zero per-1k input and output prices, including:

accounts/fireworks/models/glm-5p2

Actual behavior

A successful streamed request for this configured model reports:

{
  "plg.llm.model": "accounts/fireworks/models/glm-5p2",
  "plg.llm.input_tokens": "307816",
  "plg.llm.output_tokens": "1364",
  "plg.llm.total_tokens": "309180",
  "plg.llm.cost_usd": "0.000000"
}

Configured model pricing is not propagated to cost calculation. This makes Usage Overview cost reporting and USD budget enforcement inaccurate for custom-provider models.

Expected behavior

For a request routed through a configured custom provider, calculate plg.llm.cost_usd from that provider model's configured values:

cost_usd =
  input_tokens / 1000 * input_per_1k +
  output_tokens / 1000 * output_per_1k

For this request, configured non-zero prices must produce non-zero cost.

Requested fix

Use pricing configured in Agent Network provider models[] for cost metering of that provider's models. Price lookup must be scoped to configured provider plus model ID, so different custom providers may set different prices for the same model ID.

Originally created by @dyld-w on GitHub (Jul 24, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/6888 ## Scenario I use Fireworks through an Agent Network custom/OpenAI-compatible provider. I define models on that provider with non-zero per-1k input and output prices, including: ```text accounts/fireworks/models/glm-5p2 ``` ## Actual behavior A successful streamed request for this configured model reports: ```json { "plg.llm.model": "accounts/fireworks/models/glm-5p2", "plg.llm.input_tokens": "307816", "plg.llm.output_tokens": "1364", "plg.llm.total_tokens": "309180", "plg.llm.cost_usd": "0.000000" } ``` Configured model pricing is not propagated to cost calculation. This makes Usage Overview cost reporting and USD budget enforcement inaccurate for custom-provider models. ## Expected behavior For a request routed through a configured custom provider, calculate `plg.llm.cost_usd` from that provider model's configured values: ```text cost_usd = input_tokens / 1000 * input_per_1k + output_tokens / 1000 * output_per_1k ``` For this request, configured non-zero prices must produce non-zero cost. ## Requested fix Use pricing configured in Agent Network provider `models[]` for cost metering of that provider's models. Price lookup must be scoped to configured provider plus model ID, so different custom providers may set different prices for the same model ID.
Author
Owner

@linear-code[bot] commented on GitHub (Jul 24, 2026):

NET-1439

<!-- gh-comment-id:5072591276 --> @linear-code[bot] commented on GitHub (Jul 24, 2026): <!-- linear-linkback --> <p><a href="https://linear.app/netbird/issue/NET-1439">NET-1439</a></p>
Author
Owner

@toptok369-jpg commented on GitHub (Jul 31, 2026):

I’m affiliated with AllRouter. The $0.000000 result makes budget control unsafe even though the request succeeds. I can provide one external reconciliation fixture for #6904 using a real streamed request: configured input/output rates, raw token usage, expected USD formula, and provider-side charged amount, with no production traffic migration. Would that fixture help validate the provider+model-scoped lookup?

<!-- gh-comment-id:5139260758 --> @toptok369-jpg commented on GitHub (Jul 31, 2026): I’m affiliated with AllRouter. The $0.000000 result makes budget control unsafe even though the request succeeds. I can provide one external reconciliation fixture for #6904 using a real streamed request: configured input/output rates, raw token usage, expected USD formula, and provider-side charged amount, with no production traffic migration. Would that fixture help validate the provider+model-scoped lookup?
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#12272