Featured image of post Call ChatGPT API from curl

Call ChatGPT API from curl

Call ChatGPT API from curl

This assumes calling from the Windows Command Prompt.

1
2

curl https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer sk-proj-XXXXXXXXXXXXXXXXXXXX" -d "{""model"": ""gpt-3.5-turbo"",""messages"": [{""role"": ""system"", ""content"": ""Please answer in Kansai dialect.""}, {""role"": ""user"", ""content"": ""Insert the message you want to send here""}]}"
comments powered by Disqus