Skip to content

fix(monitoring): price local savings at the reference model #5914

Closed

Description

@dan-petty

Problem

The local-savings panels of k8s/devops/dashboards/ai-spend.json (Local Cloud Savings in Range, the savings half of Projected 30-Day, 90-Day and 1-Year Run Rate, Local Hardware Savings Rate, Local Savings per Hour by Backend Server) show values about 1000 times too high. On 2026-11-16 at 01:35Z, with the default range of 6 h, Projected 30-Day Run Rate showed $20,143 of savings. Only the real local tokens at the owner's reference price give $19.31.

Two causes:

  1. The price constant is not the owner's reference price. The dashboard constant reference_price_usd_per_token prices a local chat token at 2.5 USD (prompt) and 10 USD (completion) per million tokens. The owner decision of 2026-11-09 (fix(k8s): the ConfigMap template names the reference models #4241) values local tokens at the hosted price of qwen3.8:27b: 0.035 USD and 1.50 USD per million (ai.reference_model and ai.price_overrides in k8s/devops/configmap.example.yaml), which the spend reports of the Service use. The dashboard prices a prompt token 71 times higher.
  2. The savings read the client label local. Before fix(ai): do not classify gateway endpoint as local backend #5874 (v0.159.0, live from 2026-11-15 23:43Z), hosted DeepSeek calls through the gateway had local="true" (fix(ai): do not classify gateway endpoint as local serving backend #5867). In the 6 h to 01:35Z, 62.7M DeepSeek tokens have local="true" (35.9M from roadmap-stage, 26.8M from roadmap-service). In the last hour only local/qwen3.8:27b tokens have it, so the fix works, but every range that holds the old points (up to the 30-day retention) still counts them.

Expected behavior

Related

Activity

  1. added
    type/bug
    source/agent
    on Nov 16, 2026
  2. dan-petty commented on Nov 16, 2026

    @dan-petty
    OwnerAuthor
  3. added
    status/new
    value/medium
    effort/medium
    scope/monitoring
    priority/p2-medium
    on Nov 16, 2026
  4. dan-petty commented on Nov 16, 2026

    @dan-petty
    OwnerAuthor

    Note for the pull request of this item: #5924 (for #4724) changes the spend panels of k8s/devops/dashboards/ai-spend.json and does not change the savings queries.

    • The spend target of Projected 30-Day, 90-Day and 1-Year Run Rate now reads the last 7 days: rate(...[7d]) * 86400 * N. The savings target still reads $__range, and the panel description says so. When this item changes the savings target, it can use the same 7-day baseline, so that both values of a projection panel have one baseline.
    • The spend panels read the gateway counter litellm_spend_metric_total by model and api_provider. The gateway token counters (litellm_input_tokens_metric_total, litellm_output_tokens_metric_total) carry the same two labels in tests/fixtures/metrics/litellm.yaml.
    • tests/fixtures/dashboard_queries/ai-spend.yaml holds promtool cases of the spend panels. The savings panels can add their cases to the same file.
  5. dan-petty commented on Nov 16, 2026

    @dan-petty
    OwnerAuthor

    Owner requirement, 2026-11-16, for ai-spend.json:

    • Local Savings per Hour by Backend Server shows the in-cluster backends, one series for each Kubernetes service: for example ollama-48gib-fast, ollama-64gib-standard, and the embedding backends. It shows no series that names only the gateway, such as via llm-gateway.llm.svc.cluster.local:4000 (gateway) or llm-gateway via llm-gateway.llm.svc.cluster.local:4000 (gateway).
    • Spend per Hour shows the hosted providers (openrouter, anthropic, gemini) of the gateway calls that are not local. fix(monitoring): read AI spend from the gateway counter #5924 groups it by api_provider and model of litellm_spend_metric_total; put the provider first in the legend and name the panel by provider.

    The gateway series hold what the panel needs. litellm_input_tokens_metric_total and litellm_output_tokens_metric_total have api_provider (ollama_chat, ollama, openrouter), model and model_id. litellm_deployment_total_requests_total maps model_id to api_base: 6388f432... is http://ollama-48gib-fast.llm.svc.cluster.local:11434/api/chat, and b311d896... is http://ollama-64gib-standard.... The two embedding deployments (api_provider="ollama", qwen3-embedding:0.6b) have no api_base, so they need another name (for example the model). A join * on (model_id) group_left (api_base) max by (model_id, api_base) (litellm_deployment_total_requests_total) and a label_replace that keeps the service name give one series for each backend. The price is the price of ai.reference_model, as this issue says.

    Build after #5924 merges, because both change k8s/devops/dashboards/ai-spend.json.

  6. added
    owner/agent
    on Nov 16, 2026
  7. added
    status/in-review
    and removed
    status/new
    on Nov 16, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 16, 2026
  9. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor
  10. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-16 06:35 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/monitoringsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions