curl --request POST \
--url https://api.edenai.run/v3/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{
"content": "<string>"
}
],
"fallbacks": [
"<string>"
],
"router_candidates": [
"<string>"
],
"max_tokens": 1024,
"system": "<string>",
"temperature": 1,
"top_p": 0.5,
"top_k": 123,
"stream": false,
"stop_sequences": [
"<string>"
],
"tools": [
{}
],
"tool_choice": {},
"metadata": {},
"thinking": {},
"extra_headers": {}
}
'import requests
url = "https://api.edenai.run/v3/v1/messages"
payload = {
"model": "<string>",
"messages": [{ "content": "<string>" }],
"fallbacks": ["<string>"],
"router_candidates": ["<string>"],
"max_tokens": 1024,
"system": "<string>",
"temperature": 1,
"top_p": 0.5,
"top_k": 123,
"stream": False,
"stop_sequences": ["<string>"],
"tools": [{}],
"tool_choice": {},
"metadata": {},
"thinking": {},
"extra_headers": {}
}
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({
model: '<string>',
messages: [{content: '<string>'}],
fallbacks: ['<string>'],
router_candidates: ['<string>'],
max_tokens: 1024,
system: '<string>',
temperature: 1,
top_p: 0.5,
top_k: 123,
stream: false,
stop_sequences: ['<string>'],
tools: [{}],
tool_choice: {},
metadata: {},
thinking: {},
extra_headers: {}
})
};
fetch('https://api.edenai.run/v3/v1/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.edenai.run/v3/v1/messages",
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' => [
[
'content' => '<string>'
]
],
'fallbacks' => [
'<string>'
],
'router_candidates' => [
'<string>'
],
'max_tokens' => 1024,
'system' => '<string>',
'temperature' => 1,
'top_p' => 0.5,
'top_k' => 123,
'stream' => false,
'stop_sequences' => [
'<string>'
],
'tools' => [
[
]
],
'tool_choice' => [
],
'metadata' => [
],
'thinking' => [
],
'extra_headers' => [
]
]),
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://api.edenai.run/v3/v1/messages"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"fallbacks\": [\n \"<string>\"\n ],\n \"router_candidates\": [\n \"<string>\"\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stream\": false,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"metadata\": {},\n \"thinking\": {},\n \"extra_headers\": {}\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://api.edenai.run/v3/v1/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"fallbacks\": [\n \"<string>\"\n ],\n \"router_candidates\": [\n \"<string>\"\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stream\": false,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"metadata\": {},\n \"thinking\": {},\n \"extra_headers\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v3/v1/messages")
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 \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"fallbacks\": [\n \"<string>\"\n ],\n \"router_candidates\": [\n \"<string>\"\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stream\": false,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"metadata\": {},\n \"thinking\": {},\n \"extra_headers\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"content": [
{
"type": "<string>",
"text": "<string>",
"id": "<string>",
"name": "<string>",
"input": {},
"tool_use_id": "<string>",
"content": "<string>",
"is_error": true,
"source": {},
"thinking": "<string>",
"signature": "<string>"
}
],
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_creation_input_tokens": 123,
"cache_read_input_tokens": 123
},
"type": "message",
"role": "assistant",
"stop_sequence": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create Anthropic Message
Anthropic Messages API — native pass-through via litellm.
curl --request POST \
--url https://api.edenai.run/v3/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{
"content": "<string>"
}
],
"fallbacks": [
"<string>"
],
"router_candidates": [
"<string>"
],
"max_tokens": 1024,
"system": "<string>",
"temperature": 1,
"top_p": 0.5,
"top_k": 123,
"stream": false,
"stop_sequences": [
"<string>"
],
"tools": [
{}
],
"tool_choice": {},
"metadata": {},
"thinking": {},
"extra_headers": {}
}
'import requests
url = "https://api.edenai.run/v3/v1/messages"
payload = {
"model": "<string>",
"messages": [{ "content": "<string>" }],
"fallbacks": ["<string>"],
"router_candidates": ["<string>"],
"max_tokens": 1024,
"system": "<string>",
"temperature": 1,
"top_p": 0.5,
"top_k": 123,
"stream": False,
"stop_sequences": ["<string>"],
"tools": [{}],
"tool_choice": {},
"metadata": {},
"thinking": {},
"extra_headers": {}
}
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({
model: '<string>',
messages: [{content: '<string>'}],
fallbacks: ['<string>'],
router_candidates: ['<string>'],
max_tokens: 1024,
system: '<string>',
temperature: 1,
top_p: 0.5,
top_k: 123,
stream: false,
stop_sequences: ['<string>'],
tools: [{}],
tool_choice: {},
metadata: {},
thinking: {},
extra_headers: {}
})
};
fetch('https://api.edenai.run/v3/v1/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.edenai.run/v3/v1/messages",
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' => [
[
'content' => '<string>'
]
],
'fallbacks' => [
'<string>'
],
'router_candidates' => [
'<string>'
],
'max_tokens' => 1024,
'system' => '<string>',
'temperature' => 1,
'top_p' => 0.5,
'top_k' => 123,
'stream' => false,
'stop_sequences' => [
'<string>'
],
'tools' => [
[
]
],
'tool_choice' => [
],
'metadata' => [
],
'thinking' => [
],
'extra_headers' => [
]
]),
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://api.edenai.run/v3/v1/messages"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"fallbacks\": [\n \"<string>\"\n ],\n \"router_candidates\": [\n \"<string>\"\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stream\": false,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"metadata\": {},\n \"thinking\": {},\n \"extra_headers\": {}\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://api.edenai.run/v3/v1/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"fallbacks\": [\n \"<string>\"\n ],\n \"router_candidates\": [\n \"<string>\"\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stream\": false,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"metadata\": {},\n \"thinking\": {},\n \"extra_headers\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v3/v1/messages")
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 \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"fallbacks\": [\n \"<string>\"\n ],\n \"router_candidates\": [\n \"<string>\"\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stream\": false,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"metadata\": {},\n \"thinking\": {},\n \"extra_headers\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"content": [
{
"type": "<string>",
"text": "<string>",
"id": "<string>",
"name": "<string>",
"input": {},
"tool_use_id": "<string>",
"content": "<string>",
"is_error": true,
"source": {},
"thinking": "<string>",
"signature": "<string>"
}
],
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_creation_input_tokens": 123,
"cache_read_input_tokens": 123
},
"type": "message",
"role": "assistant",
"stop_sequence": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Show child attributes
Show child attributes
List of fallback model IDs to try if the primary model fails. Models are tried in order. Example: ['anthropic/claude-3-opus', 'openai/gpt-4o']
3List of model candidates for dynamic routing when using model='@edenai'. Each entry should be 'provider/model', e.g. ['openai/gpt-4o', 'anthropic/claude-3-5-sonnet-20241022']. If not provided, defaults to all available models.
x >= 10 <= x <= 20 <= x <= 1Show child attributes
Show child attributes
Response
Successful Response
Response body for POST /v1/messages (non-streaming).
Unique identifier for the message.
Model that generated the message.
Ordered list of content blocks produced by the model.
Show child attributes
Show child attributes
Token usage for the request.
Show child attributes
Show child attributes
Object type. Always 'message' for this endpoint.
"message"Conversational role of the response.
"assistant"Reason generation stopped, if known.
end_turn, max_tokens, stop_sequence, tool_use Custom stop sequence that triggered the stop, if any.