Training - TypeScript SDK
client.training manages fine-tuning jobs. Create requests use logical model,
Dataset, recipe, and placement references; the API does not accept raw paths,
container images, commands, environments, or credentials.
Overview
Available Operations
| Method | Description |
|---|---|
capabilities() | Read the active recipe/resource catalog. |
clusterOptions() | List clusters selectable for Training. |
preview(body) | Preflight a resource specification in a cluster. |
knowledgeTeacherModels(options) | Find compatible knowledge-distillation teachers. |
create(body) | Create a fine-tuning job. |
list(body?) | Page Training jobs. |
get(id) | Read job progress, losses, actions, and artifacts. |
artifactDownloadUrl(artifactId) | Create temporary download URLs for a completed artifact. |
cancel(id) | Request cancellation of a non-terminal job. |
capabilities
Read the active recipe/resource catalog.
Request
This method has no parameters and sends no request body.
Response
TrainCapabilitiesVO.
clusterOptions
List clusters selectable for Training.
Request
This method has no parameters and sends no request body.
Response
WorkloadClusterOptionVO[].
preview
Preflight a resource specification in a cluster.
Request
clusterId, resourceSpecId required.
Response
WorkloadAdmissionPreviewVO.
knowledgeTeacherModels
Find compatible knowledge-distillation teachers.
Request
{studentModelId, recipeId} required.
Response
TrainKnowledgeTeacherVO[].
create
Create a fine-tuning job.
Request
Fields below.
Response
{jobId}.
list
Page Training jobs.
Request
Optional pageNum, pageSize, status.
Response
PageResult<TrainJobDetailVO>.
get
Read job progress, losses, actions, and artifacts.
Request
id: string required.
Response
TrainJobDetailVO.
artifactDownloadUrl
Create temporary download URLs for a completed artifact.
Request
artifactId: string required.
Response
{urls: string[], files?: Array<{path, sizeBytes, url}>}.
cancel
Request cancellation of a non-terminal job.
Request
id: string required.
Response
null.
Field Reference and Examples
Create body fields
| Field | Type | Description |
|---|---|---|
clientToken | string | Idempotency token for safe create retries. |
displayName | string | Human-facing job name. |
outputModelName | string | Output model suffix. Its maximum length depends on baseModelRef.id because the final deployable name is <base>-FT-<suffix>; use the capability limit (the tested 4B Profile permits 14 characters). |
recipeId, recipeVersion | string | Recipe identity from capabilities(). |
baseModelRef | object | {type, id} logical base-model reference. |
teacherRef | object | Optional teacher reference; fields described below. |
datasetRefs | Array<object> | Each item uses {datasetId, role}. |
placement | object | {clusterId, nodeId?, resourceSpecId}. |
params | object | Recipe hyperparameters. |
teacherRef uses snake_case wire keys: provider_key_id, model_id,
service_id, and model_asset_id, plus type. Do not send camelCase variants.
Key response fields: TrainCapabilitiesVO contains schemaVersion,
catalogVersion, catalogDigest, and entries. TrainJobDetailVO contains
id, status, stage, progress, taskDisplayName, baseModel,
trainingMethod, artifacts, actions, loss series, deployment references,
timestamps, and error/status details.
const catalog = await client.training.capabilities();
const clusters = await client.training.clusterOptions();
const resource = await client.training.preview({
clusterId: 1,
resourceSpecId: "resource-spec-id",
});
const teachers = await client.training.knowledgeTeacherModels({
studentModelId: "model-id",
recipeId: "recipe-id",
});
const created = await client.training.create<{ jobId: string }>({
clientToken: "training-request-001",
displayName: "example-training",
outputModelName: "example-output",
recipeId: "recipe-id",
recipeVersion: "recipe-version",
baseModelRef: { type: "recipe_model", id: "model-id" },
datasetRefs: [{ datasetId: "dataset-id", role: "train" }],
placement: { clusterId: "1", resourceSpecId: "resource-spec-id" },
params: {},
});
const page = await client.training.list({ pageNum: 1, pageSize: 20, status: "RUNNING" });
const detail = await client.training.get(created.jobId) as {
artifacts?: Array<{ artifactId: string }>;
};
if (detail.artifacts?.length) {
const download = await client.training.artifactDownloadUrl(
detail.artifacts[0]!.artifactId,
);
const firstUrl = (download.urls ?? [download.url!])[0];
}
await client.training.cancel(created.jobId);
All methods use the shared authentication and typed error behavior described in Response Conventions and Retry and Security.