LanguageModelRateLimitingPlugin returns a billing error (insufficient_quota) instead of a rate limit error
维护者通常 1 天内回复
评估
调研方向
从 DevProxy.Plugins/Behavior/LanguageModelRateLimitingPlugin.cs 开始,并将预期的错误结构与 pnp/proxy-samples 中的 openai-throttling 预设进行比较。当默认的 throttle 响应使用 type "tokens" 和 code "rate_limit_exceeded"、包含插件的 token 计数器,并且 Custom 仍可模拟配额错误时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- C#
- 星标
- 833
- 派生
- 90
- 平均合并
- 16 小时 44 分钟
- 30 天内合并 PR
- 40
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotnet/dev-proxy 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
config get doesn't print the start command for presets with a .devproxy folder可能已有人在做 @waldekmastykarz 于 1 天前认领。 未关闭work in progress
难度 2/5 1-3 小时 新手友好度 25/100
dotnet/dev-proxy#1906 · 已指派 1 人 ·
维护者通常 1 天内回复
-
GenericRandomErrorPlugin sends literal @dynamic in Retry-After for non-429 responses可能已有人在做 @waldekmastykarz 于 1 天前认领。 未关闭work in progress
难度 3/5 1-2 天 新手友好度 35/100
dotnet/dev-proxy#1905 · 已指派 1 人 ·
维护者通常 1 天内回复
-
MockStdioResponsePlugin: @stdin.body.id placeholder fails to resolve when messages arrive back-to-back after an id-less message可能重新可做 @garrytrinder 于 84 天前认领,目前没有进行中的 PR。 未关闭
dotnet/dev-proxy#1757 · 1 个 reaction · 已指派 2 人 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 66/100
shimat/opencvsharp#2154 ·
维护者通常 1 天内回复
-
subsystem: UI
难度 2/5 1-3 小时 新手友好度 82/100
Open-Systems-Pharmacology/PK-Sim#3812 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
PCL-Community/PCL-CE#3652 ·
维护者通常 1 天内回复
-
bug effort:S P3
难度 2/5 1-3 小时 新手友好度 72/100
nightscout/nocturne#2012 ·
维护者通常 1 天内回复