@Laxdal 在 【小白编程求助】如何在python里调用chatgpt 中发帖
如题,纯小白,这个问题估计太简单了,网上都没人讲 :xhs_005:
Claude写的代码如下:
import openai
# Set your API key, URL, and model name here
API_KEY = "sk-test"
API_URL = "https://test.com/"
MODEL_NAME = "gpt-4o"
openai.api_key = API_KEY
def main():
while True:
prompt = input("You: ")
if prompt.lower() in ["exit", "quit"]:
break
try:
response = openai.ChatCompletion.create...