Skip to content

Choose a machine and pricing

Machine selection

gpu and cpu are the API's machine selectors, sent as they are. Nebius picks the platform and preset in the project's region at create time, and reads (get, wait, display) show the platform and preset it chose.

Argument Example Sent as Machine
gpu="MODEL" gpu="h100" spec.gpu = ["h100"] One GPU of that model
gpu="MODEL:COUNT" gpu="h100:8" spec.gpu = ["h100:8"] COUNT GPUs, at least 1
cpu="FAMILY:VCPUS" cpu="amd:16" spec.cpu = ["amd:16"] A CPU machine with that many vCPUs
platform=, preset= platform="gpu-h100-sxm" platform, preset Exactly that platform and preset
none of them platform="cpu-d3", preset="2vcpu-8gb" The smallest CPU machine

In eu-north1, gpu="h100" resolves to the platform gpu-h100-sxm and the preset 1gpu-16vcpu-200gb, which job.display() shows.

The client checks only the shape (h100:0, :8 and gpu="cpu" raise ValidationError). gpu and cpu exclude each other, and either excludes platform and preset. A model, count or family that the region does not offer is Nebius's call: create raises ValidationError with the code and Nebius's reason, or CapacityError. platform= without preset= fills the smallest preset for known platforms; the CLI marks --platform/--preset "will be deprecated soon". Spot pricing on a CPU machine (cpu=, a cpu-… platform, or no machine argument) raises UnsupportedFeature.

On-demand or spot

On a GPU machine, jobs and endpoints run on spot unless you pass pricing="on-demand". Tasks run on-demand unless you pass pricing="spot". A CPU machine runs on-demand: spot is not available on CPU, and pricing="spot" there raises UnsupportedFeature.

Spot is preemptible and follows the current spot price: cheaper, but Nebius can stop the machine. A preempted job ends in ERROR, and nothing creates it again: ns.Job(job.spec).create() starts a new one. A preempted endpoint goes to STOPPED, and start() runs it again. The default needs spot GPU quota in the project's region. Pass pricing="on-demand" for a machine that must not be preempted, or when the project has on-demand quota only.

job = ns.Job(
    command=["python", "train.py"],
    image="registry.example.com/team/trainer:1.4",
    gpu="h100",
    timeout="24h",
    pricing="spot",
    spot_policy="pricingpolicy-...",  # optional: cap the price
)

spot_policy is a pricing policy id that caps the spot price. It requires pricing="spot", and is sent as pricing_model.spot_pricing_policy in place of follows_spot_price: the machine is preempted when the spot price exceeds the cap.

Restarts and preemption

restart_attempts restarts the container on the same machine after the command fails: N allows up to N restarts after the first run, and -1 restarts without limit. A successful exit is never restarted.

Nebius never restarts after preemption, lack of capacity, an unexpected machine stop, a startup failure, or a timeout: the job ends in ERROR, and this client does not create it again. A preempted job has state_details.code Preempted. Create a new job from the same spec to run it again; it starts over with the full timeout, so save checkpoints to a mounted volume and resume from them. See Spot preemption.

A preempted spot endpoint goes to STOPPED with the code Preempted; start() resumes it.