Create chat completion
curl --request POST \
--url https://aiproxy.infaas-amd-dev.glo1.nscale.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json; charset=utf-8' \
--data '
{
"frequency_penalty": 0,
"logit_bias": null,
"logprobs": false,
"max_completion_tokens": 100,
"max_tokens": 100,
"messages": [
{
"content": "What is the weather in Paris?",
"role": "user"
}
],
"model": "meta-llama/Llama-3.1-8B-Instruct",
"n": 1,
"presence_penalty": 0,
"reasoning_effort": "medium",
"seed": 42,
"stop": "\n",
"stream": false,
"stream_options": null,
"temperature": 1,
"tool_choice": "auto",
"tools": [
{
"function": {
"description": "Get the weather for a city",
"name": "get_weather",
"parameters": {
"properties": {
"city": {
"description": "City name",
"type": "string"
}
},
"required": [
"city"
],
"type": "object"
}
},
"type": "function"
}
],
"top_logprobs": 0,
"top_p": 1
}
'import requests
url = "https://aiproxy.infaas-amd-dev.glo1.nscale.com/v1/chat/completions"
payload = {
"frequency_penalty": 0,
"logit_bias": None,
"logprobs": False,
"max_completion_tokens": 100,
"max_tokens": 100,
"messages": [
{
"content": "What is the weather in Paris?",
"role": "user"
}
],
"model": "meta-llama/Llama-3.1-8B-Instruct",
"n": 1,
"presence_penalty": 0,
"reasoning_effort": "medium",
"seed": 42,
"stop": "
",
"stream": False,
"stream_options": None,
"temperature": 1,
"tool_choice": "auto",
"tools": [
{
"function": {
"description": "Get the weather for a city",
"name": "get_weather",
"parameters": {
"properties": { "city": {
"description": "City name",
"type": "string"
} },
"required": ["city"],
"type": "object"
}
},
"type": "function"
}
],
"top_logprobs": 0,
"top_p": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json; charset=utf-8"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json; charset=utf-8'
},
body: JSON.stringify({
frequency_penalty: 0,
logit_bias: null,
logprobs: false,
max_completion_tokens: 100,
max_tokens: 100,
messages: [{content: 'What is the weather in Paris?', role: 'user'}],
model: 'meta-llama/Llama-3.1-8B-Instruct',
n: 1,
presence_penalty: 0,
reasoning_effort: 'medium',
seed: 42,
stop: '\n',
stream: false,
stream_options: null,
temperature: 1,
tool_choice: 'auto',
tools: [
{
function: {
description: 'Get the weather for a city',
name: 'get_weather',
parameters: {
properties: {city: {description: 'City name', type: 'string'}},
required: ['city'],
type: 'object'
}
},
type: 'function'
}
],
top_logprobs: 0,
top_p: 1
})
};
fetch('https://aiproxy.infaas-amd-dev.glo1.nscale.com/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://aiproxy.infaas-amd-dev.glo1.nscale.com/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([
'frequency_penalty' => 0,
'logit_bias' => null,
'logprobs' => false,
'max_completion_tokens' => 100,
'max_tokens' => 100,
'messages' => [
[
'content' => 'What is the weather in Paris?',
'role' => 'user'
]
],
'model' => 'meta-llama/Llama-3.1-8B-Instruct',
'n' => 1,
'presence_penalty' => 0,
'reasoning_effort' => 'medium',
'seed' => 42,
'stop' => '
',
'stream' => false,
'stream_options' => null,
'temperature' => 1,
'tool_choice' => 'auto',
'tools' => [
[
'function' => [
'description' => 'Get the weather for a city',
'name' => 'get_weather',
'parameters' => [
'properties' => [
'city' => [
'description' => 'City name',
'type' => 'string'
]
],
'required' => [
'city'
],
'type' => 'object'
]
],
'type' => 'function'
]
],
'top_logprobs' => 0,
'top_p' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json; charset=utf-8"
],
]);
$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://aiproxy.infaas-amd-dev.glo1.nscale.com/v1/chat/completions"
payload := strings.NewReader("{\n \"frequency_penalty\": 0,\n \"logit_bias\": null,\n \"logprobs\": false,\n \"max_completion_tokens\": 100,\n \"max_tokens\": 100,\n \"messages\": [\n {\n \"content\": \"What is the weather in Paris?\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"meta-llama/Llama-3.1-8B-Instruct\",\n \"n\": 1,\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"\\n\",\n \"stream\": false,\n \"stream_options\": null,\n \"temperature\": 1,\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"function\": {\n \"description\": \"Get the weather for a city\",\n \"name\": \"get_weather\",\n \"parameters\": {\n \"properties\": {\n \"city\": {\n \"description\": \"City name\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"city\"\n ],\n \"type\": \"object\"\n }\n },\n \"type\": \"function\"\n }\n ],\n \"top_logprobs\": 0,\n \"top_p\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json; charset=utf-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://aiproxy.infaas-amd-dev.glo1.nscale.com/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json; charset=utf-8")
.body("{\n \"frequency_penalty\": 0,\n \"logit_bias\": null,\n \"logprobs\": false,\n \"max_completion_tokens\": 100,\n \"max_tokens\": 100,\n \"messages\": [\n {\n \"content\": \"What is the weather in Paris?\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"meta-llama/Llama-3.1-8B-Instruct\",\n \"n\": 1,\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"\\n\",\n \"stream\": false,\n \"stream_options\": null,\n \"temperature\": 1,\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"function\": {\n \"description\": \"Get the weather for a city\",\n \"name\": \"get_weather\",\n \"parameters\": {\n \"properties\": {\n \"city\": {\n \"description\": \"City name\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"city\"\n ],\n \"type\": \"object\"\n }\n },\n \"type\": \"function\"\n }\n ],\n \"top_logprobs\": 0,\n \"top_p\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://aiproxy.infaas-amd-dev.glo1.nscale.com/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; charset=utf-8'
request.body = "{\n \"frequency_penalty\": 0,\n \"logit_bias\": null,\n \"logprobs\": false,\n \"max_completion_tokens\": 100,\n \"max_tokens\": 100,\n \"messages\": [\n {\n \"content\": \"What is the weather in Paris?\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"meta-llama/Llama-3.1-8B-Instruct\",\n \"n\": 1,\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"\\n\",\n \"stream\": false,\n \"stream_options\": null,\n \"temperature\": 1,\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"function\": {\n \"description\": \"Get the weather for a city\",\n \"name\": \"get_weather\",\n \"parameters\": {\n \"properties\": {\n \"city\": {\n \"description\": \"City name\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"city\"\n ],\n \"type\": \"object\"\n }\n },\n \"type\": \"function\"\n }\n ],\n \"top_logprobs\": 0,\n \"top_p\": 1\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>",
"reasoning_content": "<string>",
"tool_calls": [
"<unknown>"
]
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
]
},
"finish_reason": "<string>",
"stop_reason": "<unknown>"
}
],
"usage": {
"prompt_tokens": 123,
"total_tokens": 123,
"completion_tokens": 123,
"prompt_tokens_details": "<unknown>"
},
"prompt_logprobs": "<string>",
"system_fingerprint": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}Inference
Create chat completion
Generates a chat completion response for the provided model and chat history.
POST
/
v1
/
chat
/
completions
Create chat completion
curl --request POST \
--url https://aiproxy.infaas-amd-dev.glo1.nscale.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json; charset=utf-8' \
--data '
{
"frequency_penalty": 0,
"logit_bias": null,
"logprobs": false,
"max_completion_tokens": 100,
"max_tokens": 100,
"messages": [
{
"content": "What is the weather in Paris?",
"role": "user"
}
],
"model": "meta-llama/Llama-3.1-8B-Instruct",
"n": 1,
"presence_penalty": 0,
"reasoning_effort": "medium",
"seed": 42,
"stop": "\n",
"stream": false,
"stream_options": null,
"temperature": 1,
"tool_choice": "auto",
"tools": [
{
"function": {
"description": "Get the weather for a city",
"name": "get_weather",
"parameters": {
"properties": {
"city": {
"description": "City name",
"type": "string"
}
},
"required": [
"city"
],
"type": "object"
}
},
"type": "function"
}
],
"top_logprobs": 0,
"top_p": 1
}
'import requests
url = "https://aiproxy.infaas-amd-dev.glo1.nscale.com/v1/chat/completions"
payload = {
"frequency_penalty": 0,
"logit_bias": None,
"logprobs": False,
"max_completion_tokens": 100,
"max_tokens": 100,
"messages": [
{
"content": "What is the weather in Paris?",
"role": "user"
}
],
"model": "meta-llama/Llama-3.1-8B-Instruct",
"n": 1,
"presence_penalty": 0,
"reasoning_effort": "medium",
"seed": 42,
"stop": "
",
"stream": False,
"stream_options": None,
"temperature": 1,
"tool_choice": "auto",
"tools": [
{
"function": {
"description": "Get the weather for a city",
"name": "get_weather",
"parameters": {
"properties": { "city": {
"description": "City name",
"type": "string"
} },
"required": ["city"],
"type": "object"
}
},
"type": "function"
}
],
"top_logprobs": 0,
"top_p": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json; charset=utf-8"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json; charset=utf-8'
},
body: JSON.stringify({
frequency_penalty: 0,
logit_bias: null,
logprobs: false,
max_completion_tokens: 100,
max_tokens: 100,
messages: [{content: 'What is the weather in Paris?', role: 'user'}],
model: 'meta-llama/Llama-3.1-8B-Instruct',
n: 1,
presence_penalty: 0,
reasoning_effort: 'medium',
seed: 42,
stop: '\n',
stream: false,
stream_options: null,
temperature: 1,
tool_choice: 'auto',
tools: [
{
function: {
description: 'Get the weather for a city',
name: 'get_weather',
parameters: {
properties: {city: {description: 'City name', type: 'string'}},
required: ['city'],
type: 'object'
}
},
type: 'function'
}
],
top_logprobs: 0,
top_p: 1
})
};
fetch('https://aiproxy.infaas-amd-dev.glo1.nscale.com/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://aiproxy.infaas-amd-dev.glo1.nscale.com/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([
'frequency_penalty' => 0,
'logit_bias' => null,
'logprobs' => false,
'max_completion_tokens' => 100,
'max_tokens' => 100,
'messages' => [
[
'content' => 'What is the weather in Paris?',
'role' => 'user'
]
],
'model' => 'meta-llama/Llama-3.1-8B-Instruct',
'n' => 1,
'presence_penalty' => 0,
'reasoning_effort' => 'medium',
'seed' => 42,
'stop' => '
',
'stream' => false,
'stream_options' => null,
'temperature' => 1,
'tool_choice' => 'auto',
'tools' => [
[
'function' => [
'description' => 'Get the weather for a city',
'name' => 'get_weather',
'parameters' => [
'properties' => [
'city' => [
'description' => 'City name',
'type' => 'string'
]
],
'required' => [
'city'
],
'type' => 'object'
]
],
'type' => 'function'
]
],
'top_logprobs' => 0,
'top_p' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json; charset=utf-8"
],
]);
$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://aiproxy.infaas-amd-dev.glo1.nscale.com/v1/chat/completions"
payload := strings.NewReader("{\n \"frequency_penalty\": 0,\n \"logit_bias\": null,\n \"logprobs\": false,\n \"max_completion_tokens\": 100,\n \"max_tokens\": 100,\n \"messages\": [\n {\n \"content\": \"What is the weather in Paris?\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"meta-llama/Llama-3.1-8B-Instruct\",\n \"n\": 1,\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"\\n\",\n \"stream\": false,\n \"stream_options\": null,\n \"temperature\": 1,\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"function\": {\n \"description\": \"Get the weather for a city\",\n \"name\": \"get_weather\",\n \"parameters\": {\n \"properties\": {\n \"city\": {\n \"description\": \"City name\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"city\"\n ],\n \"type\": \"object\"\n }\n },\n \"type\": \"function\"\n }\n ],\n \"top_logprobs\": 0,\n \"top_p\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json; charset=utf-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://aiproxy.infaas-amd-dev.glo1.nscale.com/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json; charset=utf-8")
.body("{\n \"frequency_penalty\": 0,\n \"logit_bias\": null,\n \"logprobs\": false,\n \"max_completion_tokens\": 100,\n \"max_tokens\": 100,\n \"messages\": [\n {\n \"content\": \"What is the weather in Paris?\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"meta-llama/Llama-3.1-8B-Instruct\",\n \"n\": 1,\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"\\n\",\n \"stream\": false,\n \"stream_options\": null,\n \"temperature\": 1,\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"function\": {\n \"description\": \"Get the weather for a city\",\n \"name\": \"get_weather\",\n \"parameters\": {\n \"properties\": {\n \"city\": {\n \"description\": \"City name\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"city\"\n ],\n \"type\": \"object\"\n }\n },\n \"type\": \"function\"\n }\n ],\n \"top_logprobs\": 0,\n \"top_p\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://aiproxy.infaas-amd-dev.glo1.nscale.com/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; charset=utf-8'
request.body = "{\n \"frequency_penalty\": 0,\n \"logit_bias\": null,\n \"logprobs\": false,\n \"max_completion_tokens\": 100,\n \"max_tokens\": 100,\n \"messages\": [\n {\n \"content\": \"What is the weather in Paris?\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"meta-llama/Llama-3.1-8B-Instruct\",\n \"n\": 1,\n \"presence_penalty\": 0,\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"\\n\",\n \"stream\": false,\n \"stream_options\": null,\n \"temperature\": 1,\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"function\": {\n \"description\": \"Get the weather for a city\",\n \"name\": \"get_weather\",\n \"parameters\": {\n \"properties\": {\n \"city\": {\n \"description\": \"City name\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"city\"\n ],\n \"type\": \"object\"\n }\n },\n \"type\": \"function\"\n }\n ],\n \"top_logprobs\": 0,\n \"top_p\": 1\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>",
"reasoning_content": "<string>",
"tool_calls": [
"<unknown>"
]
},
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
],
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
]
}
]
},
"finish_reason": "<string>",
"stop_reason": "<unknown>"
}
],
"usage": {
"prompt_tokens": 123,
"total_tokens": 123,
"completion_tokens": 123,
"prompt_tokens_details": "<unknown>"
},
"prompt_logprobs": "<string>",
"system_fingerprint": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"error_type": "<string>",
"param": "<string>"
}
}Authorizations
Security scheme that accepts Unikorn Identity JWTs.
Body
application/json; charset=utf-8
- Message
- ImageMessage
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Controls which (if any) tool is called by the model. Only 'auto' and 'none' are supported here. 'required' tool_choice option requires vllm>=0.8.3 and is not currently supported.
Was this page helpful?
⌘I