feat: add provider usage center - #11611
Merged
Merged
Conversation
Contributor
Author
…enter # Conflicts: # packages/kilo-vscode/src/KiloProvider.ts # packages/kilo-vscode/webview-ui/src/components/profile/ProfileView.tsx # packages/kilo-vscode/webview-ui/src/types/messages/webview-messages.ts # packages/opencode/src/kilocode/server/httpapi/groups/kilocode.ts # packages/opencode/src/kilocode/server/httpapi/handlers/kilocode.ts # packages/opencode/src/kilocode/server/httpapi/server.ts # packages/opencode/test/kilocode/server/httpapi-public.test.ts # packages/sdk/js/src/v2/gen/sdk.gen.ts # packages/sdk/js/src/v2/gen/types.gen.ts # packages/sdk/openapi.json
… feat/provider-usage-center
… feat/provider-usage-center
… feat/provider-usage-center
… feat/provider-usage-center
Contributor
Author
Contributor
Author
Contributor
Author
…ge-center-split # Conflicts: # packages/sdk/js/src/v2/gen/types.gen.ts # packages/sdk/openapi.json
marius-kilocode
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




What changed
Add a secret-free Provider Usage Center shared by the CLI, TUI, SDK, and VS Code profile. Core owns provider detection, normalization, source-scoped caching, in-flight coalescing, stale fallback, and failure isolation.
The provider-plan sources cover Kilo-managed MiniMax subscriptions through Cloud tRPC and direct MiniMax Token Plan credentials configured locally. Kilo Pass remains on the existing profile transport and is presented first in Plans & usage with its paid and free-bonus credits. Kilo-managed plans are labeled KILO GATEWAY; locally configured provider credentials are labeled DIRECT.
Managed MiniMax supports Plus, Max, and Ultra, preserves the unified text/image quota returned by MiniMax, and omits unsupported video-only quota rows. A managed card is detected only when the subscription has an enabled, read-only
coding_planBYOK entry; absent, disabled, user-managed, or unavailable routing metadata produces no managed card or quota request. Personal top-up state appears directly below Balance rather than among provider plans.Architecture
flowchart LR subgraph Sources[Usage sources] Config["Local config and auth<br/>MiniMax Global / China credentials"] Cloud["Kilo Cloud tRPC<br/>plans, BYOK routing, managed quota"] Pass["Existing profile transport<br/>Kilo Pass, balance, top-ups"] end subgraph Gateway[packages/kilo-gateway] Trpc["Cloud tRPC client<br/>safe envelope parsing and projection"] Format["Shared window formatting<br/>localized label inputs"] end subgraph Core[packages/core] Detect["provider-usage.ts<br/>source detection and credential resolution"] Direct["minimax/usage.ts<br/>independent regional plan queries"] Managed["cloud.ts<br/>managed quota normalization"] Cache["Location-scoped ProviderUsage service<br/>TTL cache, coalescing, stale fallback, failure isolation"] end subgraph Contract[Public contract] Schema["packages/schema<br/>secret-free ProviderUsage schema"] Http["packages/opencode HTTP API<br/>GET usage / POST refresh"] SDK["packages/sdk<br/>generated typed client"] end subgraph Clients[User interfaces] TUI["CLI TUI Plans & usage<br/>load on open, Ctrl-R refresh"] VSCode["VS Code Profile<br/>load on open, Refresh button"] end Config --> Detect --> Direct --> Cache Cloud --> Trpc --> Detect --> Managed --> Cache Cache --> Schema --> Http --> SDK SDK --> TUI SDK --> VSCode Format --> TUI Format --> VSCode Pass -. "unchanged profile path" .-> VSCodepackages/coreis the source of truth for plan discovery, provider-specific normalization, and cache behavior.packages/schemais the client boundary: it contains normalized usage and structured periods, never credentials or provider-native payloads.packages/opencodeexposes location-scoped read and refresh endpoints;packages/sdkgenerates the typed transport used by both clients.packages/kilo-vscodeinvalidates displayed usage on auth, organization, or workspace changes, then reloads only when the profile is open or the user refreshes.Why
Users need one current-state view of provider plan quota without exposing credentials or coupling clients to provider-specific payloads. Billing history and subscription lifecycle remain in Cloud, organization-scoped Kilo data is skipped, and existing session/model accounting remains separate.
Dependency
Requires Kilo-Org/cloud#4220 for owner-scoped managed MiniMax quota.