#openai.error.InvalidRequestError Billing hard limit has been reached
43 messages · Page 1 of 1 (latest)
Go to settings -> usage -> usage limits and see what your limit has been set at, and increase it if necessary
its not used at all, maybe something in the example is outdated?
response = openai.Image.create(
prompt="a white siamese cat",
n=1,
size="1024x1024"
)
api key is correct too
Oh no i mean
Check what your hard limit is set to
There’s another page that shows you your hard limit
In settings somewhere
I’ll send a screenshot when I get home
its set to default 120$
oh interesting
the limits seem cool, some people mention they needed to set an engine name correctly in some cases
Not sure why you’re getting that error, have you double checked that it’s the correct API key and not for a different account?
Nah you don’t need an engine name for image
Let me check how I send my image request real quick, brb
this is the full error trace
Traceback (most recent call last):
File "c:\Users\User\Desktop\point-e\point_e\examples\dalle2api.py", line 6, in <module>
response = openai.Image.create(
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\openai\api_resources\image.py", line 22, in create
return instance.request("post", cls._get_url("generations"), params)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\openai\openai_object.py", line 179, in request
response, stream, api_key = requestor.request(
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\openai\api_requestor.py", line 181, in request
resp, got_stream = self._interpret_response(result, stream)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\openai\api_requestor.py", line 396, in _interpret_response
self._interpret_response_line(
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\openai\api_requestor.py", line 429, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: Billing hard limit has been reached
I am sending the request the same as you and it seems to work
I’d say triple check the API key
this is the full code
import openai
openai.api_key = "sk-xxx"
response = openai.Image.create(
prompt="a white siamese cat",
n=1,
size="1024x1024"
)
image_url = response['data'][0]['url']
api key just created
maybe im missing async before the function?
nah the library isn’t actually async so no worries about that
I’m also on 3.9
I’ll take a look at the library source later tonight and see if I can find anything else that may be giving u that error even tho you haven’t hit billing limit
ok just run it and it worked
i didnt change anything, maybe its a server bug lol
Yeah has to be
just one thing, whats the command to save the image to a file?
Sometimes invalid request is returned when overloaded
Uhhh you have to open the URL and read the image data from it, then write to a file
You can see code in the GitHub link I sent
Near the same location further down
awesome thanks mate! have a good holiday