[Feature]: Surface rate-limit headroom from response headers for API-key providers (OpenAI, Anthropic API, xAI, Groq, Mistral)
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend-api-design
Direzione di ricerca
Start with the provider adapter and quota bar paths, then inspect src/providers/mistral-transport.ts for existing Mistral header parsing and the Anthropic rate-limit parsing mentioned in the issue. Trace how proxied response headers and quota readings are stored and displayed. Done means timestamped per-provider, account, and model windows are shown for the listed providers, missing values stay unknown, and readings become stale after reset.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Area
Provider adapters
What are you trying to accomplish?
For API-key providers that have no balance endpoint usable with an inference key, see current rate-limit headroom (remaining requests and tokens in the current window and when it resets) in the quota bar, without OpenCodex making extra upstream calls.
What prevents this today?
OpenCodex already sees these headers on every proxied response but only uses some of them for retry classification or the Claude OAuth subscription windows. For OpenAI sk- project keys, Anthropic API keys, xAI, Groq and Mistral, the dashboard shows nothing about remaining limits, and a missing reading cannot be told apart from "no limit".
What should OpenCodex do?
Record the last seen rate-limit headers per (provider, key account, model) from responses OpenCodex already proxies and expose them as passive, timestamped quota windows:
- OpenAI:
x-ratelimit-limit/remaining/reset-requestsand-tokens(reset values are durations such as6m0s; convert to absolute time). - Anthropic API key:
anthropic-ratelimit-requests-*,-input-tokens-*,-output-tokens-*,-tokens-*(RFC 3339 resets). Reuse the existing Anthropic header parsing where possible. - xAI and Groq: the OpenAI-shaped
x-ratelimit-*family (Groq requests = per day, tokens = per minute), read defensively. - Mistral:
x-ratelimit-*-minute/-monthalready parsed insrc/providers/mistral-transport.ts.
Show each window with its age ("as of 2 min ago") and mark it stale after the reset time passes. An absent header renders as unknown, never as 0 remaining. No header values containing identifiers are logged.
Example usage or interface
Quota bar: OpenAI API req 4,980/5,000 · tok 1.9M/2M (resets 6m) · 1 min ago.
Alternatives or workarounds
Balance/spend endpoints exist but need a different credential: OpenAI Usage/Costs API (sk-admin- key), Anthropic Admin API (organization admin key, unavailable to individual accounts), xAI management key (/v1/billing/teams/{team_id}/prepaid/balance). These could be an explicit opt-in later; this issue covers the zero-credential passive signal only. Gemini API keys expose no remaining-quota header or endpoint at all (only Cloud Monitoring with GCP IAM), so Gemini stays "unknown" by design.
Additional context
Docs: OpenAI rate limits (https://platform.openai.com/docs/guides/rate-limits), Anthropic rate limits (https://docs.anthropic.com/en/api/rate-limits), Groq rate limits (https://console.groq.com/docs/rate-limits). Prior-art rule from CLIProxyAPI, CodexBar and claude-code-router: header first, endpoint second; never let a missing reading become zero.
- Lingua principale
- TypeScript
- Stelle
- 16.9k
- Fork
- 1.3k
- Merge medio
- 20h 9m
- PR unite (30g)
- 690
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lidge-jun/opencodex
-
[Bug]: Claude account rows no longer show the email (since #8055), so "Account 1, 2, 3" cannot be told apartForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaaccount-pool bug gui
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
lidge-jun/opencodex#8286 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
bug(gui): WorkBuddy AI quota/credits missing from top QuotaSummaryBar despite successful probeApertaaccount-pool bug gui
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
lidge-jun/opencodex#8131 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature]: Show Mistral API and Vibe budget usage from /v1/billing/budgetForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaenhancement provider
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
I maintainer di solito rispondono entro 1 giorno
-
account-pool provider provider-compatibility
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
lidge-jun/opencodex#8288 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug][macOS] Dashboard chips render as square corners instead of rounded pills in the desktop appApertabug gui platform
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
lidge-jun/opencodex#8281 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di lidge-jun/opencodex
Issue simili
-
area:cards enhancement ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
fil-donadoni/tolaria#8883 ·
I maintainer di solito rispondono entro 1 giorno
-
xsd:integer cast from a string rejects negative numbers, a leading + and surrounding whitespaceApertabug 🐛
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
comunica/comunica#1960 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
getsentry/sentry-javascript#26203 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
bytedance/flowgram.ai#1235 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
devswha/herdr-web-ui#3325 ·