Describe the bug
When you make a request to the OpenAI API and the context length exceeds your organizations allowed tokens per minute for the specific model, you will receive the following error:
Rate limit reached for default-gpt-4-large in organization org-xxxxxxxxxxxx on tokens per min.
Limit: 150000 / min. Current: 0 / min. Contact us through our help center at help.openai.com if you continue to have issues.
This is confusing because it makes the issue appear to be at the organization level, when in fact a bug in your code is just causing your context to be too large. Instead, the following error message should appear:
This model's maximum context length is 4097 tokens, however you requested 150678 tokens (150000 in your prompt; 678 for the completion). Please reduce your prompt; or completion length."
To Reproduce
- Use the OpenAI python client
- Use any open ai chat completions endpoint with far too large a context length
- Observe error
Code snippets
No response
OS
macOS
Python version
^3.9
Library version
^0.27.8
Describe the bug
When you make a request to the OpenAI API and the context length exceeds your organizations allowed tokens per minute for the specific model, you will receive the following error:
This is confusing because it makes the issue appear to be at the organization level, when in fact a bug in your code is just causing your context to be too large. Instead, the following error message should appear:
To Reproduce
Code snippets
No response
OS
macOS
Python version
^3.9
Library version
^0.27.8