v1

latestOpenAPI 3.1.02026-07-2611077199.5 KB

post/v1/chat/completions

Request body

modelstring required

Model to use, see Supported Models

streamboolean

Whether to use server-sent events for progressive response transmission

Example request

{
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ]
}

Response

Successful response

idstring
objectstring
createdinteger
modelstring

Example response

{
  "id": "chatcmpl-9ugiTupGJUmeRNqyqUvYO34GOUzyv",
  "object": "chat.completion",
  "created": 1723297597,
  "model": "gpt-3.5-turbo-0125",
  "choices": [
    {
      "message": {
        "content": "Hello! How can I help you?",
        "role": "assistant"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 11,
    "completion_tokens": 17,
    "total_tokens": 28
  }
}