mirror of
https://github.com/deepseek-ai/awesome-deepseek-integration.git
synced 2026-11-05 00:57:30 +00:00
[GH-ISSUE #654] [Feature Request] Provide a Bearer-authenticated, real-time aggregated usage / quota API for third-party tools (e.g. CodexBar) #192
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/awesome-deepseek-integration#192
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Yuxin-Qiao on GitHub (Jun 8, 2026).
Original GitHub issue: https://github.com/deepseek-ai/awesome-deepseek-integration/issues/654
Feature Request: Provide a Bearer-authenticated, real-time usage / quota aggregation API for third-party tools (e.g. CodexBar)
Submitted by: A DeepSeek API user + CodexBar (steipete/CodexBar) contributor
Use case: macOS menu-bar usage monitor + similar third-party tools across the ecosystem
TL;DR
Please expose a Bearer-authenticated, real-time, aggregated usage / quota endpoint under
api.deepseek.comso tools like CodexBar can visualize DeepSeek consumption the way they already do for OpenAI Codex, Claude, Cursor, Gemini, etc.This unlocks the entire third-party monitoring ecosystem for DeepSeek — power users who live in the terminal / menu bar / dashboards need a programmatic way to read their own consumption without opening a browser.
What I'm asking for
At minimum, an endpoint equivalent to OpenAI's Usage API in spirit. Reference fields:
current_window_remaining_percentcurrent_window_resets_atweekly_remaining_percentweekly_resets_attoday_token_usedtoday_cost_usdmonth_token_usedmonth_cost_usdlast_refresh_atStandard
Authorization: Bearer <api_key>should work — no session cookies, no CSRF, no web login flow.Why — what's blocking us today
https://api.deepseek.com/user/balanceis Bearer-authenticated, but only returns the cash balance, not token / cost breakdowns.https://platform.deepseek.com/api/v0/usage/amountand/usage/costare exactly what third-party tools need — but they live under the web console domain and only authenticate via session cookies, not Bearer. From an API key's perspective, they returnHTTP 200 + {"code": 40003, "msg": "Authorization Failed"}— a successful-looking response with an application-level error that is very easy to miss.usagefield from/chat/completionsonly gives per-call data, not aggregated dashboards.Concrete user impact — the bug my PR hit
I previously submitted CodexBar PR #1166 (
92598f8d feat: add DeepSeek usage summaries, merged into v0.32.2) implementing aDeepSeekAPIFetchStrategyagainst theplatform.deepseek.comusage endpoints with Bearer auth. The PR was merged in good faith — but in practice, the dashboard silently shows "balance only" for 100% of Bearer-authenticated users because:guard response.statusCode == 200 else { throw }is satisfied (status IS 200).data: null→ throwsparseFailed("Missing amount biz_data").completedOptionalUsageSummarydiscards the error silently inside a 2s grace window.snapshot?.deepSeekUsage == niland hides the whole dashboard section.There is no telemetry, no log line, and no UI hint to surface this failure to the user — every layer swallows the error. So end users think "CodexBar's DeepSeek integration just doesn't have a usage breakdown feature", when in reality the API server is rejecting every call.
If DeepSeek exposes a Bearer-authenticated real-time endpoint, the CodexBar fix becomes trivial: swap the strategy from cookie-style to Bearer-style. I (the PR author) am happy to send the fix immediately.
Suggested endpoint shape (sketch)
A one-team / one-sprint change that unlocks CodexBar, Hammerspoon scripts, Slack bots, Prometheus exporters, etc.
Reference
Sources/CodexBarCore/Providers/DeepSeek/Thanks for the great models — looking forward to seeing usage visibility improve. Happy to collaborate on the CodexBar side as soon as the endpoint is live.
@Yuxin-Qiao commented on GitHub (Jun 8, 2026):
📌 Follow-up: a concrete feature CodexBar wants to ship once the API is available (2026-06-08)
As a contributor to CodexBar (@steipete/CodexBar), I want to share one very concrete thing CodexBar can ship the moment DeepSeek exposes the endpoint.
What I want to add to CodexBar's DeepSeek provider
Per-model cost / token breakdown view. DeepSeek's own web dashboard already splits by model (e.g.
deepseek-v4-flashlisted separately, with prompt / completion / cache-hit / cache-miss token counts). CodexBar can mirror that exact layout — one row per model:Zero learning curve for users migrating from the web dashboard to the menu bar.
Why I can't ship this today
I previously submitted CodexBar PR #1166 (
92598f8d feat: add DeepSeek usage summaries, merged into v0.32.2) using Bearer auth againstplatform.deepseek.com/api/v0/usage/amountand/cost. It silently fails for 100% of Bearer-authenticated users (3 layers of error-swallowing, UI shows nothing — issue #885 in CodexBar is still tracking this).Fields needed (per-model breakdown view)
model_iddeepseek-v4-flash/deepseek-chat/deepseek-reasonerprompt_tokensprompt_cache_hit_tokensprompt_cache_miss_tokenscompletion_tokenstotal_tokenscost_usdorcost_cnytime_windowDerived metrics (computed client-side, no extra fields needed)
Once CodexBar has the raw fields, it can derive a whole analytics layer — DeepSeek doesn't need to expose anything new:
prompt_cache_hit_tokens / (hit + miss)— reflects cache effectivenesscache_hit_tokens × (input_price − cache_hit_price)— how much money the cache savedtotal_tokens / request_count— prompt bloat checkprompt_tokens / completion_tokens— input-heavy vs output-heavy workloadsmodel_cost / total_cost— where the money goesIf DeepSeek also exposes a
time_windowfield (today / week / month / custom), this view becomes a 1:1 mirror of the platform dashboard.Ship commitment
If DeepSeek exposes a Bearer-authenticated real-time usage API with per-model breakdown, I (PR #1166's author) can ship two PRs back-to-back:
DeepSeekAPIFetchStrategyfrom cookie-style to Bearer-style — fixes the 100% silent-failure on Bearer users.End-to-end experience matching OpenAI Codex in CodexBar, shippable within a week of the endpoint going live. Concrete scenario, concrete ship commitment.
@neyham commented on GitHub (Aug 8, 2026):
Related tooling note: while a Bearer usage/quota aggregation API would unlock proper session/weekly bars for the whole ecosystem, the existing
GET https://api.deepseek.com/user/balanceis already enough for a cash-balance panel.I maintain a local open-source desktop board that surfaces DeepSeek API balance (and insufficient-balance) next to Claude Code / Codex / Grok Build provider-returned windows — fullscreen panels for a spare display, MIT, no project account.
https://github.com/neyham/ai-usage-dashboard
Happy to adapt if DeepSeek ships a proper usage endpoint later. Disclosure: I am the author.