curl --request POST \
--url https://api.eachlabs.ai/v1/prediction/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "eachlabs-llm-router",
"input": {
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Write a one sentence caption."
}
]
}
}
'import requests
url = "https://api.eachlabs.ai/v1/prediction/run"
payload = {
"model": "eachlabs-llm-router",
"input": {
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Write a one sentence caption."
}
]
}
}
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: 'eachlabs-llm-router',
input: {
model: 'openai/gpt-4o-mini',
messages: [{role: 'user', content: 'Write a one sentence caption.'}]
}
})
};
fetch('https://api.eachlabs.ai/v1/prediction/run', 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.eachlabs.ai/v1/prediction/run",
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' => 'eachlabs-llm-router',
'input' => [
'model' => 'openai/gpt-4o-mini',
'messages' => [
[
'role' => 'user',
'content' => 'Write a one sentence caption.'
]
]
]
]),
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.eachlabs.ai/v1/prediction/run"
payload := strings.NewReader("{\n \"model\": \"eachlabs-llm-router\",\n \"input\": {\n \"model\": \"openai/gpt-4o-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Write a one sentence caption.\"\n }\n ]\n }\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.eachlabs.ai/v1/prediction/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"eachlabs-llm-router\",\n \"input\": {\n \"model\": \"openai/gpt-4o-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Write a one sentence caption.\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eachlabs.ai/v1/prediction/run")
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\": \"eachlabs-llm-router\",\n \"input\": {\n \"model\": \"openai/gpt-4o-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Write a one sentence caption.\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Prediction completed successfully",
"predictionID": "abc123-def456-ghi789",
"output": {
"text": "A cinematic sunset over the ocean."
},
"error": ""
}{
"error": "slug parameter is required"
}{
"error": "Invalid or missing API key"
}{
"error": "invalid request body"
}{
"error": "Failed to fetch models: internal error"
}Run Model Prediction Synchronously
Create a prediction and wait for the result. This compatibility endpoint is only supported for models with synchronous execution enabled; unsupported models return a bad request error.
curl --request POST \
--url https://api.eachlabs.ai/v1/prediction/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "eachlabs-llm-router",
"input": {
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Write a one sentence caption."
}
]
}
}
'import requests
url = "https://api.eachlabs.ai/v1/prediction/run"
payload = {
"model": "eachlabs-llm-router",
"input": {
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Write a one sentence caption."
}
]
}
}
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: 'eachlabs-llm-router',
input: {
model: 'openai/gpt-4o-mini',
messages: [{role: 'user', content: 'Write a one sentence caption.'}]
}
})
};
fetch('https://api.eachlabs.ai/v1/prediction/run', 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.eachlabs.ai/v1/prediction/run",
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' => 'eachlabs-llm-router',
'input' => [
'model' => 'openai/gpt-4o-mini',
'messages' => [
[
'role' => 'user',
'content' => 'Write a one sentence caption.'
]
]
]
]),
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.eachlabs.ai/v1/prediction/run"
payload := strings.NewReader("{\n \"model\": \"eachlabs-llm-router\",\n \"input\": {\n \"model\": \"openai/gpt-4o-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Write a one sentence caption.\"\n }\n ]\n }\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.eachlabs.ai/v1/prediction/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"eachlabs-llm-router\",\n \"input\": {\n \"model\": \"openai/gpt-4o-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Write a one sentence caption.\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eachlabs.ai/v1/prediction/run")
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\": \"eachlabs-llm-router\",\n \"input\": {\n \"model\": \"openai/gpt-4o-mini\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Write a one sentence caption.\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Prediction completed successfully",
"predictionID": "abc123-def456-ghi789",
"output": {
"text": "A cinematic sunset over the ocean."
},
"error": ""
}{
"error": "slug parameter is required"
}{
"error": "Invalid or missing API key"
}{
"error": "invalid request body"
}{
"error": "Failed to fetch models: internal error"
}Authorizations
API key passed as an Authorization Bearer token: Authorization: Bearer YOUR_API_KEY
Body
Model slug or identifier
"flux-1-1-pro"
Input parameters for the prediction
{ "prompt": "A beautiful sunset over the ocean with vibrant colors", "aspect_ratio": "16:9" }
Deprecated. This field is ignored. Kept for backwards compatibility.
"0.0.1"
Optional webhook URL to receive prediction result asynchronously
"https://your-app.com/webhook"
Optional secret used to sign webhook requests
"your-secret-key"
Response
Prediction completed or failed synchronously
Final terminal status of the synchronous prediction
success, failed, cancelled "success"
Human-readable message
"Prediction completed successfully"
Unique prediction identifier
"abc123-def456-ghi789"
Prediction output, when available
User-facing error message when the prediction failed
""