API Reference
Chat Completions
API Reference
Chat Completions
OpenAI-compatible route for generating inference and optionally logging the request.
POST
/
chat
/
completions
Authorization
string
*
Bearer
Authorization
Required
string
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
object
*
model
string
*
model
Required
string
messages
array
*
messages
Required
array
function_call
Option 1 · enum<string>
function_call
enum<string>
functions
array
functions
array
tool_choice
Option 1 · enum<string>
tool_choice
enum<string>
tools
array
tools
array
n
number
n
number
max_tokens
number
max_tokens
number
temperature
number
temperature
number
response_format
object
response_format
object
type
Option 1 · enum<string>
*
type
Required
enum<string>
stream
boolean
stream
boolean
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
headerrequiredBearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
application/json
model
string
requiredmessages
object[]
requiredmessages.role
enum<string>
requiredAvailable options:
system
messages.content
string
default: function_call
Available options:
none
functions
object[]
functions.name
string
requiredfunctions.parameters
object
functions.description
string
tool_choice
Available options:
none
tools
object[]
tools.function
object
requiredtools.function.name
string
requiredtools.function.parameters
object
tools.function.description
string
tools.type
enum<string>
requiredAvailable options:
function
n
number
max_tokens
number | null
temperature
number
response_format
object
response_format.type
required
Available options:
text
stream
boolean
default: falseResponse
200 - application/json
id
string
requiredobject
enum<string>
requiredAvailable options:
chat.completion
created
number
requiredmodel
string
requiredchoices
object[]
requiredchoices.finish_reason
required
Available options:
length
choices.index
number
requiredchoices.message
object
requiredchoices.message.role
enum<string>
requiredAvailable options:
assistant
choices.message.content
choices.message.function_call
object
choices.message.function_call.name
string
default: choices.message.function_call.arguments
string
default: choices.message.tool_calls
object[]
choices.message.tool_calls.id
string
requiredchoices.message.tool_calls.function
object
requiredchoices.message.tool_calls.function.name
string
requiredchoices.message.tool_calls.function.arguments
string
requiredchoices.message.tool_calls.type
enum<string>
requiredAvailable options:
function
choices.logprobs
object | null
choices.logprobs.content
object[] | null
requiredchoices.logprobs.content.token
string
requiredchoices.logprobs.content.bytes
number[] | null
requiredchoices.logprobs.content.logprob
number
requiredchoices.logprobs.content.top_logprobs
object[]
requiredchoices.logprobs.content.top_logprobs.token
string
requiredchoices.logprobs.content.top_logprobs.bytes
number[] | null
requiredchoices.logprobs.content.top_logprobs.logprob
number
requiredusage
object
usage.prompt_tokens
number
requiredusage.completion_tokens
number
requiredusage.total_tokens
number
requiredcurl --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
}
}