List Chat Completions
curl --request GET \
--url https://api.example.com/v1/chat/completionsimport requests
url = "https://api.example.com/v1/chat/completions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.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://api.example.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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/chat/completions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/chat/completions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": [
{
"choices": [
{
"finish_reason": "<string>",
"index": 1,
"message": {
"role": "<string>",
"annotations": "<unknown>",
"audio": "<unknown>",
"content": "<string>",
"refusal": "<string>",
"tool_calls": [
{
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "<string>"
}
]
},
"logprobs": "<unknown>"
}
],
"created": 1,
"id": "<string>",
"model": "<string>",
"object": "<string>",
"usage": {
"completion_tokens": 1,
"prompt_tokens": 1,
"total_tokens": 1,
"completion_tokens_details": "<unknown>",
"prompt_tokens_details": "<unknown>"
},
"service_tier": "<string>",
"system_fingerprint": "<string>"
}
],
"first_id": "<string>",
"has_more": true,
"last_id": "<string>",
"object": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>"
}
}Router
List Chat Completions
GET
/
v1
/
chat
/
completions
List Chat Completions
curl --request GET \
--url https://api.example.com/v1/chat/completionsimport requests
url = "https://api.example.com/v1/chat/completions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.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://api.example.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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/chat/completions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/chat/completions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": [
{
"choices": [
{
"finish_reason": "<string>",
"index": 1,
"message": {
"role": "<string>",
"annotations": "<unknown>",
"audio": "<unknown>",
"content": "<string>",
"refusal": "<string>",
"tool_calls": [
{
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "<string>"
}
]
},
"logprobs": "<unknown>"
}
],
"created": 1,
"id": "<string>",
"model": "<string>",
"object": "<string>",
"usage": {
"completion_tokens": 1,
"prompt_tokens": 1,
"total_tokens": 1,
"completion_tokens_details": "<unknown>",
"prompt_tokens_details": "<unknown>"
},
"service_tier": "<string>",
"system_fingerprint": "<string>"
}
],
"first_id": "<string>",
"has_more": true,
"last_id": "<string>",
"object": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>"
}
}Query Parameters
Identifier for the last chat completion from the previous pagination request.
Number of Chat Completions to retrieve.
Required range:
x >= 0A list of metadata keys to filter the Chat Completions by. Example: metadata[key1]=value1&metadata[key2]=value2
Show child attributes
Show child attributes
The model used to generate the Chat Completions.
Sort order for Chat Completions by timestamp. Use asc for ascending order or desc for descending order. Defaults to asc.
Response
Chat completions listed successfully
Represents a list of chat completions.
A list of chat completion objects.
Show child attributes
Show child attributes
The ID of the first chat completion in the list.
Whether there are more chat completions to retrieve.
The ID of the last chat completion in the list.
The object type, which is always list.