Inferences

Execute inference

Changed on

Start an AI inference (image, video, 3D, or audio). Returns immediately with an ID. Poll with GET /workspaces/{workspace_id}/inferences/{inference_id} for results. Creative Units are not checked here: an underfunded workspace is still accepted and the run then reports FAILED with error_code INSUFFICIENT_BALANCE. Use the estimate endpoint's has_sufficient_creative_units to check before submitting.

post/v1/workspaces/{workspace_id}/inferences

Request

  • Base URL: https://api.app.layer.ai/api
  • URL: https://api.app.layer.ai/api/v1/workspaces/{workspace_id}/inferences
  • 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:write)

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.

model_idstring uuid required

Model/style ID to use for generation.

weightnumber

Style/LoRA strength applied to the model. 1.0 = as trained; lower weakens, higher over-applies the style. Only affects LoRA/adapter-backed styles; ignored for models without a trainable adapter.

promptstring nullable

Text prompt.

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.

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.

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.

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.

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.

vectorizeboolean nullable

Vectorize the output image.

remove_backgroundboolean nullable

Remove background from output.

reframeboolean nullable

Reframe/extend the image.

refillboolean nullable

Outpaint/refill transparent areas.

seedinteger

Random seed. -1 for random.

session_namestring nullable

Session name.

Response

Successful Response

inference_idstring uuid required

Unique identifier for this forge run.

status'in_progress' | 'complete' | 'failed' | 'cancelled' | 'deleted' required
estimated_price_creative_unitsnumber nullable

Estimated price in Creative Units.

poll_interval_secondsinteger required

Suggested polling interval in seconds.

created_atstring date-time required

Timestamp of when the run was created.

session_idstring uuid nullable

Session ID the run was added to, if a session was specified.

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

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property