Chat Completion Messages
curl --request GET \
--url https://api.example.com/v1/chat/completions/{completion_id}/messagesimport requests
url = "https://api.example.com/v1/chat/completions/{completion_id}/messages"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/chat/completions/{completion_id}/messages', 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/{completion_id}/messages",
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/{completion_id}/messages"
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/{completion_id}/messages")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/chat/completions/{completion_id}/messages")
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": [
{
"id": "<string>",
"role": "<string>",
"content": "<string>",
"content_parts": [
{
"text": "<string>",
"type": "input_text"
}
],
"name": "<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>"
}
}{
"error": {
"message": "<string>",
"type": "<string>"
}
}Router
Chat Completion Messages
GET
/
v1
/
chat
/
completions
/
{completion_id}
/
messages
Chat Completion Messages
curl --request GET \
--url https://api.example.com/v1/chat/completions/{completion_id}/messagesimport requests
url = "https://api.example.com/v1/chat/completions/{completion_id}/messages"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/chat/completions/{completion_id}/messages', 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/{completion_id}/messages",
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/{completion_id}/messages"
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/{completion_id}/messages")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/chat/completions/{completion_id}/messages")
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": [
{
"id": "<string>",
"role": "<string>",
"content": "<string>",
"content_parts": [
{
"text": "<string>",
"type": "input_text"
}
],
"name": "<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>"
}
}{
"error": {
"message": "<string>",
"type": "<string>"
}
}Path Parameters
ID of the chat completion
Query Parameters
Identifier for the last message from the previous pagination request.
Number of messages to retrieve.
Required range:
x >= 0Sort order for messages by timestamp. Use asc for ascending order or desc for descending order. Defaults to asc.
Response
Chat completion messages gotten successfully
Represents a list of messages in a chat completion.
A list of chat messages.
Show child attributes
Show child attributes
The ID of the first message in the list.
Whether there are more messages to retrieve.
The ID of the last message in the list.
The object type, which is always list.