Say Hello to the Future of Chat with ChatGPT API
The latest addition to the ChatGPT model family has been unveiled by OpenAI. Known as gpt-3.5-turbo, this model is the same as the one used in ChatGPT and has a price tag of $0.002 / 1000 tokens, which is a whopping 10 times cheaper than the existing GPT-3.5 models. It has been proven to be the top-performing model for several non-chat use cases, with early adopters moving from text-davinci-003 to gpt-3.5-turbo with minimal prompt adjustments. Unlike traditional GPT models that consume unstructured text as a sequence of tokens, ChatGPT models process a sequence of messages along with their metadata. This model uses a new format known as Chat Markup Language (ChatML) to convert the input into a sequence of tokens.
ChatGPT models can now be accessed through a newly developed endpoint:
curl https://api.openai.com/v1/chat/completions
-H "Authorization: Bearer $OPENAI_API_KEY"
-H "Content-Type: application/json"
-d '{
"model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": "What is the OpenAI mission?"}]
}'
The API request requires a straightforward Bearer authentication process and includes a model selection and an array of messages in the request body.
Here is the response for the previous request:
{
"id"…