刚刚第一次充值完oaipro,但是发现不会通过python调用,按照Openai的官方教程尝试了下面的代码
from openai import OpenAI
client = OpenAI(
api_key="",
base_url="https://api.openai.com"
)
completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},
{"role": "user", "content": "Compose a poem that explains the concept of recursion in programming."}
]
)
print(completion.choices[0].message)
但是会出现下面的报错信息:
NotFoundError: Error code: 404 - {'error': {'type': 'invalid_request_error', 'code': 'unknown_url', 'message': 'Unknown request URL: POST /chat/completions. Please check the URL for typos, or see the docs at https://platform.openai.com/docs/api-reference/.', 'param': None}}