Inferences

Estimate inference price

Changed on

Estimate the Creative Units cost of an inference with given parameters. Prices through the same reference-set translation and model selection as the execute endpoint, so the price matches what execution charges for identical inputs.

Reference-set errors: REFERENCE_SET_NOT_FOUND (404 — unknown, deleted, or outside this workspace's reach), NO_COMPATIBLE_MODEL (422 — no enabled base model can apply these sets), REFERENCE_SET_REQUIRED (422 — the chosen model needs an applicable set), REFERENCE_SET_CONFLICT (422 — two sets supply the same singular adapter), REFERENCE_SET_LIMIT_EXCEEDED (422: more sets of one kind than the model takes, e.g. a second ANIMATION set on a 3D animating model), and INPUT_FILE_REQUIRED (422 — the sets select an edit-only model with no asset to edit).

post/v2/workspaces/{workspace_id}/inferences/estimate

Request

  • Base URL: https://api.app.layer.ai/api
  • URL: https://api.app.layer.ai/api/v2/workspaces/{workspace_id}/inferences/estimate
  • Auth: one of:
    • HTTP bearer
    • OAuth 2 (authorization code, authorization URL https://auth.app.layer.ai/authorize, token URL https://auth.app.layer.ai/oauth/token)
    • OAuth 2 (client credentials, token URL https://api.app.layer.ai/api/oauth/token, scopes: generation:read)

Path parameters

workspace_idstring uuid required

Id of the workspace that owns the resource.

Headers

Idempotency-Keystring

Opaque key making a retry of this request return the first result. A 2xx response is replayed for 24 hours with Idempotent-Replayed: true. A 4xx releases the key. A 5xx, or a request still running, holds the key for 120 seconds, during which a retry gets 409; after that a retry executes again. The key covers the method, path, query, and byte-identical body it was first used with; reusing it for a different request is rejected with 422. Protection is best effort: if the key store is unavailable, or a record is lost early, a retry can execute again even after an earlier 409. See the Idempotency section of the API description.

Request body

subtitle_presetstring nullable

Caption style, spelled exactly as one of the model's subtitle_presets: any other name is quoted at the default style and refused at launch. Its subtitle_dynamic_presets animate word by word and bill at a higher rate, so pass the same preset to the estimate. Omit for the model's default style.

subtitle_colorstring nullable

Caption text colour as hex (#FFFFFF), for models whose capabilities report subtitle_primary_color.

subtitle_secondary_colorstring nullable

Colour of the words the model emphasises, as hex, for models whose capabilities report subtitle_secondary_color.

subtitle_alignment'top' | 'center' | 'bottom' nullable

Where the captions sit vertically, for models whose capabilities report subtitle_alignment.

base_model_idstring nullable

Base model to run, as an id (e.g. flux-dev), display name, or community alias.

modality'text' | 'image' | 'audio' | 'video' | 'three_d' | 'playable' | 'world'
promptstring nullable

Text prompt.

negative_promptstring nullable

What to steer the output away from. Honored by the models whose inference-schema lists negative_prompt, and ignored by the rest.

widthinteger nullable

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

heightinteger nullable

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

auto_aspect_ratioboolean nullable

Derive the output's shape from the input instead of from width/height. Only on models whose capabilities include autoAspectRatio.

auto_resolutionstring nullable

The size tier of an auto_aspect_ratio run (e.g. '2K'), one of the model's autoResolutions. Unset on an image run, the smallest tier that holds the input image.

batch_sizeinteger

Number of outputs (1-16).

num_inference_stepsinteger nullable

Number of diffusion steps.

guidance_scalenumber nullable

Guidance scale (CFG).

prompt_strengthnumber nullable

How closely the generated audio follows the text prompt (0-1); higher means less variation. Honored by ElevenLabs Sound Effects and the Sonilo video-to-music models, and ignored by every other model. To control how closely an image or video generation follows an input image, set guidance_files[].weight instead.

quality'low' | 'medium' | 'high' nullable

Quality level: low, medium, or high.

sharpnessnumber nullable

Output sharpness.

prompt_enhancement'off' | 'fast' | 'standard' | 'quality'

How much effort the provider spends rewriting the prompt before it generates.

One ladder for a dial providers spell a dozen ways: an on/off flag (enable_prompt_expansion, prompt_optimizer, enhance_prompt, expand_prompt, autoprompt, ...) or a mode (MiniMax's disabled/fast/balanced/quality, Seedream's fast/standard, Qwen's none/quality). Member order is the ladder. Each model declares the levels it offers as prompt_enhancement_levels, and the provider mapping spells a level its own way; an on/off provider offers OFF and STANDARD.

This is the provider's own rewriting, distinct from Layer's prompt-enhance action, which rewrites the prompt visibly before the request is made.

duration_secondsnumber nullable

Output length in seconds — a video clip's duration, or the clip length for audio models whose capabilities report duration_seconds_min and duration_seconds_max. A value outside a model's supported range is refused.

generate_audioboolean nullable

Generate audio with video.

keep_audioboolean nullable

Keep audio from input video.

draftboolean nullable

Render a quick, low-cost draft instead of the full-quality output, on models whose capabilities report draft. Complete the draft later with the model named by the generating model's draftCompletionModelId, passing the draft file as a DRAFT_VIDEO input (DRAFT_WORLD for a world, DRAFT_MESH for a mesh).

instrumentalboolean nullable

Guarantee a track with no vocals, on models whose capabilities report instrumental. Asking for one in the prompt is only a suggestion.

loopboolean nullable

Compose the clip to repeat with no audible seam, on models whose capabilities report loop.

output_format'mp3' | 'wav' | 'aac' | 'flac'

Container for a delivered audio file.

Providers name these their own way and Layer never re-encodes what one returns, so the format a caller asks for is only keepable on models whose capabilities list it. Members are named for their wire value: the frontend artifacts preserve enum names, and a name that differed from the value would hand clients a format string the request API rejects.

lyricsstring nullable

Words to be sung, for models whose capabilities report lyrics. A separate input from the prompt, which describes the music itself.

fpsinteger nullable

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

use_ta_poseboolean nullable

Deprecated: use pose_mode. Legacy rig-ready-pose toggle for 3D.

pose_mode'A_POSE' | 'T_POSE'

Canonical rest pose a character-mesh model is asked to generate in. A_POSE places the arms angled down at roughly 45°; T_POSE holds them straight out to the sides. Only meaningful for models that advertise the pose_modes capability (e.g. Meshy V7).

Deliberately a light top-level module (like base_model_id), NOT under pkg.models.inference: the Blueprint definition layer registers this as a BlueprintType and migrates legacy node ports, and must do so without pulling in the heavy pkg.models.inference package, which would perturb the Temporal workflow-sandbox import graph and split pydantic class identity.

include_texturesboolean nullable

Include textures in 3D output.

detailed_geometryboolean nullable

Denser, more detailed geometry (Meshy V7 ultra mode). Costs extra; support varies by model.

remesh_geometryboolean nullable

Set false to skip the provider's remesh phase and keep its raw geometry. Support varies by model.

texture_resolution'RES_2K' | 'RES_4K' | 'RES_8K'

Edge length of a generated mesh's base color texture.

Offered where the model's texture_resolutions capability lists it (Meshy's and Tripo's own APIs).

remove_lightingboolean nullable

Strip baked highlights and shadows from the texture. Support varies by model.

mesh_density'ULTRA' | 'HIGH' | 'MEDIUM' | 'LOW'

How many faces a mesh keeps, as a level the provider sizes adaptively.

Stands in for a fixed face limit where the model's mesh_densities capability offers it.

preserve_uvsboolean nullable

Keep the mesh's own UV layout when retexturing. Support varies by model.

segment_by'AUTO' | 'PARTS'

What a mesh is split along.

AUTO finds the parts itself; PARTS cuts along the parts segment_part_names names. Offered where the model's segment_by capability lists it.

segment_part_namesstring[] nullable

Parts to split along when segment_by is PARTS, at most 10.

quad_meshboolean nullable

Generate quad mesh.

pbr_materialsboolean nullable

Generate PBR materials.

low_polyboolean nullable

Generate low-poly mesh.

generate_partsboolean nullable

Generate separate parts.

face_limitinteger nullable

Face/polygon limit for 3D mesh.

enable_riggingboolean nullable

Rig the generated 3D mesh with a skeleton. Honored by the models whose capabilities report rigging.

enable_animationboolean nullable

Animate the generated 3D mesh with the motion of the animation reference set passed in reference_sets (category animation), or the provider's default motion without one; implies rigging. Honored by the models whose capabilities report animation.

stabilitynumber nullable

Audio stability (0-1).

use_speaker_boostboolean nullable

Boost speaker clarity.

similarity_boostnumber nullable

Voice similarity boost (0-1).

style_exaggerationnumber nullable

Style exaggeration (0-1).

speednumber nullable

Speech speed multiplier.

upscale_rationumber nullable

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

creativitynumber nullable

Creative variation strength for upscaling.

resemblancenumber nullable

Resemblance to original for upscaling.

denoisenumber nullable

Noise removal. On the models whose capabilities report denoise_range, in that range; a value outside it is refused.

compression_repairnumber nullable

Compression-artifact removal. On the models whose capabilities report compression_repair_range, in that range; a value outside it is refused.

halo_reductionnumber nullable

Removal of bright edge outlines. On the models whose capabilities report halo_reduction_range, in that range; a value outside it is refused.

recover_detailnumber nullable

How much of the source's own detail is kept. On the models whose capabilities report recover_detail_range, in that range; a value outside it is refused.

detailnumber nullable

How much fine detail the model adds. On the models whose capabilities report detail_range, in that range; a value outside it is refused.

grainnumber nullable

Film grain laid over the result. On the models whose capabilities report grain_range, in that range; a value outside it is refused.

refine_strengthnumber nullable

How strongly lettering and shapes are rebuilt. On the models whose capabilities report refine_strength_range, in that range; a value outside it is refused.

realismnumber nullable

Bias of added detail toward photorealism. On the models whose capabilities report realism_range, in that range; a value outside it is refused.

face_enhancementboolean nullable

Set false to skip the face-restoration pass, on models whose capabilities report face_enhancement.

face_enhancement_strengthnumber nullable

Strength of the face pass. On the models whose capabilities report face_enhancement_strength_range, in that range; a value outside it is refused.

face_enhancement_creativitynumber nullable

Facial detail the face pass invents. On the models whose capabilities report face_enhancement_creativity_range, in that range; a value outside it is refused.

target_region'all' | 'subject' | 'background'
color_preservationboolean nullable

Keep the source's palette, on models whose capabilities report color_preservation.

vectorizeboolean nullable

Vectorize the output image.

vectorization_mode'spline' | 'polygon'
vectorization_color_mode'color' | 'binary'
vectorization_layering'stacked' | 'cutout'
vectorization_filter_speckleinteger nullable

Drop specks smaller than this many pixels. Honored by the models whose capabilities report vectorization_controls.

vectorization_color_precisioninteger nullable

Color quantization level; lower merges more colors. Honored by the models whose capabilities report vectorization_controls.

vectorization_layer_differenceinteger nullable

Color difference that splits gradient layers. Honored by the models whose capabilities report vectorization_controls.

vectorization_corner_thresholdinteger nullable

Minimum angle, in degrees, kept as a sharp corner (spline mode). Honored by the models whose capabilities report vectorization_controls.

vectorization_length_thresholdnumber nullable

Longest curve segment before it is subdivided (spline mode). Honored by the models whose capabilities report vectorization_controls.

vectorization_splice_thresholdinteger nullable

Angle, in degrees, at which a curve is split (spline mode). Honored by the models whose capabilities report vectorization_controls.

vectorization_max_iterationsinteger nullable

Curve-fitting passes. Honored by the models whose capabilities report vectorization_controls.

vectorization_path_precisioninteger nullable

Decimal places kept in SVG path coordinates. Honored by the models whose capabilities report vectorization_controls.

transparencyboolean nullable

Put the output on a transparent background. Also accepted as remove_background.

reframeboolean nullable

Reframe/extend the image.

tileabilityboolean nullable

Generate a seamless texture that tiles without a visible edge. Honored by the models whose inference-schema lists tileability (list them with GET .../base-models?tileable=true), and ignored by the rest.

projection'EQUIRECTANGULAR'

The geometry an output image is drawn in, when it is not an ordinary flat picture.

projection_strengthnumber nullable

How strongly a model's 360 LoRA draws the projection, as its scale. Unset takes the LoRA's own.

refillboolean nullable

Outpaint/refill transparent areas.

nine_sliceboolean nullable

Deliver the image as a 9-slice UI element (a button, frame or panel that stretches): after everything else the run does, the plain band through its middle is found on each axis, the stretched regions are cleaned so nothing smears, and the insets are recorded as the file's nineSlice metadata. An image with no such band is delivered as drawn, without insets. Image outputs only.

expressionstring nullable

The expression a face edit gives the face, one of the names the model's capabilities list under expressions.

target_languagestring nullable

The language a dub speaks, as one of the ISO 639-1 codes the model's capabilities list under dub_languages.

Response

Successful Response

estimated_price_creative_unitsnumber required

Total estimated Creative Units price for this run.

workspace_balance_creative_unitsnumber required

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

estimated_remaining_balance_creative_unitsnumber required

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

has_sufficient_creative_unitsboolean required

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

base_model_idstring required

Base model this price refers to, resolved or auto-picked.

auto_pickedboolean required

True when no base_model_id was supplied — the base model was selected from the reference sets.

reference_sets_degradedboolean

True when at least one attached reference set would not meaningfully contribute on the selected model.

reference_sets_warningstring nullable

Names each degraded reference set and why, or null when none is degraded.

Changes

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the new optional request property