curl --request POST \
--url https://api.egp.scale.com/v5/chat/completions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "<string>",
"messages": [
{}
],
"top_k": 123,
"frequency_penalty": 0,
"function_call": {},
"functions": [
{}
],
"logit_bias": {},
"logprobs": true,
"max_completion_tokens": 123,
"max_tokens": 123,
"metadata": {},
"modalities": [
"<string>"
],
"n": 123,
"parallel_tool_calls": true,
"prediction": {},
"presence_penalty": 0,
"reasoning_effort": "<string>",
"response_format": {},
"seed": 123,
"stop": "<string>",
"store": true,
"stream": true,
"stream_options": {},
"temperature": 1,
"tool_choice": "<string>",
"tools": [
{}
],
"top_logprobs": 10,
"top_p": 0.5,
"audio": {}
}
'import requests
url = "https://api.egp.scale.com/v5/chat/completions"
payload = {
"model": "<string>",
"messages": [{}],
"top_k": 123,
"frequency_penalty": 0,
"function_call": {},
"functions": [{}],
"logit_bias": {},
"logprobs": True,
"max_completion_tokens": 123,
"max_tokens": 123,
"metadata": {},
"modalities": ["<string>"],
"n": 123,
"parallel_tool_calls": True,
"prediction": {},
"presence_penalty": 0,
"reasoning_effort": "<string>",
"response_format": {},
"seed": 123,
"stop": "<string>",
"store": True,
"stream": True,
"stream_options": {},
"temperature": 1,
"tool_choice": "<string>",
"tools": [{}],
"top_logprobs": 10,
"top_p": 0.5,
"audio": {}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{}],
top_k: 123,
frequency_penalty: 0,
function_call: {},
functions: [{}],
logit_bias: {},
logprobs: true,
max_completion_tokens: 123,
max_tokens: 123,
metadata: {},
modalities: ['<string>'],
n: 123,
parallel_tool_calls: true,
prediction: {},
presence_penalty: 0,
reasoning_effort: '<string>',
response_format: {},
seed: 123,
stop: '<string>',
store: true,
stream: true,
stream_options: {},
temperature: 1,
tool_choice: '<string>',
tools: [{}],
top_logprobs: 10,
top_p: 0.5,
audio: {}
})
};
fetch('https://api.egp.scale.com/v5/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.egp.scale.com/v5/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' => [
[
]
],
'top_k' => 123,
'frequency_penalty' => 0,
'function_call' => [
],
'functions' => [
[
]
],
'logit_bias' => [
],
'logprobs' => true,
'max_completion_tokens' => 123,
'max_tokens' => 123,
'metadata' => [
],
'modalities' => [
'<string>'
],
'n' => 123,
'parallel_tool_calls' => true,
'prediction' => [
],
'presence_penalty' => 0,
'reasoning_effort' => '<string>',
'response_format' => [
],
'seed' => 123,
'stop' => '<string>',
'store' => true,
'stream' => true,
'stream_options' => [
],
'temperature' => 1,
'tool_choice' => '<string>',
'tools' => [
[
]
],
'top_logprobs' => 10,
'top_p' => 0.5,
'audio' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.egp.scale.com/v5/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"function_call\": {},\n \"functions\": [\n {}\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [\n \"<string>\"\n ],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {},\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"<string>\",\n \"response_format\": {},\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {},\n \"temperature\": 1,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {}\n ],\n \"top_logprobs\": 10,\n \"top_p\": 0.5,\n \"audio\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.egp.scale.com/v5/chat/completions")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"function_call\": {},\n \"functions\": [\n {}\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [\n \"<string>\"\n ],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {},\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"<string>\",\n \"response_format\": {},\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {},\n \"temperature\": 1,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {}\n ],\n \"top_logprobs\": 10,\n \"top_p\": 0.5,\n \"audio\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v5/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"function_call\": {},\n \"functions\": [\n {}\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [\n \"<string>\"\n ],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {},\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"<string>\",\n \"response_format\": {},\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {},\n \"temperature\": 1,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {}\n ],\n \"top_logprobs\": 10,\n \"top_p\": 0.5,\n \"audio\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"choices": [
{
"finish_reason": "stop",
"index": 123,
"message": {
"role": "assistant",
"content": "<string>",
"refusal": "<string>",
"annotations": [
{
"type": "url_citation",
"url_citation": {
"end_index": 123,
"start_index": 123,
"title": "<string>",
"url": "<string>"
}
}
],
"audio": {
"id": "<string>",
"data": "<string>",
"expires_at": 123,
"transcript": "<string>"
},
"function_call": {
"arguments": "<string>",
"name": "<string>"
},
"tool_calls": [
{
"id": "<string>",
"function": {
"arguments": "<string>",
"name": "<string>"
},
"type": "function"
}
]
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
],
"bytes": [
123
]
}
],
"refusal": [
{
"token": "<string>",
"logprob": 123,
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
],
"bytes": [
123
]
}
]
}
}
],
"created": 123,
"model": "<string>",
"object": "chat.completion",
"service_tier": "auto",
"system_fingerprint": "<string>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123,
"completion_tokens_details": {
"accepted_prediction_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123,
"rejected_prediction_tokens": 123
},
"prompt_tokens_details": {
"audio_tokens": 123,
"cached_tokens": 123
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Generate OpenAI chat completion from messages
Generates a chat completion from an OpenAI-style messages array.
Use this endpoint for standard messages-based chat inference; use /v5/completions instead when you
have a raw text prompt rather than messages, /v5/responses for the OpenAI Responses API contract,
and /v5/inference when the payload does not follow any OpenAI schema. The request accepts the OpenAI
Chat Completions parameters plus a fixed set of vendor generation parameters such as top_k,
guided_choice, and thinking; other extra fields are dropped, and fields that set the provider
endpoint, credentials, or headers (for example api_base, api_key, extra_headers) are rejected
with a 422. The model is selected from model given as vendor/name; most vendors are served
through the litellm proxy gateway, while
OpenAI may use a native gateway. When stream is set the response is delivered as server-sent events
of chat.completion.chunk; otherwise a single chat.completion object is returned. Token usage is
recorded for the account, and for streaming responses it is read from the final chunk.
curl --request POST \
--url https://api.egp.scale.com/v5/chat/completions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "<string>",
"messages": [
{}
],
"top_k": 123,
"frequency_penalty": 0,
"function_call": {},
"functions": [
{}
],
"logit_bias": {},
"logprobs": true,
"max_completion_tokens": 123,
"max_tokens": 123,
"metadata": {},
"modalities": [
"<string>"
],
"n": 123,
"parallel_tool_calls": true,
"prediction": {},
"presence_penalty": 0,
"reasoning_effort": "<string>",
"response_format": {},
"seed": 123,
"stop": "<string>",
"store": true,
"stream": true,
"stream_options": {},
"temperature": 1,
"tool_choice": "<string>",
"tools": [
{}
],
"top_logprobs": 10,
"top_p": 0.5,
"audio": {}
}
'import requests
url = "https://api.egp.scale.com/v5/chat/completions"
payload = {
"model": "<string>",
"messages": [{}],
"top_k": 123,
"frequency_penalty": 0,
"function_call": {},
"functions": [{}],
"logit_bias": {},
"logprobs": True,
"max_completion_tokens": 123,
"max_tokens": 123,
"metadata": {},
"modalities": ["<string>"],
"n": 123,
"parallel_tool_calls": True,
"prediction": {},
"presence_penalty": 0,
"reasoning_effort": "<string>",
"response_format": {},
"seed": 123,
"stop": "<string>",
"store": True,
"stream": True,
"stream_options": {},
"temperature": 1,
"tool_choice": "<string>",
"tools": [{}],
"top_logprobs": 10,
"top_p": 0.5,
"audio": {}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{}],
top_k: 123,
frequency_penalty: 0,
function_call: {},
functions: [{}],
logit_bias: {},
logprobs: true,
max_completion_tokens: 123,
max_tokens: 123,
metadata: {},
modalities: ['<string>'],
n: 123,
parallel_tool_calls: true,
prediction: {},
presence_penalty: 0,
reasoning_effort: '<string>',
response_format: {},
seed: 123,
stop: '<string>',
store: true,
stream: true,
stream_options: {},
temperature: 1,
tool_choice: '<string>',
tools: [{}],
top_logprobs: 10,
top_p: 0.5,
audio: {}
})
};
fetch('https://api.egp.scale.com/v5/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.egp.scale.com/v5/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' => [
[
]
],
'top_k' => 123,
'frequency_penalty' => 0,
'function_call' => [
],
'functions' => [
[
]
],
'logit_bias' => [
],
'logprobs' => true,
'max_completion_tokens' => 123,
'max_tokens' => 123,
'metadata' => [
],
'modalities' => [
'<string>'
],
'n' => 123,
'parallel_tool_calls' => true,
'prediction' => [
],
'presence_penalty' => 0,
'reasoning_effort' => '<string>',
'response_format' => [
],
'seed' => 123,
'stop' => '<string>',
'store' => true,
'stream' => true,
'stream_options' => [
],
'temperature' => 1,
'tool_choice' => '<string>',
'tools' => [
[
]
],
'top_logprobs' => 10,
'top_p' => 0.5,
'audio' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.egp.scale.com/v5/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"function_call\": {},\n \"functions\": [\n {}\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [\n \"<string>\"\n ],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {},\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"<string>\",\n \"response_format\": {},\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {},\n \"temperature\": 1,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {}\n ],\n \"top_logprobs\": 10,\n \"top_p\": 0.5,\n \"audio\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.egp.scale.com/v5/chat/completions")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"function_call\": {},\n \"functions\": [\n {}\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [\n \"<string>\"\n ],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {},\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"<string>\",\n \"response_format\": {},\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {},\n \"temperature\": 1,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {}\n ],\n \"top_logprobs\": 10,\n \"top_p\": 0.5,\n \"audio\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v5/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"function_call\": {},\n \"functions\": [\n {}\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"max_completion_tokens\": 123,\n \"max_tokens\": 123,\n \"metadata\": {},\n \"modalities\": [\n \"<string>\"\n ],\n \"n\": 123,\n \"parallel_tool_calls\": true,\n \"prediction\": {},\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"<string>\",\n \"response_format\": {},\n \"seed\": 123,\n \"stop\": \"<string>\",\n \"store\": true,\n \"stream\": true,\n \"stream_options\": {},\n \"temperature\": 1,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {}\n ],\n \"top_logprobs\": 10,\n \"top_p\": 0.5,\n \"audio\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"choices": [
{
"finish_reason": "stop",
"index": 123,
"message": {
"role": "assistant",
"content": "<string>",
"refusal": "<string>",
"annotations": [
{
"type": "url_citation",
"url_citation": {
"end_index": 123,
"start_index": 123,
"title": "<string>",
"url": "<string>"
}
}
],
"audio": {
"id": "<string>",
"data": "<string>",
"expires_at": 123,
"transcript": "<string>"
},
"function_call": {
"arguments": "<string>",
"name": "<string>"
},
"tool_calls": [
{
"id": "<string>",
"function": {
"arguments": "<string>",
"name": "<string>"
},
"type": "function"
}
]
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
],
"bytes": [
123
]
}
],
"refusal": [
{
"token": "<string>",
"logprob": 123,
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
],
"bytes": [
123
]
}
]
}
}
],
"created": 123,
"model": "<string>",
"object": "chat.completion",
"service_tier": "auto",
"system_fingerprint": "<string>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123,
"completion_tokens_details": {
"accepted_prediction_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123,
"rejected_prediction_tokens": 123
},
"prompt_tokens_details": {
"audio_tokens": 123,
"cached_tokens": 123
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
Response
Successful Response
- Response Post-V5-/V5/Chat/Completions
- Response Post-V5-/V5/Chat/Completions

