LanguageModelRateLimitingPlugin returns a billing error (insufficient_quota) instead of a rate limit error
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 82/100
Rechercherichtung
Beginne in DevProxy.Plugins/Behavior/LanguageModelRateLimitingPlugin.cs und vergleiche die erwartete Fehlerstruktur mit dem openai-throttling-Preset in pnp/proxy-samples. Als abgeschlossen gilt die Aufgabe, wenn die standardmäßige Throttle-Antwort den type "tokens" und den code "rate_limit_exceeded" verwendet, die Token-Zähler des Plugins enthält und Custom weiterhin einen Quota-Fehler simulieren kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Description
When LanguageModelRateLimitingPlugin throttles a request with whenLimitExceeded: "Throttle" (the default), it returns a 429 with this body (DevProxy.Plugins/Behavior/LanguageModelRateLimitingPlugin.cs):
{
"error": {
"message": "You exceeded your current quota, please check your plan and billing details.",
"type": "insufficient_quota",
"code": "insufficient_quota"
}
}
That's the body OpenAI uses for a billing or quota error, which means "stop, retrying won't help". OpenAI's docs say: "Retrying billing, spend, or quota errors won't restore API access." (Error codes)
The plugin simulates a token rate limit, which means "wait and retry". So an app that handles OpenAI errors correctly does the wrong thing under Dev Proxy:
- It stops retrying and shows "out of credits", when it should back off and retry.
- Its rate limit branch (
rate_limit_exceeded) never runs, so the test doesn't cover the code path the plugin is meant to test.
Steps to reproduce
- Enable
LanguageModelRateLimitingPluginwith a lowpromptTokenLimitforhttps://api.openai.com/*. - Send OpenAI requests until the limit is exceeded.
- Inspect the 429 body.
Expected behavior
A rate limit error that matches what OpenAI returns when you exceed tokens per minute, for example:
{
"error": {
"message": "Rate limit reached for <model> in organization <org> on tokens per min (TPM): Limit <limit>, Used <used>, Requested <requested>. Please try again in <n>s.",
"type": "tokens",
"param": null,
"code": "rate_limit_exceeded"
}
}
The openai-throttling preset in pnp/proxy-samples already uses this shape.
Actual behavior
The 429 body says insufficient_quota, which clients treat as a billing error.
Proposed fix
Change the default throttle body to rate_limit_exceeded with type: "tokens", and include the token numbers from the plugin's counters in the message. Keep whenLimitExceeded: "Custom" for anyone who wants to simulate a quota error on purpose.
- Vorherrschende Sprache
- C#
- Sterne
- 841
- Forks
- 90
- Ø Merge
- 2 T. 10 Std.
- Gemergte PRs (30 T.)
- 63
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus dotnet/dev-proxy
-
ExecutionSummaryPlugin: internal log messages leak into the report as an "Unknown" categoryEvtl. vergeben @waldekmastykarz hat das vor 1 Tag übernommen. Offenbug work in progress
dotnet/dev-proxy#2097 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Add `devproxy cert export` to write the root certificate to a fileEvtl. vergeben @waldekmastykarz hat das vor 1 Tag übernommen. Offenwork in progress
dotnet/dev-proxy#2085 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Update "Use Dev Proxy with Node.js" for native `fetch` proxy support and certificate trustEvtl. vergeben @waldekmastykarz hat das vor 1 Tag übernommen. Offendocumentation work in progress
dotnet/dev-proxy#2084 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Reference the API-inventory preset from the CI/CD and Record docsEvtl. vergeben @waldekmastykarz hat das vor 1 Tag übernommen. Offendocumentation work in progress
dotnet/dev-proxy#2083 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Document the shutdown contract for `POST /proxy/stopProxy`Evtl. vergeben @waldekmastykarz hat das vor 1 Tag übernommen. Offendocumentation work in progress
dotnet/dev-proxy#2081 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in dotnet/dev-proxy
Ähnliche Issues
-
Playground selection bar: comes back after Apply or scrolling while focus is in the Markdown paneOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
sillsdev/SIL.TextEditing#175 ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs attention untriaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3666 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
MicrosoftLearning/eShopOnWeb#466 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
stryker-mutator/stryker-net#3974 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
Maintainer antworten meist innerhalb von 1 Tag