curl --request POST \
--url https://api.bytez.com/models/v2/openai/v1/chat/completions \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{
"content": "<string>"
}
],
"max_completion_tokens": 256,
"temperature": 0.7,
"stream": false,
"top_p": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"logprobs": true,
"top_logprobs": 123
}
'import requests
url = "https://api.bytez.com/models/v2/openai/v1/chat/completions"
payload = {
"model": "<string>",
"messages": [{ "content": "<string>" }],
"max_completion_tokens": 256,
"temperature": 0.7,
"stream": False,
"top_p": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"logprobs": True,
"top_logprobs": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{content: '<string>'}],
max_completion_tokens: 256,
temperature: 0.7,
stream: false,
top_p: 123,
presence_penalty: 123,
frequency_penalty: 123,
logprobs: true,
top_logprobs: 123
})
};
fetch('https://api.bytez.com/models/v2/openai/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.bytez.com/models/v2/openai/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([
'model' => '<string>',
'messages' => [
[
'content' => '<string>'
]
],
'max_completion_tokens' => 256,
'temperature' => 0.7,
'stream' => false,
'top_p' => 123,
'presence_penalty' => 123,
'frequency_penalty' => 123,
'logprobs' => true,
'top_logprobs' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.bytez.com/models/v2/openai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"max_completion_tokens\": 256,\n \"temperature\": 0.7,\n \"stream\": false,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"logprobs\": true,\n \"top_logprobs\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.bytez.com/models/v2/openai/v1/chat/completions")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"max_completion_tokens\": 256,\n \"temperature\": 0.7,\n \"stream\": false,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"logprobs\": true,\n \"top_logprobs\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bytez.com/models/v2/openai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"max_completion_tokens\": 256,\n \"temperature\": 0.7,\n \"stream\": false,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"logprobs\": true,\n \"top_logprobs\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": 123,
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>"
},
"finish_reason": "<string>"
}
]
}Chat Completions
Sends a prompt to an OpenAI compatible chat completion model and returns a completion. Provides completions for open source models that are text-generation, chat, audio-text-to-text, image-text-to-text, video-text-to-text, and also supports closed source providers openai, anthropic, mistral, cohere, and google. To send a request to a closed source provider, prefix your model with their provider name, e.g. openai/gpt-4.
curl --request POST \
--url https://api.bytez.com/models/v2/openai/v1/chat/completions \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{
"content": "<string>"
}
],
"max_completion_tokens": 256,
"temperature": 0.7,
"stream": false,
"top_p": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"logprobs": true,
"top_logprobs": 123
}
'import requests
url = "https://api.bytez.com/models/v2/openai/v1/chat/completions"
payload = {
"model": "<string>",
"messages": [{ "content": "<string>" }],
"max_completion_tokens": 256,
"temperature": 0.7,
"stream": False,
"top_p": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"logprobs": True,
"top_logprobs": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{content: '<string>'}],
max_completion_tokens: 256,
temperature: 0.7,
stream: false,
top_p: 123,
presence_penalty: 123,
frequency_penalty: 123,
logprobs: true,
top_logprobs: 123
})
};
fetch('https://api.bytez.com/models/v2/openai/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.bytez.com/models/v2/openai/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([
'model' => '<string>',
'messages' => [
[
'content' => '<string>'
]
],
'max_completion_tokens' => 256,
'temperature' => 0.7,
'stream' => false,
'top_p' => 123,
'presence_penalty' => 123,
'frequency_penalty' => 123,
'logprobs' => true,
'top_logprobs' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.bytez.com/models/v2/openai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"max_completion_tokens\": 256,\n \"temperature\": 0.7,\n \"stream\": false,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"logprobs\": true,\n \"top_logprobs\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.bytez.com/models/v2/openai/v1/chat/completions")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"max_completion_tokens\": 256,\n \"temperature\": 0.7,\n \"stream\": false,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"logprobs\": true,\n \"top_logprobs\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bytez.com/models/v2/openai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"max_completion_tokens\": 256,\n \"temperature\": 0.7,\n \"stream\": false,\n \"top_p\": 123,\n \"presence_penalty\": 123,\n \"frequency_penalty\": 123,\n \"logprobs\": true,\n \"top_logprobs\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": 123,
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>"
},
"finish_reason": "<string>"
}
]
}Headers
Token for authentication
Body
The ID of the model to run (e.g., Qwen/Qwen3-1.7B, openai/gpt-4)
Conversation messages (OpenAI chat format)
Show child attributes
Show child attributes
Maximum number of tokens to generate
Sampling temperature
Whether to stream responses
Nucleus sampling parameter
Penalize new tokens based on whether they appear in the text so far
Penalize new tokens based on their existing frequency in the text so far
Whether to return log probabilities of output tokens (if supported)
Number of most likely tokens to return at each position (if logprobs is true)