Skip to content

Commit b3d062d

Browse files
author
octo-patch
committed
fix: show provider-specific rate limit message instead of hardcoded OpenAI text (fixes #1706)
1 parent 06c796a commit b3d062d

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

interpreter/core/respond.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,31 @@ def respond(interpreter):
118118
and ("exceeded" in str(e).lower() or
119119
"insufficient_quota" in str(e).lower())
120120
):
121-
display_markdown_message(
122-
f""" > You ran out of current quota for OpenAI's API, please check your plan and billing details. You can either wait for the quota to reset or upgrade your plan.
121+
model = getattr(interpreter.llm, "model", "") or ""
122+
# Derive provider name from model prefix (e.g. "groq/llama3" → "Groq")
123+
if "/" in model:
124+
provider = model.split("/")[0].title()
125+
if provider.lower() == "openai":
126+
provider = "OpenAI"
127+
else:
128+
provider = "OpenAI"
123129

124-
To check your current usage and billing details, visit the [OpenAI billing page](https://platform.openai.com/settings/organization/billing/overview).
130+
if provider == "OpenAI":
131+
display_markdown_message(
132+
f""" > You ran out of current quota for OpenAI's API, please check your plan and billing details. You can either wait for the quota to reset or upgrade your plan.
125133
126-
You can also use `interpreter --max_budget [higher USD amount]` to set a budget for your sessions.
127-
"""
128-
)
134+
To check your current usage and billing details, visit the [OpenAI billing page](https://platform.openai.com/settings/organization/billing/overview).
135+
136+
You can also use `interpreter --max_budget [higher USD amount]` to set a budget for your sessions.
137+
"""
138+
)
139+
else:
140+
display_markdown_message(
141+
f""" > You have exceeded your quota for {provider}'s API. Please check your plan and billing details with {provider}, or wait for the quota to reset.
142+
143+
You can also use `interpreter --max_budget [higher USD amount]` to set a budget for your sessions.
144+
"""
145+
)
129146

130147
elif (
131148
interpreter.offline == False and "not have access" in str(e).lower()

0 commit comments

Comments
 (0)