summaryrefslogtreecommitdiffhomepage
path: root/packages/core/src/credentials/index.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-05-20 22:32:41 +0900
committerAdam Malczewski <[email protected]>2026-05-20 22:32:41 +0900
commitc0c55ed7c03188f264ff2c27b9982f2d57d092cc (patch)
tree04b871b83e6e1481c8b24b59aa3acc0e15b44f02 /packages/core/src/credentials/index.ts
parent8151447758e6826a578363758a755c6cebd1c05f (diff)
downloaddispatch-c0c55ed7c03188f264ff2c27b9982f2d57d092cc.tar.gz
dispatch-c0c55ed7c03188f264ff2c27b9982f2d57d092cc.zip
feat: key usage panel — display usage data for Claude, OpenCode, and Copilot
Adds 'Key Usage' to the sidebar dropdown with per-provider live usage: - Claude: 5-hour and weekly utilization bars with reset timestamps (normalizes Anthropic's 0-100% API response to 0-1 internally) - OpenCode: Scrapes usage from workspace page via OPENCODE_COOKIE session cookie, mapping key IDs to OPENCODE_WS1_ID/OPENCODE_WS2_ID - Copilot: Fetches from api.github.com/copilot_internal/user with entitlement/remaining/quota reset tracking New files: opencode.ts, copilot.ts (usage fetchers), KeyUsage.svelte New route: GET /models/key-usage?keyId=X dispatches by provider
Diffstat (limited to 'packages/core/src/credentials/index.ts')
-rw-r--r--packages/core/src/credentials/index.ts29
1 files changed, 19 insertions, 10 deletions
diff --git a/packages/core/src/credentials/index.ts b/packages/core/src/credentials/index.ts
index d72ad48..0ae4edb 100644
--- a/packages/core/src/credentials/index.ts
+++ b/packages/core/src/credentials/index.ts
@@ -1,18 +1,27 @@
export {
- type ClaudeCredentials,
+ ANTHROPIC_MODELS_FALLBACK,
+ buildBillingHeaderValue,
type ClaudeAccount,
+ type ClaudeCredentials,
+ type ClaudeProfile,
type ClaudeUsageBucket,
type ClaudeUsageReport,
- type ClaudeProfile,
- ANTHROPIC_MODELS_FALLBACK,
- fetchAnthropicModels,
discoverClaudeAccounts,
- refreshAccountCredentials,
- refreshAccountCredentialsAsync,
- validateAccountCredentials,
- buildBillingHeaderValue,
+ fetchAnthropicModels,
+ getAccountUsage,
getAnthropicBetas,
getAnthropicHeaders,
- getAccountUsage,
+ refreshAccountCredentials,
+ refreshAccountCredentialsAsync,
SYSTEM_IDENTITY,
-} from "./claude.js"; \ No newline at end of file
+ validateAccountCredentials,
+} from "./claude.js";
+export {
+ type CopilotUsageReport,
+ fetchCopilotUsage,
+} from "./copilot.js";
+export {
+ fetchOpencodeUsage,
+ type OpencodeUsageBucket,
+ type OpencodeUsageReport,
+} from "./opencode.js";