POST
/
v1
/
chat
/
completions
curl --request POST \
  --url https://api.opentools.com/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "<string>",
  "messages": [
    {
      "role": "system",
      "content": "<string>",
      "tool_calls": [
        {
          "id": "<string>",
          "function": {
            "name": "<string>",
            "arguments": "<string>"
          },
          "type": "function"
        }
      ],
      "name": "<string>"
    }
  ],
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "<string>",
        "description": "<string>",
        "parameters": {}
      }
    }
  ],
  "tool_choice": {},
  "temperature": 1,
  "max_tokens": 2
}'
{
  "id": "<string>",
  "choices": [
    {
      "message": {
        "role": "system",
        "content": "<string>",
        "tool_calls": [
          {
            "id": "<string>",
            "function": {
              "name": "<string>",
              "arguments": "<string>"
            },
            "type": "function"
          }
        ],
        "name": "<string>"
      },
      "finish_reason": "<string>",
      "index": 123
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Authentication using a bearer token

Body

application/json
Chat completion request parameters
model
string
required

The model ID to use

messages
object[]
required

A list of messages comprising the conversation so far

stream
boolean
default:
false

Whether to stream the response

tools
object[]

A list of tools the model may use

tool_choice
object

Controls which tool is used by the model

temperature
number

What sampling temperature to use

Required range: 0 <= x <= 2
max_tokens
integer

The maximum number of tokens to generate

Required range: x >= 1

Response

200
application/json
Successful completion
id
string

A unique identifier for the completion

choices
object[]

A list of completion choices

usage
object