Chat

Generate a chat completion

post

Create a chat completion based on a list of messages. Requires authorization.

Authorizations
Body
modelstringRequired

Model ID to use for the completion

Example: copilot-zero
temperaturenumberOptional

Sampling temperature between 0 and 1.

Default: 0.7
max_tokensintegerOptional

Maximum tokens to generate (max 4096).

Default: 1024
streambooleanOptional

Whether to stream partial responses.

Default: false
instructionsstring | nullableOptional

Optional instructions for the model.

Responses
200
Chat completion response
application/json
post
POST /v1/chat/completions HTTP/1.1
Host: api.secton.org
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 165

{
  "model": "copilot-zero",
  "messages": [
    {
      "role": "user",
      "content": "Hello, how can I help you?"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 1024,
  "stream": false,
  "instructions": "text"
}
{
  "object": "chat.completion",
  "model": "copilot-zero",
  "organization_id": "org_1234",
  "messages": [
    {
      "role": "user",
      "content": "Hello! How can I assist you today?"
    }
  ],
  "usage": {
    "prompt_tokens": 50,
    "completion_tokens": 100,
    "total_tokens": 150
  }
}

Was this helpful?