AIUsageTracker icon indicating copy to clipboard operation
AIUsageTracker copied to clipboard

v2.4.6: Kimi provider broken by API shape change; OpenRouter row renders Free Tier child values; per-card visibility impossible (cards share provider_id)

Open RVYNP opened this issue 1 month ago • 0 comments

Environment

  • AIUsageTracker v2.4.6 (portable zip), Windows 11 x64 (build 26300)
  • Monitor agent v2.4.6.0 on port 5000
  • Found during first-time setup with Claude Code (Pro), OpenAI Codex (ChatGPT plan), OpenRouter, and Kimi for Coding — all three bugs below are reproducible against the current main

Bug 1 — Kimi provider: API response shape changed, card always shows "Response missing usage data"

KimiProvider deserializes into (AIUsageTracker.Infrastructure/Providers/KimiProvider.cs):

[JsonPropertyName("usage")]  KimiUsageData? Usage     // expects { limit, used, remaining, resetTime }
[JsonPropertyName("limits")] List<KimiLimitItem>? Limits

and returns early when data.Usage == null — before the Limits cards are considered:

if (data.Usage == null)
{
    return new[] { this.CreateUnavailableUsage("Response missing usage data", ...) };
}

The live GET https://api.kimi.com/coding/v1/usages (valid key, HTTP 200) no longer contains a usage object at all:

{
  "limits": [
    { "window": { "duration": 300, "timeUnit": "TIME_UNIT_MINUTE" },
      "detail": { "limit": "100", "remaining": "100", "resetTime": "2026-11-02T21:06:58.177560Z" } }
  ],
  "usages": {
    "limit_5h":          { "used_ratio": 0,      "reset_time": "2026-11-02T21:06:57Z" },
    "limit_month_total": { "used_ratio": 0.1288, "reset_time": "2026-12-02T00:00:00Z" },
    "limit_month_code":  { "used_ratio": 0.1288, "reset_time": "2026-12-02T00:00:00Z" }
  }
}

Actual: card shows Response missing usage data despite a healthy subscription. Expected: parse usages.*.used_ratio (+ limits[] windows) into the quota cards. Note: per AGENTS.md, the card layout should keep being driven by ProviderDefinition.QuotaWindows; the new used_ratio-based shape maps cleanly onto burst/rolling windows.

Bug 2 — Slim main window: OpenRouter row renders the Free Tier child card's values

OpenRouterProvider.BuildUsageCards emits three cards that share group_id/provider_id = "openrouter":

card_id name description requests_used/available
credits Openrouter $141.82 remaining 183.18 / 325
free-tier Free Tier No 0 / 0
spending-limit Spending Limit 50.00 0 / 0

/api/usage/grouped is correct ($141.82 remaining), and the Web UI renders the credits value correctly. But the Slim main window's OpenRouter row shows $0.00 remaining with a full (green) bar — exactly the free-tier card's numbers (FormatRemainingCurrency(0 − 0) → "$0.00 remaining", RemainingPercent 100 → full bar) under the group display name.

Repro: configure any working OpenRouter key; compare the Slim row against /api/usage/grouped and the Web UI.

Bug 3 — Card Visibility cannot hide individual cards because all cards of a provider share provider_id

MainWindowRuntimeLogic.BuildMainWindowUsageList filters on:

var id = usage.ProviderId ?? string.Empty;
... hiddenSet.Contains(id)

and the Settings → Cards checkboxes bind Tag = usage.ProviderId (SettingsWindow.Providers.cs, ProviderVisibility_Changed). OpenRouter's three cards all have ProviderId == "openrouter" (only CardId differs), so unchecking "Free Tier" or "Spending Limit" hides all three cards, including the credits card. There is no way to hide just the non-informative children.

Suggested direction: key visibility by provider_id::card_id — the grouping key two lines below the filter already computes exactly that ($"{ProviderId}::{CardId}").


Happy to provide raw API captures / additional traces for any of the three. Bugs 1–3 were all observed on a clean first-run install, no custom configuration beyond API keys.

RVYNP avatar Nov 02 '26 18:11 RVYNP