We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import openai
openai.api_key = "OPENAI_API_KEY" openai.base_url="https://api.chatanywhere.org"
def chat_with_gpt(prompt): response = openai.ChatCompletion.create( model='gpt-3.5-turbo', # 或者使用其他可用模型 messages=[ {"role": "user", "content": prompt} ] ) return response['choices'][0]['message']['content']
if name == "main": user_input = input("你想问什么? ") reply = chat_with_gpt(user_input) print("GPT的回复:", reply)
之前成功调用了一次今天在打开key就无效了,用的3.5的免费模型,端口也改了但是一直报错求解
The text was updated successfully, but these errors were encountered:
Python的示例: https://github.com/chatanywhere/GPT_API_free/blob/main/demo.py
Sorry, something went wrong.
No branches or pull requests
import openai
替换为你的 OpenAI API 密钥
openai.api_key = "OPENAI_API_KEY"
openai.base_url="https://api.chatanywhere.org"
def chat_with_gpt(prompt):
response = openai.ChatCompletion.create(
model='gpt-3.5-turbo', # 或者使用其他可用模型
messages=[
{"role": "user", "content": prompt}
]
)
return response['choices'][0]['message']['content']
if name == "main":
user_input = input("你想问什么? ")
reply = chat_with_gpt(user_input)
print("GPT的回复:", reply)
之前成功调用了一次今天在打开key就无效了,用的3.5的免费模型,端口也改了但是一直报错求解
The text was updated successfully, but these errors were encountered: