Skip to main content
POST
/
v1
/
workspaces
/
{workspace_id}
/
inferences
/
estimate
Estimate inference price
curl --request POST \
  --url https://api.app.layer.ai/api/v1/workspaces/{workspace_id}/inferences/estimate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "prompt": "<string>",
  "width": 1,
  "height": 1,
  "batch_size": 4,
  "num_inference_steps": 1,
  "guidance_scale": 123,
  "prompt_strength": 0.5,
  "sharpness": 123,
  "duration_seconds": 1,
  "generate_audio": true,
  "keep_audio": true,
  "fps": 1,
  "video_effects": [],
  "use_ta_pose": true,
  "include_textures": true,
  "quad_mesh": true,
  "pbr_materials": true,
  "low_poly": true,
  "generate_parts": true,
  "face_limit": 1,
  "stability": 0.5,
  "use_speaker_boost": true,
  "similarity_boost": 0.5,
  "style_exaggeration": 0.5,
  "speed": 1,
  "upscale_ratio": 123,
  "creativity": 123,
  "resemblance": 123,
  "vectorize": true,
  "remove_background": true,
  "reframe": true,
  "refill": true
}
'
import requests

url = "https://api.app.layer.ai/api/v1/workspaces/{workspace_id}/inferences/estimate"

payload = {
"model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"prompt": "<string>",
"width": 1,
"height": 1,
"batch_size": 4,
"num_inference_steps": 1,
"guidance_scale": 123,
"prompt_strength": 0.5,
"sharpness": 123,
"duration_seconds": 1,
"generate_audio": True,
"keep_audio": True,
"fps": 1,
"video_effects": [],
"use_ta_pose": True,
"include_textures": True,
"quad_mesh": True,
"pbr_materials": True,
"low_poly": True,
"generate_parts": True,
"face_limit": 1,
"stability": 0.5,
"use_speaker_boost": True,
"similarity_boost": 0.5,
"style_exaggeration": 0.5,
"speed": 1,
"upscale_ratio": 123,
"creativity": 123,
"resemblance": 123,
"vectorize": True,
"remove_background": True,
"reframe": True,
"refill": True
}
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_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
prompt: '<string>',
width: 1,
height: 1,
batch_size: 4,
num_inference_steps: 1,
guidance_scale: 123,
prompt_strength: 0.5,
sharpness: 123,
duration_seconds: 1,
generate_audio: true,
keep_audio: true,
fps: 1,
video_effects: [],
use_ta_pose: true,
include_textures: true,
quad_mesh: true,
pbr_materials: true,
low_poly: true,
generate_parts: true,
face_limit: 1,
stability: 0.5,
use_speaker_boost: true,
similarity_boost: 0.5,
style_exaggeration: 0.5,
speed: 1,
upscale_ratio: 123,
creativity: 123,
resemblance: 123,
vectorize: true,
remove_background: true,
reframe: true,
refill: true
})
};

fetch('https://api.app.layer.ai/api/v1/workspaces/{workspace_id}/inferences/estimate', 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.app.layer.ai/api/v1/workspaces/{workspace_id}/inferences/estimate",
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_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'prompt' => '<string>',
'width' => 1,
'height' => 1,
'batch_size' => 4,
'num_inference_steps' => 1,
'guidance_scale' => 123,
'prompt_strength' => 0.5,
'sharpness' => 123,
'duration_seconds' => 1,
'generate_audio' => true,
'keep_audio' => true,
'fps' => 1,
'video_effects' => [

],
'use_ta_pose' => true,
'include_textures' => true,
'quad_mesh' => true,
'pbr_materials' => true,
'low_poly' => true,
'generate_parts' => true,
'face_limit' => 1,
'stability' => 0.5,
'use_speaker_boost' => true,
'similarity_boost' => 0.5,
'style_exaggeration' => 0.5,
'speed' => 1,
'upscale_ratio' => 123,
'creativity' => 123,
'resemblance' => 123,
'vectorize' => true,
'remove_background' => true,
'reframe' => true,
'refill' => true
]),
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.app.layer.ai/api/v1/workspaces/{workspace_id}/inferences/estimate"

payload := strings.NewReader("{\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"prompt\": \"<string>\",\n \"width\": 1,\n \"height\": 1,\n \"batch_size\": 4,\n \"num_inference_steps\": 1,\n \"guidance_scale\": 123,\n \"prompt_strength\": 0.5,\n \"sharpness\": 123,\n \"duration_seconds\": 1,\n \"generate_audio\": true,\n \"keep_audio\": true,\n \"fps\": 1,\n \"video_effects\": [],\n \"use_ta_pose\": true,\n \"include_textures\": true,\n \"quad_mesh\": true,\n \"pbr_materials\": true,\n \"low_poly\": true,\n \"generate_parts\": true,\n \"face_limit\": 1,\n \"stability\": 0.5,\n \"use_speaker_boost\": true,\n \"similarity_boost\": 0.5,\n \"style_exaggeration\": 0.5,\n \"speed\": 1,\n \"upscale_ratio\": 123,\n \"creativity\": 123,\n \"resemblance\": 123,\n \"vectorize\": true,\n \"remove_background\": true,\n \"reframe\": true,\n \"refill\": true\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.app.layer.ai/api/v1/workspaces/{workspace_id}/inferences/estimate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"prompt\": \"<string>\",\n \"width\": 1,\n \"height\": 1,\n \"batch_size\": 4,\n \"num_inference_steps\": 1,\n \"guidance_scale\": 123,\n \"prompt_strength\": 0.5,\n \"sharpness\": 123,\n \"duration_seconds\": 1,\n \"generate_audio\": true,\n \"keep_audio\": true,\n \"fps\": 1,\n \"video_effects\": [],\n \"use_ta_pose\": true,\n \"include_textures\": true,\n \"quad_mesh\": true,\n \"pbr_materials\": true,\n \"low_poly\": true,\n \"generate_parts\": true,\n \"face_limit\": 1,\n \"stability\": 0.5,\n \"use_speaker_boost\": true,\n \"similarity_boost\": 0.5,\n \"style_exaggeration\": 0.5,\n \"speed\": 1,\n \"upscale_ratio\": 123,\n \"creativity\": 123,\n \"resemblance\": 123,\n \"vectorize\": true,\n \"remove_background\": true,\n \"reframe\": true,\n \"refill\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.app.layer.ai/api/v1/workspaces/{workspace_id}/inferences/estimate")

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_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"prompt\": \"<string>\",\n \"width\": 1,\n \"height\": 1,\n \"batch_size\": 4,\n \"num_inference_steps\": 1,\n \"guidance_scale\": 123,\n \"prompt_strength\": 0.5,\n \"sharpness\": 123,\n \"duration_seconds\": 1,\n \"generate_audio\": true,\n \"keep_audio\": true,\n \"fps\": 1,\n \"video_effects\": [],\n \"use_ta_pose\": true,\n \"include_textures\": true,\n \"quad_mesh\": true,\n \"pbr_materials\": true,\n \"low_poly\": true,\n \"generate_parts\": true,\n \"face_limit\": 1,\n \"stability\": 0.5,\n \"use_speaker_boost\": true,\n \"similarity_boost\": 0.5,\n \"style_exaggeration\": 0.5,\n \"speed\": 1,\n \"upscale_ratio\": 123,\n \"creativity\": 123,\n \"resemblance\": 123,\n \"vectorize\": true,\n \"remove_background\": true,\n \"reframe\": true,\n \"refill\": true\n}"

response = http.request(request)
puts response.read_body
{
  "estimated_price_creative_units": 123,
  "workspace_balance_creative_units": 123,
  "estimated_remaining_balance_creative_units": 123,
  "has_sufficient_creative_units": true
}
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Authorizations

Authorization
string
header
required

Personal Access Token or OAuth2 JWT. Create a PAT at app.layer.ai → Settings → Personal Access Tokens.

Path Parameters

workspace_id
string<uuid>
required

Body

application/json

REST request body for estimating inference price. workspace_id comes from path.

model_id
string<uuid>
required

Model/style ID to use for generation.

prompt
string | null

Text prompt.

Maximum string length: 100000
width
integer | null

Output width in pixels. If not specified, a default resolution based on the model will be applied.

Required range: x > 0
height
integer | null

Output height in pixels. If not specified, a default resolution based on the model will be applied.

Required range: x > 0
batch_size
integer
default:4

Number of outputs (1-16).

Required range: 1 <= x <= 16
num_inference_steps
integer | null

Number of diffusion steps.

Required range: x > 0
guidance_scale
number | null

Guidance scale (CFG).

prompt_strength
number | null

Prompt strength for img2img (0-1).

Required range: 0 <= x <= 1
quality
enum<string> | null

Quality level: low, medium, or high.

Available options:
low,
medium,
high
sharpness
number | null

Output sharpness.

duration_seconds
number | null

Video duration in seconds.

Required range: x > 0
generate_audio
boolean | null

Generate audio with video.

keep_audio
boolean | null

Keep audio from input video.

fps
integer | null

FPS for LTX video generation (e.g. 25 or 50).

Required range: x > 0
video_effects
ForgeVideoEffectInput · object[]

Video effects to apply.

use_ta_pose
boolean | null

Use T/A pose for 3D.

include_textures
boolean | null

Include textures in 3D output.

quad_mesh
boolean | null

Generate quad mesh.

pbr_materials
boolean | null

Generate PBR materials.

low_poly
boolean | null

Generate low-poly mesh.

generate_parts
boolean | null

Generate separate parts.

face_limit
integer | null

Face/polygon limit for 3D mesh.

Required range: x > 0
stability
number | null

Audio stability (0-1).

Required range: 0 <= x <= 1
use_speaker_boost
boolean | null

Boost speaker clarity.

similarity_boost
number | null

Voice similarity boost (0-1).

Required range: 0 <= x <= 1
style_exaggeration
number | null

Style exaggeration (0-1).

Required range: 0 <= x <= 1
speed
number | null

Speech speed multiplier.

Required range: x > 0
upscale_ratio
number | null

Upscale factor (e.g. 2.0, 4.0).

creativity
number | null

Creative variation strength for upscaling.

resemblance
number | null

Resemblance to original for upscaling.

vectorize
boolean | null

Vectorize the output image.

remove_background
boolean | null

Remove background from output.

reframe
boolean | null

Reframe/extend the image.

refill
boolean | null

Outpaint/refill transparent areas.

Response

Successful Response

estimated_price_creative_units
number
required

Total estimated Creative Units price for this run.

workspace_balance_creative_units
number
required

Usable Creative Units balance (total balance minus reserved by in-progress generations).

estimated_remaining_balance_creative_units
number
required

Usable balance after subtracting the estimated price. Can be negative.

has_sufficient_creative_units
boolean
required

Whether the workspace has enough available Creative Units to cover the estimated price.