这是我的代码片段:
const { Configuration, OpenAI, OpenAIApi } = require ("openai");
const configuration = new Configuration({
apiKey: 'MY KEY'
})
const openai = new OpenAIApi(configuration)
async function start() {
const response = await openai.createChatCompletion({
model:"text-davinci-003",
prompt: "Write a 90 word essay about Family Guy",
temperature: 0,
max_tokens: 1000
})
console.log(response.data.choices[0].text)
}
start()
Run Code Online (Sandbox Code Playgroud)
当我跑步时:node index
我遇到这个问题:
data: {
error: {
message: 'Invalid URL (POST /v1/chat/completions)',
type: 'invalid_request_error',
param: null,
code: null
}
}
},
isAxiosError: true,
toJSON: [Function: toJSON]
}
Run Code Online (Sandbox Code Playgroud)
Node.js …