POST
/
api
/
v1
/
chat
/
completions
curl --request POST \
  --url https://studio.premai.io/api/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "role": "system",
      "content": null
    }
  ],
  "model": "<string>",
  "frequency_penalty": 0,
  "max_completion_tokens": null,
  "presence_penalty": 0,
  "seed": 123,
  "stop": "<string>",
  "stream": false,
  "temperature": 0.7,
  "top_p": 1,
  "response_format": {
    "type": "text",
    "json_schema": {}
  }
}'
{
  "id": "<string>",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 1,
      "message": {
        "content": "<string>",
        "role": "assistant"
      }
    }
  ],
  "created": 123,
  "model": "<string>",
  "system_fingerprint": "<string>",
  "object": "<string>",
  "usage": {
    "completion_tokens": 1,
    "prompt_tokens": 1,
    "total_tokens": 1
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Response

200
application/json

Successful chat completion response (non-streaming). For streaming, use stream=true and expect text/event-stream.

The response is of type object.