cURL
curl --request POST \
--url https://api.openpipe.ai/api/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"role": "system",
"content": "",
"name": "<string>"
}
],
"model": "<string>",
"audio": {},
"function_call": "none",
"functions": [
{
"name": "<string>",
"parameters": {},
"description": "<string>",
"strict": true
}
],
"tool_choice": "none",
"tools": [
{
"function": {
"name": "<string>",
"parameters": {},
"description": "<string>",
"strict": true
},
"type": "function"
}
],
"n": 123,
"max_tokens": 123,
"max_completion_tokens": 123,
"temperature": 123,
"top_p": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"stop": "<string>",
"response_format": {
"type": "text"
},
"logprobs": true,
"top_logprobs": 123,
"store": true,
"metadata": {},
"stream": false
}
'import requests
url = "https://api.openpipe.ai/api/v1/chat/completions"
payload = {
"messages": [
{
"role": "system",
"content": "",
"name": "<string>"
}
],
"model": "<string>",
"audio": {},
"function_call": "none",
"functions": [
{
"name": "<string>",
"parameters": {},
"description": "<string>",
"strict": True
}
],
"tool_choice": "none",
"tools": [
{
"function": {
"name": "<string>",
"parameters": {},
"description": "<string>",
"strict": True
},
"type": "function"
}
],
"n": 123,
"max_tokens": 123,
"max_completion_tokens": 123,
"temperature": 123,
"top_p": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"stop": "<string>",
"response_format": { "type": "text" },
"logprobs": True,
"top_logprobs": 123,
"store": True,
"metadata": {},
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{role: 'system', content: '', name: '<string>'}],
model: '<string>',
audio: {},
function_call: 'none',
functions: [{name: '<string>', parameters: {}, description: '<string>', strict: true}],
tool_choice: 'none',
tools: [
{
function: {name: '<string>', parameters: {}, description: '<string>', strict: true},
type: 'function'
}
],
n: 123,
max_tokens: 123,
max_completion_tokens: 123,
temperature: 123,
top_p: 123,
presence_penalty: 123,
frequency_penalty: 123,
stop: '<string>',
response_format: {type: 'text'},
logprobs: true,
top_logprobs: 123,
store: true,
metadata: {},
stream: false
})
};
fetch('https://api.openpipe.ai/api/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openpipe.ai/api/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'role' => 'system',
'content' => '',
'name' => '<string>'
]
],
'model' => '<string>',
'audio' => [
],
'function_call' => 'none',
'functions' => [
[
'name' => '<string>',
'parameters' => [
],
'description' => '<string>',
'strict' => true
]
],
'tool_choice' => 'none',
'tools' => [
[
'function' => [
'name' => '<string>',
'parameters' => [
],
'description' => '<string>',
'strict' => true
],
'type' => 'function'
]
],
'n' => 123,
'max_tokens' => 123,
'max_completion_tokens' => 123,
'temperature' => 123,
'top_p' => 123,
'presence_penalty' => 123,
'frequency_penalty' => 123,
'stop' => '<string>',
'response_format' => [
'type' => 'text'
],
'logprobs' => true,
'top_logprobs' => 123,
'store' => true,
'metadata' => [
],
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.openpipe.ai/api/v1/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {},\n \"function_call\": \"none\",\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n }\n ],\n \"tool_choice\": \"none\",\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"n\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 123,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"type\": \"text\"\n },\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"store\": true,\n \"metadata\": {},\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.openpipe.ai/api/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {},\n \"function_call\": \"none\",\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n }\n ],\n \"tool_choice\": \"none\",\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"n\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 123,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"type\": \"text\"\n },\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"store\": true,\n \"metadata\": {},\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openpipe.ai/api/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {},\n \"function_call\": \"none\",\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n }\n ],\n \"tool_choice\": \"none\",\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"n\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 123,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"type\": \"text\"\n },\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"store\": true,\n \"metadata\": {},\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"finish_reason": "length",
"index": 123,
"message": {
"role": "assistant",
"reasoning_content": "<string>",
"content": null,
"refusal": "<string>",
"function_call": {
"name": "",
"arguments": ""
},
"tool_calls": [
{
"id": "<string>",
"function": {
"name": "<string>",
"arguments": "<string>"
},
"type": "function"
}
]
},
"logprobs": null,
"content_filter_results": {},
"criteria_results": {}
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"prompt_cache_hit_tokens": 123,
"prompt_cache_miss_tokens": 123,
"completion_tokens_details": {
"reasoning_tokens": 123,
"audio_tokens": 123,
"text_tokens": 123,
"accepted_prediction_tokens": 123,
"rejected_prediction_tokens": 123
},
"prompt_tokens_details": {
"cached_tokens": 123,
"audio_tokens": 123
},
"criteria": {}
}
}{
"message": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>"
}
]
}Chat Completions
Chat Completions
OpenAI-compatible route for generating inference and optionally logging the request.
POST
/
chat
/
completions
cURL
curl --request POST \
--url https://api.openpipe.ai/api/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"role": "system",
"content": "",
"name": "<string>"
}
],
"model": "<string>",
"audio": {},
"function_call": "none",
"functions": [
{
"name": "<string>",
"parameters": {},
"description": "<string>",
"strict": true
}
],
"tool_choice": "none",
"tools": [
{
"function": {
"name": "<string>",
"parameters": {},
"description": "<string>",
"strict": true
},
"type": "function"
}
],
"n": 123,
"max_tokens": 123,
"max_completion_tokens": 123,
"temperature": 123,
"top_p": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"stop": "<string>",
"response_format": {
"type": "text"
},
"logprobs": true,
"top_logprobs": 123,
"store": true,
"metadata": {},
"stream": false
}
'import requests
url = "https://api.openpipe.ai/api/v1/chat/completions"
payload = {
"messages": [
{
"role": "system",
"content": "",
"name": "<string>"
}
],
"model": "<string>",
"audio": {},
"function_call": "none",
"functions": [
{
"name": "<string>",
"parameters": {},
"description": "<string>",
"strict": True
}
],
"tool_choice": "none",
"tools": [
{
"function": {
"name": "<string>",
"parameters": {},
"description": "<string>",
"strict": True
},
"type": "function"
}
],
"n": 123,
"max_tokens": 123,
"max_completion_tokens": 123,
"temperature": 123,
"top_p": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"stop": "<string>",
"response_format": { "type": "text" },
"logprobs": True,
"top_logprobs": 123,
"store": True,
"metadata": {},
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{role: 'system', content: '', name: '<string>'}],
model: '<string>',
audio: {},
function_call: 'none',
functions: [{name: '<string>', parameters: {}, description: '<string>', strict: true}],
tool_choice: 'none',
tools: [
{
function: {name: '<string>', parameters: {}, description: '<string>', strict: true},
type: 'function'
}
],
n: 123,
max_tokens: 123,
max_completion_tokens: 123,
temperature: 123,
top_p: 123,
presence_penalty: 123,
frequency_penalty: 123,
stop: '<string>',
response_format: {type: 'text'},
logprobs: true,
top_logprobs: 123,
store: true,
metadata: {},
stream: false
})
};
fetch('https://api.openpipe.ai/api/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openpipe.ai/api/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'role' => 'system',
'content' => '',
'name' => '<string>'
]
],
'model' => '<string>',
'audio' => [
],
'function_call' => 'none',
'functions' => [
[
'name' => '<string>',
'parameters' => [
],
'description' => '<string>',
'strict' => true
]
],
'tool_choice' => 'none',
'tools' => [
[
'function' => [
'name' => '<string>',
'parameters' => [
],
'description' => '<string>',
'strict' => true
],
'type' => 'function'
]
],
'n' => 123,
'max_tokens' => 123,
'max_completion_tokens' => 123,
'temperature' => 123,
'top_p' => 123,
'presence_penalty' => 123,
'frequency_penalty' => 123,
'stop' => '<string>',
'response_format' => [
'type' => 'text'
],
'logprobs' => true,
'top_logprobs' => 123,
'store' => true,
'metadata' => [
],
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.openpipe.ai/api/v1/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {},\n \"function_call\": \"none\",\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n }\n ],\n \"tool_choice\": \"none\",\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"n\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 123,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"type\": \"text\"\n },\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"store\": true,\n \"metadata\": {},\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.openpipe.ai/api/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {},\n \"function_call\": \"none\",\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n }\n ],\n \"tool_choice\": \"none\",\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"n\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 123,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"type\": \"text\"\n },\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"store\": true,\n \"metadata\": {},\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openpipe.ai/api/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {},\n \"function_call\": \"none\",\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n }\n ],\n \"tool_choice\": \"none\",\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"description\": \"<string>\",\n \"strict\": true\n },\n \"type\": \"function\"\n }\n ],\n \"n\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 123,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"type\": \"text\"\n },\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"store\": true,\n \"metadata\": {},\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"finish_reason": "length",
"index": 123,
"message": {
"role": "assistant",
"reasoning_content": "<string>",
"content": null,
"refusal": "<string>",
"function_call": {
"name": "",
"arguments": ""
},
"tool_calls": [
{
"id": "<string>",
"function": {
"name": "<string>",
"arguments": "<string>"
},
"type": "function"
}
]
},
"logprobs": null,
"content_filter_results": {},
"criteria_results": {}
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"prompt_cache_hit_tokens": 123,
"prompt_cache_miss_tokens": 123,
"completion_tokens_details": {
"reasoning_tokens": 123,
"audio_tokens": 123,
"text_tokens": 123,
"accepted_prediction_tokens": 123,
"rejected_prediction_tokens": 123
},
"prompt_tokens_details": {
"cached_tokens": 123,
"audio_tokens": 123
},
"criteria": {}
}
}{
"message": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
none Show child attributes
Show child attributes
Available options:
none Show child attributes
Show child attributes
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I