Send Request
YOUR_API_KEY
with the token you generated in the Modelless Hub dashboard (sk-xxx).
gpt-3.5-turbo
”. You should receive a response similar to the following:
1 {
2 "id":"chatcmpl-abc123",
3 "object":"chat.completion",
4 "created":1677858242,
5 "model":"gpt-3.5-turbo-0301",
6 "usage":{
7 "prompt_tokens":13,
8 "completion_tokens":7,
9 "total_tokens":20
10 },
11 "choices":[
12 {
13 "message":{
14 "role":"assistant",
15 "content":"\n\nThis is a test!"
16 },
17 "finish_reason":"stop",
18 "index":0
19 }
20 ]
21 }
finish_reason
is stop
, indicating that the API has returned a complete output generated by the model. In the previous request, we generated only one message, but you can set the n
parameter to generate multiple message options. In this example, gpt-3.5-turbo
is primarily used for traditional text completion tasks. The model is also optimized for chat applications.