Skip to main content
POST
/
v1
/
prediction
Create Model Prediction
curl --request POST \
  --url https://api.eachlabs.ai/v1/prediction \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "model": "flux-1-1-pro",
  "input": {
    "prompt": "A beautiful sunset over the ocean with vibrant colors",
    "aspect_ratio": "16:9"
  },
  "webhook_url": "https://your-app.com/webhook",
  "webhook_secret": "your-secret-key"
}
'
import requests

url = "https://api.eachlabs.ai/v1/prediction"

payload = {
"model": "flux-1-1-pro",
"input": {
"prompt": "A beautiful sunset over the ocean with vibrant colors",
"aspect_ratio": "16:9"
},
"webhook_url": "https://your-app.com/webhook",
"webhook_secret": "your-secret-key"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'flux-1-1-pro',
input: {
prompt: 'A beautiful sunset over the ocean with vibrant colors',
aspect_ratio: '16:9'
},
webhook_url: 'https://your-app.com/webhook',
webhook_secret: 'your-secret-key'
})
};

fetch('https://api.eachlabs.ai/v1/prediction', 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",
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' => 'flux-1-1-pro',
'input' => [
'prompt' => 'A beautiful sunset over the ocean with vibrant colors',
'aspect_ratio' => '16:9'
],
'webhook_url' => 'https://your-app.com/webhook',
'webhook_secret' => 'your-secret-key'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$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"

payload := strings.NewReader("{\n \"model\": \"flux-1-1-pro\",\n \"input\": {\n \"prompt\": \"A beautiful sunset over the ocean with vibrant colors\",\n \"aspect_ratio\": \"16:9\"\n },\n \"webhook_url\": \"https://your-app.com/webhook\",\n \"webhook_secret\": \"your-secret-key\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-API-Key", "<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.eachlabs.ai/v1/prediction")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"flux-1-1-pro\",\n \"input\": {\n \"prompt\": \"A beautiful sunset over the ocean with vibrant colors\",\n \"aspect_ratio\": \"16:9\"\n },\n \"webhook_url\": \"https://your-app.com/webhook\",\n \"webhook_secret\": \"your-secret-key\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.eachlabs.ai/v1/prediction")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"flux-1-1-pro\",\n \"input\": {\n \"prompt\": \"A beautiful sunset over the ocean with vibrant colors\",\n \"aspect_ratio\": \"16:9\"\n },\n \"webhook_url\": \"https://your-app.com/webhook\",\n \"webhook_secret\": \"your-secret-key\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": "success",
  "message": "Prediction created successfully",
  "predictionID": "abc123-def456-ghi789"
}
{
"error": "slug parameter is required"
}
{
"error": "Failed to fetch models: internal error"
}

Authorizations

X-API-Key
string
header
required

API key for authentication

Body

application/json
model
string
required

Model slug or identifier

Example:

"flux-1-1-pro"

input
object
required

Input parameters for the prediction

Example:
{
"prompt": "A beautiful sunset over the ocean with vibrant colors",
"aspect_ratio": "16:9"
}
version
string
deprecated

Deprecated. This field is ignored. Kept for backwards compatibility.

Example:

"0.0.1"

webhook_url
string<uri>

Optional webhook URL to receive prediction result asynchronously

Example:

"https://your-app.com/webhook"

webhook_secret
string

Optional secret used to sign webhook requests

Example:

"your-secret-key"

Response

Prediction created successfully

status
string

Status of the prediction creation request

Example:

"success"

message
string

Human-readable message about the prediction creation

Example:

"Prediction created successfully"

predictionID
string

Unique prediction identifier

Example:

"abc123-def456-ghi789"

Last modified on June 17, 2026