curl --request GET \
--url https://api.edenai.run/v3/batches/{batch_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.edenai.run/v3/batches/{batch_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.edenai.run/v3/batches/{batch_id}', 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/batches/{batch_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.edenai.run/v3/batches/{batch_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.edenai.run/v3/batches/{batch_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v3/batches/{batch_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"status": "validating",
"created_at": 123,
"object": "batch",
"endpoint": "/v1/chat/completions",
"request_counts": {
"total": 0,
"completed": 0,
"failed": 0
},
"metadata": {},
"finished_at": 123,
"cost": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Retrieve Batch
Get a batch: its status, request counts and, once it has settled, its cost.
curl --request GET \
--url https://api.edenai.run/v3/batches/{batch_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.edenai.run/v3/batches/{batch_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.edenai.run/v3/batches/{batch_id}', 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/batches/{batch_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.edenai.run/v3/batches/{batch_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.edenai.run/v3/batches/{batch_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.edenai.run/v3/batches/{batch_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"status": "validating",
"created_at": 123,
"object": "batch",
"endpoint": "/v1/chat/completions",
"request_counts": {
"total": 0,
"completed": 0,
"failed": 0
},
"metadata": {},
"finished_at": 123,
"cost": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The batch id: the id the create call returned.
Response
Successful Response
A chat batch.
The batch id.
The model every request runs on, openai/<model>.
Where the batch is in its lifecycle.
validating, in_progress, finalizing, completed, failed, expired, cancelling, cancelled When the batch was created, Unix seconds.
Always batch.
"batch"The endpoint every request of the batch calls.
How many requests have finished, refreshed every few minutes.
Show child attributes
Show child attributes
The key/value pairs given at create.
Show child attributes
Show child attributes
When the batch finished and settled, Unix seconds.
What the batch billed, in US dollars, once it finished; null before. Each request that succeeded bills its tokens at the model's batch rates; a failed one, or one that never ran, bills zero. A request that succeeded with no token count bills an estimate at the same rates: its prompt tokens, the output its response shows and a reasoning allowance, the output never above the most the request could produce. A request OpenAI counts as completed with no result line bills the same estimate with no output shown. When the results cannot be read, every request that may have run bills that estimate.
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Why the batch failed, when it did.