Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

LanguageModelRateLimitingPlugin returns a billing error (insufficient_quota) instead of a rate limit error

未关闭 适合新手
#1,911 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@waldekmastykarz 已经在做这个了。

开始于 2026年10月4日。

  • #1912 来自 @waldekmastykarz —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp
领域
devtools

调研方向

从 DevProxy.Plugins/Behavior/LanguageModelRateLimitingPlugin.cs 开始,并将预期的错误结构与 pnp/proxy-samples 中的 openai-throttling 预设进行比较。当默认的 throttle 响应使用 type "tokens" 和 code "rate_limit_exceeded"、包含插件的 token 计数器,并且 Custom 仍可模拟配额错误时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

work in progress

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

  1. Enable LanguageModelRateLimitingPlugin with a low promptTokenLimit for https://api.openai.com/*.
  2. Send OpenAI requests until the limit is exceeded.
  3. 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dotnet/dev-proxy 的其他 Issue

查看 dotnet/dev-proxy 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。