Deployment Chat Completion
curl --request POST \
--url https://api.trajectory.ai/api/v1/deploy/{deployment_id}/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Trajectory-Id: <x-trajectory-id>' \
--data '
{
"model": "<string>",
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"stream": false,
"disable_thinking": true,
"temperature": 123,
"max_tokens": 123,
"top_p": 123
}
'import requests
url = "https://api.trajectory.ai/api/v1/deploy/{deployment_id}/chat/completions"
payload = {
"model": "<string>",
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"stream": False,
"disable_thinking": True,
"temperature": 123,
"max_tokens": 123,
"top_p": 123
}
headers = {
"X-Trajectory-Id": "<x-trajectory-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Trajectory-Id': '<x-trajectory-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: '<string>',
messages: [{role: '<string>', content: '<string>'}],
stream: false,
disable_thinking: true,
temperature: 123,
max_tokens: 123,
top_p: 123
})
};
fetch('https://api.trajectory.ai/api/v1/deploy/{deployment_id}/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.trajectory.ai/api/v1/deploy/{deployment_id}/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' => [
[
'role' => '<string>',
'content' => '<string>'
]
],
'stream' => false,
'disable_thinking' => true,
'temperature' => 123,
'max_tokens' => 123,
'top_p' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Trajectory-Id: <x-trajectory-id>"
],
]);
$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.trajectory.ai/api/v1/deploy/{deployment_id}/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"disable_thinking\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"top_p\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Trajectory-Id", "<x-trajectory-id>")
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.trajectory.ai/api/v1/deploy/{deployment_id}/chat/completions")
.header("X-Trajectory-Id", "<x-trajectory-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"disable_thinking\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"top_p\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trajectory.ai/api/v1/deploy/{deployment_id}/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Trajectory-Id"] = '<x-trajectory-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"disable_thinking\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"top_p\": 123\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>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"function_call": {
"name": "<string>",
"arguments": "<string>"
}
},
"finish_reason": "<string>",
"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
]
}
]
}
}
],
"usage": {
"prompt_tokens": 123,
"completion_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
}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}Deployments
Deployment Chat Completion
Test this exact deployment without changing the slug’s production target.
POST
/
api
/
v1
/
deploy
/
{deployment_id}
/
chat
/
completions
Deployment Chat Completion
curl --request POST \
--url https://api.trajectory.ai/api/v1/deploy/{deployment_id}/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Trajectory-Id: <x-trajectory-id>' \
--data '
{
"model": "<string>",
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"stream": false,
"disable_thinking": true,
"temperature": 123,
"max_tokens": 123,
"top_p": 123
}
'import requests
url = "https://api.trajectory.ai/api/v1/deploy/{deployment_id}/chat/completions"
payload = {
"model": "<string>",
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"stream": False,
"disable_thinking": True,
"temperature": 123,
"max_tokens": 123,
"top_p": 123
}
headers = {
"X-Trajectory-Id": "<x-trajectory-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Trajectory-Id': '<x-trajectory-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: '<string>',
messages: [{role: '<string>', content: '<string>'}],
stream: false,
disable_thinking: true,
temperature: 123,
max_tokens: 123,
top_p: 123
})
};
fetch('https://api.trajectory.ai/api/v1/deploy/{deployment_id}/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.trajectory.ai/api/v1/deploy/{deployment_id}/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' => [
[
'role' => '<string>',
'content' => '<string>'
]
],
'stream' => false,
'disable_thinking' => true,
'temperature' => 123,
'max_tokens' => 123,
'top_p' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Trajectory-Id: <x-trajectory-id>"
],
]);
$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.trajectory.ai/api/v1/deploy/{deployment_id}/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"disable_thinking\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"top_p\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Trajectory-Id", "<x-trajectory-id>")
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.trajectory.ai/api/v1/deploy/{deployment_id}/chat/completions")
.header("X-Trajectory-Id", "<x-trajectory-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"disable_thinking\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"top_p\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trajectory.ai/api/v1/deploy/{deployment_id}/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Trajectory-Id"] = '<x-trajectory-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"stream\": false,\n \"disable_thinking\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"top_p\": 123\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>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"function_call": {
"name": "<string>",
"arguments": "<string>"
}
},
"finish_reason": "<string>",
"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
]
}
]
}
}
],
"usage": {
"prompt_tokens": 123,
"completion_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
}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}Authorizations
InferenceAuthorizationApiKeyAuth
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json