YOUR_API_KEY
with your secret API key.
gpt-3.5-turbo
. You should receive a response similar to the following:{
"id":"chatcmpl-abc123",
"object":"chat.completion",
"created":1677858242,
"model":"gpt-3.5-turbo-0301",
"usage":{
"prompt_tokens":13,
"completion_tokens":7,
"total_tokens":20
},
"choices":[
{
"message":{
"role":"assistant",
"content":"\n\nThis is a test!"
},
"finish_reason":"stop",
"index":0
}
]
}
finish_reason
is stop
, which means the API returned the model’s complete response. In the request above, we only generated a single message, but you can set the parameter n
to generate multiple message choices. In this example, gpt-3.5-turbo
is often used for traditional text completion tasks. The model is also optimized for chat applications.