Create Chat Completion
curl --request POST \
--url https://api.example.com/api/v1/openai/chat/completions \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>",
"role": "<string>",
"name": "<string>"
}
],
"model": "<string>",
"audio": {
"voice": "<string>"
},
"frequency_penalty": 123,
"functions": [
{
"name": "<string>",
"description": "<string>",
"parameters": {}
}
],
"logit_bias": {},
"logprobs": true,
"max_completion_tokens": 123,
"max_tokens": 123,
"metadata": {},
"modalities": [],
"n": 123,
"parallel_tool_calls": true,
"prediction": {
"content": "<string>",
"type": "<string>"
},
"presence_penalty": 123,
"response_format": {
"type": "<string>"
},
"seed": 123,
"stop": "<string>",
"store": true,
"stream": true,
"stream_options": {
"include_obfuscation": true,
"include_usage": true
},
"temperature": 123,
"tools": [
{
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true
},
"type": "<string>"
}
],
"top_logprobs": 123,
"top_p": 123,
"user": "<string>",
"web_search_options": {
"user_location": {
"approximate": {
"city": "<string>",
"country": "<string>",
"region": "<string>",
"timezone": "<string>"
},
"type": "<string>"
}
}
}
'import requests
url = "https://api.example.com/api/v1/openai/chat/completions"
payload = {
"messages": [
{
"content": "<string>",
"role": "<string>",
"name": "<string>"
}
],
"model": "<string>",
"audio": { "voice": "<string>" },
"frequency_penalty": 123,
"functions": [
{
"name": "<string>",
"description": "<string>",
"parameters": {}
}
],
"logit_bias": {},
"logprobs": True,
"max_completion_tokens": 123,
"max_tokens": 123,
"metadata": {},
"modalities": [],
"n": 123,
"parallel_tool_calls": True,
"prediction": {
"content": "<string>",
"type": "<string>"
},
"presence_penalty": 123,
"response_format": { "type": "<string>" },
"seed": 123,
"stop": "<string>",
"store": True,
"stream": True,
"stream_options": {
"include_obfuscation": True,
"include_usage": True
},
"temperature": 123,
"tools": [
{
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": True
},
"type": "<string>"
}
],
"top_logprobs": 123,
"top_p": 123,
"user": "<string>",
"web_search_options": { "user_location": {
"approximate": {
"city": "<string>",
"country": "<string>",
"region": "<string>",
"timezone": "<string>"
},
"type": "<string>"
} }
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>', role: '<string>', name: '<string>'}],
model: '<string>',
audio: {voice: '<string>'},
frequency_penalty: 123,
functions: [{name: '<string>', description: '<string>', parameters: {}}],
logit_bias: {},
logprobs: true,
max_completion_tokens: 123,
max_tokens: 123,
metadata: {},
modalities: [],
n: 123,
parallel_tool_calls: true,
prediction: {content: '<string>', type: '<string>'},
presence_penalty: 123,
response_format: {type: '<string>'},
seed: 123,
stop: '<string>',
store: true,
stream: true,
stream_options: {include_obfuscation: true, include_usage: true},
temperature: 123,
tools: [
{
function: {name: '<string>', description: '<string>', parameters: {}, strict: true},
type: '<string>'
}
],
top_logprobs: 123,
top_p: 123,
user: '<string>',
web_search_options: {
user_location: {
approximate: {
city: '<string>',
country: '<string>',
region: '<string>',
timezone: '<string>'
},
type: '<string>'
}
}
})
};
fetch('https://api.example.com/api/v1/openai/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.example.com/api/v1/openai/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' => [
[
'content' => '<string>',
'role' => '<string>',
'name' => '<string>'
]
],
'model' => '<string>',
'audio' => [
'voice' => '<string>'
],
'frequency_penalty' => 123,
'functions' => [
[
'name' => '<string>',
'description' => '<string>',
'parameters' => [
]
]
],
'logit_bias' => [
],
'logprobs' => true,
'max_completion_tokens' => 123,
'max_tokens' => 123,
'metadata' => [
],
'modalities' => [
],
'n' => 123,
'parallel_tool_calls' => true,
'prediction' => [
'content' => '<string>',
'type' => '<string>'
],
'presence_penalty' => 123,
'response_format' => [
'type' => '<string>'
],
'seed' => 123,
'stop' => '<string>',
'store' => true,
'stream' => true,
'stream_options' => [
'include_obfuscation' => true,
'include_usage' => true
],
'temperature' => 123,
'tools' => [
[
'function' => [
'name' => '<string>',
'description' => '<string>',
'parameters' => [
],
'strict' => true
],
'type' => '<string>'
]
],
'top_logprobs' => 123,
'top_p' => 123,
'user' => '<string>',
'web_search_options' => [
'user_location' => [
'approximate' => [
'city' => '<string>',
'country' => '<string>',
'region' => '<string>',
'timezone' => '<string>'
],
'type' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.example.com/api/v1/openai/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {\n \"voice\": \"<string>\"\n },\n \"frequency_penalty\": 123,\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {\n \"content\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"presence_penalty\": 123,\n \"response_format\": {\n \"type\": \"<string>\"\n },\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {\n \"include_obfuscation\": true,\n \"include_usage\": true\n },\n \"temperature\": 123,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"user\": \"<string>\",\n \"web_search_options\": {\n \"user_location\": {\n \"approximate\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"region\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.example.com/api/v1/openai/chat/completions")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {\n \"voice\": \"<string>\"\n },\n \"frequency_penalty\": 123,\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {\n \"content\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"presence_penalty\": 123,\n \"response_format\": {\n \"type\": \"<string>\"\n },\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {\n \"include_obfuscation\": true,\n \"include_usage\": true\n },\n \"temperature\": 123,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"user\": \"<string>\",\n \"web_search_options\": {\n \"user_location\": {\n \"approximate\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"region\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/openai/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {\n \"voice\": \"<string>\"\n },\n \"frequency_penalty\": 123,\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {\n \"content\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"presence_penalty\": 123,\n \"response_format\": {\n \"type\": \"<string>\"\n },\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {\n \"include_obfuscation\": true,\n \"include_usage\": true\n },\n \"temperature\": 123,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"user\": \"<string>\",\n \"web_search_options\": {\n \"user_location\": {\n \"approximate\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"region\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
Corresponds to args to OpenAI client.chat.completions.create(...)
Developer-provided instructions that the model should follow, regardless of
messages sent by the user. With o1 models and newer, developer messages
replace the previous system messages.
- ChatCompletionDeveloperMessageParam
- ChatCompletionSystemMessageParam
- ChatCompletionUserMessageParam
- ChatCompletionAssistantMessageParam
- ChatCompletionToolMessageParam
- ChatCompletionFunctionMessageParam
Show child attributes
Show child attributes
Parameters for audio output.
Required when audio output is requested with
modalities: ["audio"]. Learn more.
Show child attributes
Show child attributes
none, auto Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
text, audio Static predicted output content, such as the content of a text file that is being regenerated.
Show child attributes
Show child attributes
none, minimal, low, medium, high, xhigh Default response format. Used to generate text responses.
- ResponseFormatText
- ResponseFormatJSONSchema
- ResponseFormatJSONObject
Show child attributes
Show child attributes
auto, default, flex, scale, priority Options for streaming response. Only set this when you set stream: true.
Show child attributes
Show child attributes
none, auto, required Show child attributes
Show child attributes
This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
Show child attributes
Show child attributes
Response
Successful Response
curl --request POST \
--url https://api.example.com/api/v1/openai/chat/completions \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>",
"role": "<string>",
"name": "<string>"
}
],
"model": "<string>",
"audio": {
"voice": "<string>"
},
"frequency_penalty": 123,
"functions": [
{
"name": "<string>",
"description": "<string>",
"parameters": {}
}
],
"logit_bias": {},
"logprobs": true,
"max_completion_tokens": 123,
"max_tokens": 123,
"metadata": {},
"modalities": [],
"n": 123,
"parallel_tool_calls": true,
"prediction": {
"content": "<string>",
"type": "<string>"
},
"presence_penalty": 123,
"response_format": {
"type": "<string>"
},
"seed": 123,
"stop": "<string>",
"store": true,
"stream": true,
"stream_options": {
"include_obfuscation": true,
"include_usage": true
},
"temperature": 123,
"tools": [
{
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true
},
"type": "<string>"
}
],
"top_logprobs": 123,
"top_p": 123,
"user": "<string>",
"web_search_options": {
"user_location": {
"approximate": {
"city": "<string>",
"country": "<string>",
"region": "<string>",
"timezone": "<string>"
},
"type": "<string>"
}
}
}
'import requests
url = "https://api.example.com/api/v1/openai/chat/completions"
payload = {
"messages": [
{
"content": "<string>",
"role": "<string>",
"name": "<string>"
}
],
"model": "<string>",
"audio": { "voice": "<string>" },
"frequency_penalty": 123,
"functions": [
{
"name": "<string>",
"description": "<string>",
"parameters": {}
}
],
"logit_bias": {},
"logprobs": True,
"max_completion_tokens": 123,
"max_tokens": 123,
"metadata": {},
"modalities": [],
"n": 123,
"parallel_tool_calls": True,
"prediction": {
"content": "<string>",
"type": "<string>"
},
"presence_penalty": 123,
"response_format": { "type": "<string>" },
"seed": 123,
"stop": "<string>",
"store": True,
"stream": True,
"stream_options": {
"include_obfuscation": True,
"include_usage": True
},
"temperature": 123,
"tools": [
{
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": True
},
"type": "<string>"
}
],
"top_logprobs": 123,
"top_p": 123,
"user": "<string>",
"web_search_options": { "user_location": {
"approximate": {
"city": "<string>",
"country": "<string>",
"region": "<string>",
"timezone": "<string>"
},
"type": "<string>"
} }
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>', role: '<string>', name: '<string>'}],
model: '<string>',
audio: {voice: '<string>'},
frequency_penalty: 123,
functions: [{name: '<string>', description: '<string>', parameters: {}}],
logit_bias: {},
logprobs: true,
max_completion_tokens: 123,
max_tokens: 123,
metadata: {},
modalities: [],
n: 123,
parallel_tool_calls: true,
prediction: {content: '<string>', type: '<string>'},
presence_penalty: 123,
response_format: {type: '<string>'},
seed: 123,
stop: '<string>',
store: true,
stream: true,
stream_options: {include_obfuscation: true, include_usage: true},
temperature: 123,
tools: [
{
function: {name: '<string>', description: '<string>', parameters: {}, strict: true},
type: '<string>'
}
],
top_logprobs: 123,
top_p: 123,
user: '<string>',
web_search_options: {
user_location: {
approximate: {
city: '<string>',
country: '<string>',
region: '<string>',
timezone: '<string>'
},
type: '<string>'
}
}
})
};
fetch('https://api.example.com/api/v1/openai/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.example.com/api/v1/openai/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' => [
[
'content' => '<string>',
'role' => '<string>',
'name' => '<string>'
]
],
'model' => '<string>',
'audio' => [
'voice' => '<string>'
],
'frequency_penalty' => 123,
'functions' => [
[
'name' => '<string>',
'description' => '<string>',
'parameters' => [
]
]
],
'logit_bias' => [
],
'logprobs' => true,
'max_completion_tokens' => 123,
'max_tokens' => 123,
'metadata' => [
],
'modalities' => [
],
'n' => 123,
'parallel_tool_calls' => true,
'prediction' => [
'content' => '<string>',
'type' => '<string>'
],
'presence_penalty' => 123,
'response_format' => [
'type' => '<string>'
],
'seed' => 123,
'stop' => '<string>',
'store' => true,
'stream' => true,
'stream_options' => [
'include_obfuscation' => true,
'include_usage' => true
],
'temperature' => 123,
'tools' => [
[
'function' => [
'name' => '<string>',
'description' => '<string>',
'parameters' => [
],
'strict' => true
],
'type' => '<string>'
]
],
'top_logprobs' => 123,
'top_p' => 123,
'user' => '<string>',
'web_search_options' => [
'user_location' => [
'approximate' => [
'city' => '<string>',
'country' => '<string>',
'region' => '<string>',
'timezone' => '<string>'
],
'type' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.example.com/api/v1/openai/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {\n \"voice\": \"<string>\"\n },\n \"frequency_penalty\": 123,\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {\n \"content\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"presence_penalty\": 123,\n \"response_format\": {\n \"type\": \"<string>\"\n },\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {\n \"include_obfuscation\": true,\n \"include_usage\": true\n },\n \"temperature\": 123,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"user\": \"<string>\",\n \"web_search_options\": {\n \"user_location\": {\n \"approximate\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"region\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.example.com/api/v1/openai/chat/completions")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {\n \"voice\": \"<string>\"\n },\n \"frequency_penalty\": 123,\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {\n \"content\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"presence_penalty\": 123,\n \"response_format\": {\n \"type\": \"<string>\"\n },\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {\n \"include_obfuscation\": true,\n \"include_usage\": true\n },\n \"temperature\": 123,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"user\": \"<string>\",\n \"web_search_options\": {\n \"user_location\": {\n \"approximate\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"region\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/openai/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"<string>\",\n \"audio\": {\n \"voice\": \"<string>\"\n },\n \"frequency_penalty\": 123,\n \"functions\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {\n \"content\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"presence_penalty\": 123,\n \"response_format\": {\n \"type\": \"<string>\"\n },\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {\n \"include_obfuscation\": true,\n \"include_usage\": true\n },\n \"temperature\": 123,\n \"tools\": [\n {\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n },\n \"type\": \"<string>\"\n }\n ],\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"user\": \"<string>\",\n \"web_search_options\": {\n \"user_location\": {\n \"approximate\": {\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"region\": \"<string>\",\n \"timezone\": \"<string>\"\n },\n \"type\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}