Segment-based inference
Let the platform prepare model input from live segment data — options, async behavior, and when to go raw.
/infer-segment is the production path: instead of building an input
tensor yourself, the platform rebuilds the exact input the model saw
during training, from the segment's live data, on every request.
curl -X POST "$API_BASE/v1/inference/deployments/$DEPLOYMENT_ID/infer-segment" \
-H "Authorization: Bearer $TOKEN" \
-H "X-Workspace-Id: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{}'from predictai import PredictAI
client = PredictAI(token="pa_live_…", workspace_id="ws_…")
data = client.inference.post_inference_deployments_by_deployment_id_infer_segment(DEPLOYMENT_ID, json={})
import { PredictAI } from "@predictai/sdk";
const client = new PredictAI({ token: "pa_live_…", workspaceId: "ws_…" });
const data = await client.inference.postInferenceDeploymentsByDeploymentIdInferSegment(DEPLOYMENT_ID, { json: {} });
The same route exists on the pipeline and goal aliases.
What the platform prepares
For a deployment backed by a trained model, each request:
- Looks up the model's configuration — segment, sequence length, feature set.
- Fetches the segment's most recent live data.
- Applies the normalization and engineered features used during training.
- Assembles the input in the exact shape the model was trained on.
- Runs inference, inverse-scales the outputs back to real units, and maps them to segment labels.
That's why an empty body {} is a complete request — everything the model
needs is derived from the deployment. The response's data_period tells
you the window of data it used, and feature_names the features that went
in.
Body options
For trained-model deployments the body is optional. One debugging knob is supported:
| Field | Meaning |
|---|---|
parameters.feature_debug optional | true returns the prepared feature vector, feature order, and sequence shape in a debug block. |
Foundation deployments (a foundation model deployed zero-shot, with no trained model attached) have no bound segment, so you tell them what to forecast:
| Field | Meaning |
|---|---|
segment_id required | The segment to forecast. |
horizon optional | Forecast steps ahead. Defaults to the deployment's horizon. |
samples optional | Sample paths for probabilistic forecasts. Defaults to 100. |
quantile_levels optional | Quantiles to return. Defaults to [0.1, 0.5, 0.9]. |
context_length optional | History window the model conditions on. Defaults to the model's own. |
curl -X POST "$API_BASE/v1/inference/deployments/$DEPLOYMENT_ID/infer-segment" \
-H "Authorization: Bearer $TOKEN" \
-H "X-Workspace-Id: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"segment_id": "SEGMENT_ID",
"horizon": 28,
"quantile_levels": [0.1, 0.5, 0.9]
}'from predictai import PredictAI
client = PredictAI(token="pa_live_…", workspace_id="ws_…")
data = client.inference.post_inference_deployments_by_deployment_id_infer_segment(DEPLOYMENT_ID, json={
"segment_id": "SEGMENT_ID",
"horizon": 28,
"quantile_levels": [0.1, 0.5, 0.9],
})
import { PredictAI } from "@predictai/sdk";
const client = new PredictAI({ token: "pa_live_…", workspaceId: "ws_…" });
const data = await client.inference.postInferenceDeploymentsByDeploymentIdInferSegment(DEPLOYMENT_ID, {
json: {
segment_id: "SEGMENT_ID",
horizon: 28,
quantile_levels: [0.1, 0.5, 0.9],
},
});
Omitting segment_id on a foundation deployment returns 400
VALIDATION_ERROR.
Foundation deployments answer 202 Accepted when the model server was
cold, and complete asynchronously — see
handling a 202.
Trained-model deployments always respond synchronously.
Reading the response
The full shape is shown in Run a forecast. The segment-specific fields:
| Field | Meaning |
|---|---|
predictions[].label | Segment label the forecast belongs to |
predictions[].quantiles | Quantile forecasts keyed by level (e.g. "0.1", "0.5", "0.9"), when requested |
segment_id, segment_name | The segment that fed the model |
sequence_length | Timesteps of history in the model input |
feature_names | Features prepared, in input order |
data_period | Start/end of the live data window used |
shock | Present only when the goal behind this deployment is in shock/recovery and the forecast was blended accordingly |
debug | Present only with feature_debug: true |
When to prefer raw /infer
Reach for raw inference when segment preparation gets in the way:
- You compute features in your own system and want the model to see exactly those values — not the segment's live data.
- You're backtesting or replaying historical inputs.
- You're integrating an existing client that already speaks a standard
{"input": …}tensor format.
You take on preprocessing yourself: raw inputs must match the training
feature order, and outputs come back unscaled under the synthetic
output label. See
Run a forecast.

