Custom Training
Page Outline
Custom Models Only
This endpoint is only applicable to models with model_type: "custom". It is not available for AutoML (model_type: "auto") models.
Triggers a custom training pipeline for a model, executing the user-supplied training script against the linked dataset within a sandboxed execution environment.
Base Path: /api/v1/models
Method: POST
Path: /{model_id}/custom/train
Auth: Requires a valid Bearer token (Authorization: Bearer <JWT>)
Path Parameters
| Parameter | Type | Description |
|---|---|---|
model_id | string | Unique identifier of the custom model |
Request Body
{
"entry_point": "train.py",
"runtime": "python3.11",
"environment_vars": {
"LEARNING_RATE": "0.001",
"EPOCHS": "50"
},
"compute": {
"cpu_cores": 4,
"memory_gb": 16,
"gpu": false
},
"run_label": "custom-run-experiment-1",
"timeout_seconds": 14400
}
| Field | Type | Required | Description |
|---|---|---|---|
entry_point | string | ✅ | Filename of the uploaded script asset to execute (must match an uploaded asset_type: "script" asset) |
runtime | string | ✅ | Execution runtime: python3.10, python3.11, python3.12 |
environment_vars | object | ❌ | Key-value environment variables passed to the training script |
compute.cpu_cores | integer | ❌ | Number of CPU cores to allocate (default: 2, max: 32) |
compute.memory_gb | integer | ❌ | RAM in GB to allocate (default: 8, max: 128) |
compute.gpu | boolean | ❌ | If true, a GPU worker is requested (subject to availability) |
run_label | string | ❌ | Human-readable label for this training run |
timeout_seconds | integer | ❌ | Max execution time before auto-cancellation (default: 7200, max: 86400) |
Behavior
- Requires at least one uploaded
asset_type: "script"asset. ReturnsHTTP 422if none exist. - The training script operates within a sandboxed container. It receives the linked dataset path via the
DATASET_PATHenvironment variable. - The script is expected to write the serialized model artifact to the path specified in the
MODEL_OUTPUT_PATHenvironment variable; otherwise no version is created upon completion. - Model status transitions to
trainingimmediately upon a successful submission. - Returns
HTTP 409if a training run is already in progress. - An audit log entry is written with action
model.custom_training_started. - Poll progress via the Get Metrics or Get Logs endpoints using the returned
run_id.
Response
Returns a CustomTrainingRun object.
{
"run_id": "run-custom-20260313-f7e2a1",
"model_id": "mdl-7f3a19bc",
"model_type": "custom",
"status": "queued",
"entry_point": "train.py",
"runtime": "python3.11",
"compute": {
"cpu_cores": 4,
"memory_gb": 16,
"gpu": false
},
"run_label": "custom-run-experiment-1",
"created_at": "2026-03-13T16:10:00Z",
"estimated_start_time": "2026-03-13T16:12:00Z"
}