注册openai账号
注册参考
申请ApiKey
登陆openai后,去Api Keys管理申请key
Pip安装Openai
pip install openai
编写Python程序
import os
import openai
openai.api_key = "sk-xxxxxx" ## apikeys
question="How to earn billions?"
print(f'Question : {question}')
response = openai.Completion.create(
model="text-davinci-003",
prompt=question,
temperature=1,
max_tokens=1024,