Skip to content

Run an inference with a base model

Viewing v2— current version

POST
/v2/workspaces/{workspace_id}/base-models/{slug}/inferences
curl --request POST \
--url https://api.app.layer.ai/api/v2/workspaces/:workspace_id/base-models/:slug/inferences \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'

New in v2. This endpoint has no v1 equivalent.

Start a generation with the given base model. The request body is the model’s inference form (see GET /base-models/{slug}/inference-schema for its shape). Returns immediately with an inference id; poll GET /workspaces/{workspace_id}/inferences/{inference_id} for results.

workspace_id
required
Workspace Id

Id of the workspace that owns the resource.

string format: uuid

Id of the workspace that owns the resource.

slug
required
Slug

URL-safe slug of the base model, as returned by the list base models endpoint.

string

URL-safe slug of the base model, as returned by the list base models endpoint.

session_name
Any of:
string

Organize this run under a named session. A new session is created if none matches.

Media typeapplication/json
Input
object
key
additional properties
any
Examplegenerated
{}

Successful Response

Media typeapplication/json
ExecuteForgeOutput
object
inference_id
required
Inference Id

Unique identifier for this forge run.

string format: uuid
status
required
InferenceStatus

Current status: IN_PROGRESS.

string
Allowed values: in_progress complete failed cancelled deleted
estimated_price_creative_units
Any of:
number
poll_interval_seconds
required
Poll Interval Seconds

Suggested polling interval in seconds.

integer
created_at
required
Created At

Timestamp of when the run was created.

string format: date-time
session_id
Any of:
string format: uuid
normalized_parameters
Any of:
NormalizedInferenceParameters

Inference parameters after model-specific normalization.

These reflect the actual values used for generation, including model defaults applied for any parameters not explicitly set.

object
width
Any of:
integer
height
Any of:
integer
batch_size
Any of:
integer
num_inference_steps
Any of:
integer
guidance_scale
Any of:
number
duration_seconds
Any of:
number
fps
Any of:
integer
Example
{
"status": "in_progress"
}

Unauthenticated — missing or invalid Bearer token.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Forbidden — insufficient permissions.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Resource not found.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Invalid input parameters.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Rate limited — too many concurrent requests.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Internal server error.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}