POST
/
chat
/
completions
curl --request POST \
  --url https://app.openpipe.ai/api/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "<string>",
  "messages": [
    {
      "role": "system",
      "content": "<string>"
    }
  ],
  "function_call": "none",
  "functions": [
    {
      "name": "<string>",
      "parameters": {},
      "description": "<string>"
    }
  ],
  "tool_choice": "none",
  "tools": [
    {
      "function": {
        "name": "<string>",
        "parameters": {},
        "description": "<string>"
      },
      "type": "function"
    }
  ],
  "n": 123,
  "max_tokens": 123,
  "temperature": 123,
  "response_format": {
    "type": "text"
  },
  "stream": true
}'
{
  "id": "<string>",
  "object": "chat.completion",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "finish_reason": "length",
      "index": 123,
      "message": {
        "role": "assistant",
        "content": "<string>",
        "function_call": {
          "name": "<string>",
          "arguments": "<string>"
        },
        "tool_calls": [
          {
            "id": "<string>",
            "function": {
              "name": "<string>",
              "arguments": "<string>"
            },
            "type": "function"
          }
        ]
      },
      "logprobs": {
        "content": [
          {
            "token": "<string>",
            "bytes": [
              123
            ],
            "logprob": 123,
            "top_logprobs": [
              {
                "token": "<string>",
                "bytes": [
                  123
                ],
                "logprob": 123
              }
            ]
          }
        ]
      }
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
headerrequired

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

Body

application/json
model
string
required
messages
object[]
required
function_call
Available options:
none
functions
object[]
tool_choice
Available options:
none
tools
object[]
n
number
max_tokens
number | null
temperature
number
response_format
object
stream
boolean
default: false

Response

200 - application/json
id
string
required
object
enum<string>
required
Available options:
chat.completion
created
number
required
model
string
required
choices
object[]
required
usage
object