如果你是ChatGPT的用户,你又是一个开发者,你可以通过https://platform.openai.com/account/api-keys这个url获得API keys。
然后获得key,可以用于代码重调用openai的接口
import openai
import time
openai.api_key = "sk-***********************************"
….
# Write a new summary of the merged chunks
merged_summary = openai.Completion.create(
engine="text-davinci-002",
prompt=merged_text + "\nSummarize the above text in one paragraph.",
max_tokens=200,
n=1,
stop=None,
temperature=0.5
).choices[0].text.strip()
然后通过代码请求了300多次,就收到了“OpenAI Free Trial – You’ve reached your usage limit”的邮件
Hi there, You've used up all the credits available in your free trial. View Usage We hope you've had a positive experience with the API! If it didn't meet your expectations for any reason, please let us know by contacting us through our help center and we can try to help out. If you'd like to upgrade to a paid plan, head over to your Billing page. Best, The OpenAI team
然后我打开后台我发现我的使用量真的是满了。但是我还可以申请新的key,但是新的key使用还是提示
“You exceeded your current quota, please check your plan and billing details”
summary = openai.Completion.create(
File "/usr/local/bin/python3/lib/python3.8/site-packages/openai/api_resources/completion.py", line 25, in create
return super().create(*args, **kwargs)
File "/usr/local/bin/python3/lib/python3.8/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/usr/local/bin/python3/lib/python3.8/site-packages/openai/api_requestor.py", line 226, in request
resp, got_stream = self._interpret_response(result, stream)
File "/usr/local/bin/python3/lib/python3.8/site-packages/openai/api_requestor.py", line 619, in _interpret_response
self._interpret_response_line(
File "/usr/local/bin/python3/lib/python3.8/site-packages/openai/api_requestor.py", line 679, in _interpret_response_line
raise self.handle_error_response(
openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.
结论:看来要继续用接口请求ChatGPT,只能交钱使用了或者申请一个新号。