curl --request POST \
--url https://api.galadriel.com/v1/chat/completions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Hello!",
"role": "user"
}
],
"model": "llama3.1"
}
'import requests
url = "https://api.galadriel.com/v1/chat/completions"
payload = {
"messages": [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Hello!",
"role": "user"
}
],
"model": "llama3.1"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [
{content: 'You are a helpful assistant.', role: 'system'},
{content: 'Hello!', role: 'user'}
],
model: 'llama3.1'
})
};
fetch('https://api.galadriel.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.galadriel.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([
'messages' => [
[
'content' => 'You are a helpful assistant.',
'role' => 'system'
],
[
'content' => 'Hello!',
'role' => 'user'
]
],
'model' => 'llama3.1'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.galadriel.com/v1/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"You are a helpful assistant.\",\n \"role\": \"system\"\n },\n {\n \"content\": \"Hello!\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"llama3.1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.galadriel.com/v1/chat/completions")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"You are a helpful assistant.\",\n \"role\": \"system\"\n },\n {\n \"content\": \"Hello!\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"llama3.1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galadriel.com/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"You are a helpful assistant.\",\n \"role\": \"system\"\n },\n {\n \"content\": \"Hello!\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"llama3.1\"\n}"
response = http.request(request)
puts response.read_body{
"id": "id",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "Hello. It's nice to meet you. Is there something I can help you with or would you like to chat?",
"refusal": null,
"role": "assistant",
"function_call": null,
"tool_calls": null
}
}
],
"created": 1728558433,
"model": "neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8",
"object": "chat.completion",
"service_tier": null,
"system_fingerprint": null
}
data: {"id":"chat-50ad61812fd147158e3776bf89c18698","choices":[{"delta":{"content":"","role":"assistant"},"finish_reason":null,"index":0,"logprobs":null}],"created":1729078303,"model":"neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8","object":"chat.completion.chunk","usage":null}
data: {"id":"chat-50ad61812fd147158e3776bf89c18698","choices":[{"delta":{"content":"Hello"},"finish_reason":null,"index":0,"logprobs":null}],"created":1729078303,"model":"neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8","object":"chat.completion.chunk","usage":null}
...
data: {"id":"chat-50ad61812fd147158e3776bf89c18698","choices":[{"delta":{"content":""},"finish_reason":"stop","index":0,"logprobs":null,"stop_reason":null}],"created":1729078303,"model":"neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8","object":"chat.completion.chunk","usage":null}
data: [DONE]
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"response": "NOK",
"error": {
"status_code": 429,
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded"
}
}
{
"response": "NOK",
"error": {
"status_code": 503,
"code": "no_available_inference_nodes",
"message": "No available inference nodes to process the request."
}
}
event: error
data: {"error": {"message": "No available inference nodes to process the request."}}
Chat Completion API
Tap into Galadriel’s LLM inference network. Follows the same schema as OpenAI’s chat completion API.
curl --request POST \
--url https://api.galadriel.com/v1/chat/completions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Hello!",
"role": "user"
}
],
"model": "llama3.1"
}
'import requests
url = "https://api.galadriel.com/v1/chat/completions"
payload = {
"messages": [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Hello!",
"role": "user"
}
],
"model": "llama3.1"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [
{content: 'You are a helpful assistant.', role: 'system'},
{content: 'Hello!', role: 'user'}
],
model: 'llama3.1'
})
};
fetch('https://api.galadriel.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.galadriel.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([
'messages' => [
[
'content' => 'You are a helpful assistant.',
'role' => 'system'
],
[
'content' => 'Hello!',
'role' => 'user'
]
],
'model' => 'llama3.1'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.galadriel.com/v1/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"You are a helpful assistant.\",\n \"role\": \"system\"\n },\n {\n \"content\": \"Hello!\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"llama3.1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.galadriel.com/v1/chat/completions")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"You are a helpful assistant.\",\n \"role\": \"system\"\n },\n {\n \"content\": \"Hello!\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"llama3.1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galadriel.com/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"You are a helpful assistant.\",\n \"role\": \"system\"\n },\n {\n \"content\": \"Hello!\",\n \"role\": \"user\"\n }\n ],\n \"model\": \"llama3.1\"\n}"
response = http.request(request)
puts response.read_body{
"id": "id",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "Hello. It's nice to meet you. Is there something I can help you with or would you like to chat?",
"refusal": null,
"role": "assistant",
"function_call": null,
"tool_calls": null
}
}
],
"created": 1728558433,
"model": "neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8",
"object": "chat.completion",
"service_tier": null,
"system_fingerprint": null
}
data: {"id":"chat-50ad61812fd147158e3776bf89c18698","choices":[{"delta":{"content":"","role":"assistant"},"finish_reason":null,"index":0,"logprobs":null}],"created":1729078303,"model":"neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8","object":"chat.completion.chunk","usage":null}
data: {"id":"chat-50ad61812fd147158e3776bf89c18698","choices":[{"delta":{"content":"Hello"},"finish_reason":null,"index":0,"logprobs":null}],"created":1729078303,"model":"neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8","object":"chat.completion.chunk","usage":null}
...
data: {"id":"chat-50ad61812fd147158e3776bf89c18698","choices":[{"delta":{"content":""},"finish_reason":"stop","index":0,"logprobs":null,"stop_reason":null}],"created":1729078303,"model":"neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8","object":"chat.completion.chunk","usage":null}
data: [DONE]
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"response": "NOK",
"error": {
"status_code": 429,
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded"
}
}
{
"response": "NOK",
"error": {
"status_code": 503,
"code": "no_available_inference_nodes",
"message": "No available inference nodes to process the request."
}
}
event: error
data: {"error": {"message": "No available inference nodes to process the request."}}
{
"id": "id",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "Hello. It's nice to meet you. Is there something I can help you with or would you like to chat?",
"refusal": null,
"role": "assistant",
"function_call": null,
"tool_calls": null
}
}
],
"created": 1728558433,
"model": "neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8",
"object": "chat.completion",
"service_tier": null,
"system_fingerprint": null
}
data: {"id":"chat-50ad61812fd147158e3776bf89c18698","choices":[{"delta":{"content":"","role":"assistant"},"finish_reason":null,"index":0,"logprobs":null}],"created":1729078303,"model":"neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8","object":"chat.completion.chunk","usage":null}
data: {"id":"chat-50ad61812fd147158e3776bf89c18698","choices":[{"delta":{"content":"Hello"},"finish_reason":null,"index":0,"logprobs":null}],"created":1729078303,"model":"neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8","object":"chat.completion.chunk","usage":null}
...
data: {"id":"chat-50ad61812fd147158e3776bf89c18698","choices":[{"delta":{"content":""},"finish_reason":"stop","index":0,"logprobs":null,"stop_reason":null}],"created":1729078303,"model":"neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8","object":"chat.completion.chunk","usage":null}
data: [DONE]
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"response": "NOK",
"error": {
"status_code": 429,
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded"
}
}
{
"response": "NOK",
"error": {
"status_code": 503,
"code": "no_available_inference_nodes",
"message": "No available inference nodes to process the request."
}
}
event: error
data: {"error": {"message": "No available inference nodes to process the request."}}
Authorizations
Bearer authentication header.
example value: Bearer Galadriel-API-key
Get API key from Galadriel dashboard.
Body
A list of messages comprising the conversation so far.
Show child attributes
Show child attributes
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
Modify the likelihood of specified tokens appearing in the completion.
Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message.
An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.
How many chat completion choices to generate for each input message.
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
An object specifying the format that the model must output.
Show child attributes
Show child attributes
This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed, and you should refer to the system_fingerprint response parameter to monitor changes in the backend.
Up to 4 sequences where the API will stop generating further tokens.
If set, partial message deltas will be sent, like in ChatGPT.
Options for streaming response. Only set this when you set stream: true.
Show child attributes
Show child attributes
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
Currently the 8b model does not support tools. A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for.
Show child attributes
Show child attributes
Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
Response
Returns a chat completion object, or a streamed sequence of chat completion chunk objects if the request is streamed.
Show child attributes
Show child attributes
"chat.completion"scale, default Show child attributes
Show child attributes

