LLM
curl --request POST \
--url https://dream-gateway.livepeer.cloud/llm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"model": "",
"temperature": 0.7,
"max_tokens": 256,
"top_p": 1,
"top_k": -1,
"stream": false
}
'import requests
url = "https://dream-gateway.livepeer.cloud/llm"
payload = {
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"model": "",
"temperature": 0.7,
"max_tokens": 256,
"top_p": 1,
"top_k": -1,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{role: '<string>', content: '<string>'}],
model: '',
temperature: 0.7,
max_tokens: 256,
top_p: 1,
top_k: -1,
stream: false
})
};
fetch('https://dream-gateway.livepeer.cloud/llm', 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://dream-gateway.livepeer.cloud/llm",
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([
'messages' => [
[
'role' => '<string>',
'content' => '<string>'
]
],
'model' => '',
'temperature' => 0.7,
'max_tokens' => 256,
'top_p' => 1,
'top_k' => -1,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://dream-gateway.livepeer.cloud/llm"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"model\": \"\",\n \"temperature\": 0.7,\n \"max_tokens\": 256,\n \"top_p\": 1,\n \"top_k\": -1,\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
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://dream-gateway.livepeer.cloud/llm")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"model\": \"\",\n \"temperature\": 0.7,\n \"max_tokens\": 256,\n \"top_p\": 1,\n \"top_k\": -1,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dream-gateway.livepeer.cloud/llm")
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'
request.body = "{\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"model\": \"\",\n \"temperature\": 0.7,\n \"max_tokens\": 256,\n \"top_p\": 1,\n \"top_k\": -1,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"created": 123,
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
},
"choices": [
{
"index": 123,
"finish_reason": "",
"delta": {
"role": "<string>",
"content": "<string>"
},
"message": {
"role": "<string>",
"content": "<string>"
}
}
]
}{
"detail": {
"msg": "<string>"
}
}{
"detail": {
"msg": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": {
"msg": "<string>"
}
}AI API Reference
LLM
Generate text using a language model.
POST
/
llm
LLM
curl --request POST \
--url https://dream-gateway.livepeer.cloud/llm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"model": "",
"temperature": 0.7,
"max_tokens": 256,
"top_p": 1,
"top_k": -1,
"stream": false
}
'import requests
url = "https://dream-gateway.livepeer.cloud/llm"
payload = {
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"model": "",
"temperature": 0.7,
"max_tokens": 256,
"top_p": 1,
"top_k": -1,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{role: '<string>', content: '<string>'}],
model: '',
temperature: 0.7,
max_tokens: 256,
top_p: 1,
top_k: -1,
stream: false
})
};
fetch('https://dream-gateway.livepeer.cloud/llm', 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://dream-gateway.livepeer.cloud/llm",
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([
'messages' => [
[
'role' => '<string>',
'content' => '<string>'
]
],
'model' => '',
'temperature' => 0.7,
'max_tokens' => 256,
'top_p' => 1,
'top_k' => -1,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://dream-gateway.livepeer.cloud/llm"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"model\": \"\",\n \"temperature\": 0.7,\n \"max_tokens\": 256,\n \"top_p\": 1,\n \"top_k\": -1,\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
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://dream-gateway.livepeer.cloud/llm")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"model\": \"\",\n \"temperature\": 0.7,\n \"max_tokens\": 256,\n \"top_p\": 1,\n \"top_k\": -1,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dream-gateway.livepeer.cloud/llm")
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'
request.body = "{\n \"messages\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ],\n \"model\": \"\",\n \"temperature\": 0.7,\n \"max_tokens\": 256,\n \"top_p\": 1,\n \"top_k\": -1,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"created": 123,
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
},
"choices": [
{
"index": 123,
"finish_reason": "",
"delta": {
"role": "<string>",
"content": "<string>"
},
"message": {
"role": "<string>",
"content": "<string>"
}
}
]
}{
"detail": {
"msg": "<string>"
}
}{
"detail": {
"msg": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": {
"msg": "<string>"
}
}The LLM pipeline is OpenAI API-compatible but does not implement all
features of the OpenAI API.
The default Gateway used in this guide is the public
Livepeer.cloud Gateway. It is free to use but
not intended for production-ready applications. For production-ready
applications, consider using the Livepeer Studio
Gateway, which requires an API token. Alternatively, you can set up your own
Gateway node or partner with one via the
ai-video channel on
Discord.Streaming Responses
Ensure your client supports SSE and processes each
data: line as it arrives./llm endpoint returns a single JSON response in the OpenAI
chat/completions
format, as shown in the sidebar.
To receive responses token-by-token, set "stream": true in the request body.
The server will then use Server-Sent Events (SSE) to stream output in real
time.
Each streamed chunk will look like:
data: {
"choices": [
{
"delta": {
"content": "...token...",
"role": "assistant"
},
"finish_reason": null
}
]
}
"finish_reason": "stop":
data: {
"choices": [
{
"delta": {
"content": "",
"role": "assistant"
},
"finish_reason": "stop"
}
]
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Last modified on May 18, 2026
Was this page helpful?
⌘I