nvidia-smi in a Serverless AI job. As a result, you receive information about the GPUs of the virtual machine (VM) in which the job is running. In the web console, the nvidia-smi quick-start configuration runs the same kind of workload with settings already filled in.
Prerequisites
- Web console
- CLI
- Go SDK
- Python SDK
- JavaScript SDK
- REST API
- Make sure you are in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console. - In the Administration → Limits → Quotas section, check the Number of virtual machines (VMs) quota under Compute: it should have at least one VM available. If necessary, increase the quota.
-
Install and configure the Nebius AI Cloud CLI.
Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration:
cat ~/.nebius/config.yaml -
Make sure that you or the service account that you use is in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console. - In the Administration → Limits → Quotas section, check the Number of virtual machines (VMs) quota under Compute: it should have at least one VM available. If necessary, increase the quota.
- Install and initialize the Nebius SDK for Go.
- Make sure that you or the service account that you use is in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console. - In the Administration → Limits → Quotas section, check the Number of virtual machines (VMs) quota under Compute: it should have at least one VM available. If necessary, increase the quota.
- Install and initialize the Nebius SDK for Python.
- Make sure that you or the service account that you use is in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console. - In the Administration → Limits → Quotas section, check the Number of virtual machines (VMs) quota under Compute: it should have at least one VM available. If necessary, increase the quota.
- Install and initialize the Nebius SDK for JavaScript.
- Make sure that you or the service account that you use is in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console. - In the Administration → Limits → Quotas section, check the Number of virtual machines (VMs) quota under Compute: it should have at least one VM available. If necessary, increase the quota.
- Get an access token to authenticate to the REST API.
- Make sure that you or the service account that you use is in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console. - In the Administration → Limits → Quotas section, check the Number of virtual machines (VMs) quota under Compute: it should have at least one VM available. If necessary, increase the quota.
Steps
Run a Serverless AI job
- Web console
- CLI
- Go SDK
- Python SDK
- JavaScript SDK
- REST API
- In the sidebar, go to
Serverless AI → Jobs.
- Select the nvidia-smi quick start card. The quick start configuration uses a verified container image and prefilled job settings.
- Click Create job.
Use
nebius ai create to create a job step by step in the terminal. The command prompts you to enter values to pass as parameters, shows the resulting configuration and then creates the job.-
Run the following command:
Alternatively, you can run
nebius ai job create \ --name my-job \ --image nvidia/cuda:13.1.1-runtime-ubuntu24.04 \ --container-command bash \ --args "-c nvidia-smi" \ --platform gpu-l40s-a \ --preset 1gpu-8vcpu-32gb \ --timeout 1h \ --subnet-id <subnet_ID>nebius ai createand specify each value step by step with CLI prompts. The command pre-fills the following values:--name: Job name.--image: Container image to run. In the given example, the nvidia/cuda:13.1.1-runtime-ubuntu24.04 image is used. It contains the Ubuntu 24.04 operating system as well as drivers and other components for GPUs.--container-command: Terminal shell for commands to run.--args: Arguments fordocker runto pass to the entrypoint command. The specified arguments require the container to runnvidia-smi.--platform: VM platform for the job. Every job uses Compute platforms and presets.--preset: Number of GPUs, vCPUs and RAM allocated to the container. The preset must match the selected platform.--timeout: Duration after which the job is canceled if it has not completed.--subnet-id: Subnet ID.
- When the CLI prompts you to select a project, region or subnet, select from the values that are available.
- Review the resulting configuration, then confirm creation.
Run the following code:In the code, set the following parameters:
createJobService := sdk.Services().Ai().V1().Job()
createJobOperation, err := createJobService.Create(
ctx,
&ai.CreateJobRequest{
Metadata: &common.ResourceMetadata{
ParentId: "<project_ID>",
Name: "my-job",
},
Spec: &ai.JobSpec{
Image: "nvidia/cuda:13.1.1-runtime-ubuntu24.04",
ContainerCommand: "bash",
Args: "-c nvidia-smi",
Timeout: durationpb.New(time.Hour),
Platform: "gpu-l40s-a",
Preset: "1gpu-8vcpu-32gb",
SubnetId: "<subnet_ID>",
ShmSizeBytes: 17179869184,
Disk: &ai.JobSpec_DiskSpec{
Type: compute.DiskSpec_NETWORK_SSD,
SizeBytes: 268435456000,
},
},
},
)
if err != nil {
return fmt.Errorf("create job: %w", err)
}
if _, err = createJobOperation.Wait(ctx); err != nil {
return fmt.Errorf("wait for job creation: %w", err)
}
Metadata.ParentId: Project ID.Metadata.Name: Job name.Spec.Image: Container image to run. In the given example, the nvidia/cuda:13.1.1-runtime-ubuntu24.04 image is used. It contains the Ubuntu 24.04 operating system as well as drivers and other components for GPUs.Spec.ContainerCommand: Terminal shell for commands to run.Spec.Args: Arguments fordocker runto pass to the entrypoint command. The specified arguments require the container to runnvidia-smi.Spec.Timeout: Duration after which the job is canceled if it has not completed, as a Go duration such asdurationpb.New(time.Hour).Spec.Platform: VM platform for the job. Every job uses Compute platforms and presets.Spec.Preset: Number of GPUs, vCPUs and RAM allocated to the container. The preset must match the selected platform.Spec.SubnetId: Subnet ID.Spec.Disk.Type: Disk type for the underlying VM.Spec.Disk.SizeBytes: Disk size in bytes. The example sets 250 GiB.
Wait completes, createJobOperation.ResourceID() returns the created job’s ID. Save this value because you need it in later steps.Run the following code:In the code, set the following parameters:
create_job_service = JobServiceClient(sdk)
create_job_operation = await create_job_service.create(
CreateJobRequest(
metadata=ResourceMetadata(
parent_id="<project_ID>",
name="my-job",
),
spec=JobSpec(
image=(
"nvidia/cuda:13.1.1-runtime-ubuntu24.04"
),
container_command="bash",
args="-c nvidia-smi",
timeout=timedelta(hours=1),
platform="gpu-l40s-a",
preset="1gpu-8vcpu-32gb",
subnet_id="<subnet_ID>",
shm_size_bytes=17179869184,
disk=JobSpec__DiskSpec(
type=DiskSpec__DiskType.NETWORK_SSD,
size_bytes=268435456000,
),
),
),
)
await create_job_operation.wait()
metadata.parent_id: Project ID.metadata.name: Job name.spec.image: Container image to run. In the given example, the nvidia/cuda:13.1.1-runtime-ubuntu24.04 image is used. It contains the Ubuntu 24.04 operating system as well as drivers and other components for GPUs.spec.container_command: Terminal shell for commands to run.spec.args: Arguments fordocker runto pass to the entrypoint command. The specified arguments require the container to runnvidia-smi.spec.timeout: Duration after which the job is canceled if it has not completed, as a Pythontimedeltasuch astimedelta(hours=1).spec.platform: VM platform for the job. Every job uses Compute platforms and presets.spec.preset: Number of GPUs, vCPUs and RAM allocated to the container. The preset must match the selected platform.spec.subnet_id: Subnet ID.spec.disk.type: Disk type for the underlying VM.spec.disk.size_bytes: Disk size in bytes. The example sets 250 GiB.
await create_job_operation.wait() completes, create_job_operation.resource_id returns the created job’s ID. Save this value because you need it in later steps.Run the following code:In the code, set the following parameters:
dayjs.extend(duration);
const jobTimeout = dayjs.duration(1, "hour");
const createJobService = new JobService(sdk);
const createJobOperation = await createJobService.create(
CreateJobRequest.create({
metadata: {
parentId: "<project_ID>",
name: "my-job",
},
spec: {
image: "nvidia/cuda:13.1.1-runtime-ubuntu24.04",
containerCommand: "bash",
args: "-c nvidia-smi",
timeout: jobTimeout,
platform: "gpu-l40s-a",
preset: "1gpu-8vcpu-32gb",
subnetId: "<subnet_ID>",
shmSizeBytes: 17179869184n,
disk: {
type: DiskSpec_DiskType.NETWORK_SSD,
sizeBytes: 268435456000n,
},
},
}),
).result;
await createJobOperation.wait();
metadata.parentId: Project ID.metadata.name: Job name.spec.image: Container image to run. In the given example, the nvidia/cuda:13.1.1-runtime-ubuntu24.04 image is used. It contains the Ubuntu 24.04 operating system as well as drivers and other components for GPUs.spec.containerCommand: Terminal shell for commands to run.spec.args: Arguments fordocker runto pass to the entrypoint command. The specified arguments require the container to runnvidia-smi.spec.timeout: Duration after which the job is canceled if it has not completed, as adayjs.Durationsuch asdayjs.duration(1, "hour").spec.platform: VM platform for the job. Every job uses Compute platforms and presets.spec.preset: Number of GPUs, vCPUs and RAM allocated to the container. The preset must match the selected platform.spec.subnetId: Subnet ID.spec.disk.type: Disk type for the underlying VM.spec.disk.sizeBytes: Disk size in bytes, as abigint. The example sets 250 GiB.
await createJobOperation.wait() completes, createJobOperation.resourceId() returns the created job’s ID. Save this value because you need it in later steps.Send the following request:In the
curl --request POST \
--url 'https://api.nebius.cloud/ai/v1/jobs' \
--header "Authorization: Bearer <access_token>" \
--header 'Content-Type: application/json' \
--data '{
"metadata": {
"parentId": "<project_ID>",
"name": "my-job"
},
"spec": {
"image": "nvidia/cuda:13.1.1-runtime-ubuntu24.04",
"containerCommand": "bash",
"args": "-c nvidia-smi",
"platform": "gpu-l40s-a",
"preset": "1gpu-8vcpu-32gb",
"timeout": "3600s",
"subnetId": "<subnet_ID>",
"disk": {
"type": "NETWORK_SSD",
"sizeBytes": 268435456000
}
}
}'
Authorization header, replace <access_token> with the access token that you got in the prerequisites.The request includes the following parameters:metadata.parentId: Project ID.metadata.name: Job name.spec.image: Container image to run. In the given example, the nvidia/cuda:13.1.1-runtime-ubuntu24.04 image is used. It contains the Ubuntu 24.04 operating system as well as drivers and other components for GPUs.spec.containerCommand: Terminal shell for commands to run.spec.args: Arguments fordocker runto pass to the entrypoint command. The specified arguments require the container to runnvidia-smi.spec.platform: VM platform for the job. Every job uses Compute platforms and presets.spec.preset: Number of GPUs, vCPUs and RAM allocated to the container. The preset must match the selected platform.spec.timeout: Duration after which the job is canceled if it has not completed.spec.subnetId: Subnet ID.spec.disk.type: Disk type for the underlying VM.spec.disk.sizeBytes: Disk size in bytes. The specified value is 250 GiB.
resourceId parameter. Save this value because you need it in later steps.Check the job status and results
Checking job logs is available only in the web console and CLI.
- Web console
- CLI
- Go SDK
- Python SDK
- JavaScript SDK
- REST API
- In the sidebar, go to
Serverless AI → Jobs.
- Next to the job, click View logs. Alternatively, select the job that you want to view the logs for and switch to the Logs tab.
- Save the job ID to an environment variable:
export JOB_ID=$(nebius ai job get-by-name --name my-job \ --format jsonpath='{.metadata.id}') - View information about the job:
The command output contains such data as the job status, start and finish times.
nebius ai job get $JOB_ID - If the output doesn’t indicate that the job has started, wait a few seconds. Next, run the previous command again and check that the job is running now.
- When the job has started, check its logs:
The logs contain information about the GPUs that
nebius ai job logs $JOB_IDnvidia-smiprovides (in other words, the output of thenvidia-smicommand).
nebius ai job get $JOB_ID and nebius ai job logs $JOB_ID multiple times to determine whether the job is complete, and the full output of nvidia-smi is returned in logs.Get the job and check the In
status.state value in the printed result:getJobService := sdk.Services().Ai().V1().Job()
job, err := getJobService.Get(
ctx,
&ai.GetJobRequest{Id: "<job_ID>"},
)
if err != nil {
return fmt.Errorf("get job: %w", err)
}
fmt.Println(job)
ai.GetJobRequest, set Id to the job ID that you saved when you created the job.If the state doesn’t indicate that the job has started, wait a few seconds and run the code again. You can repeat the request until the job reaches the COMPLETED state.Get the job and check the In
status.state value in the response:get_job_service = JobServiceClient(sdk)
job = await get_job_service.get(
GetJobRequest(id="<job_ID>"),
)
print(job)
GetJobRequest, set id to the job ID that you saved when you created the job.If the state doesn’t indicate that the job has started, wait a few seconds and run the code again. You can repeat the request until the job reaches the COMPLETED state.Get the job and check the In
status?.state value in the response:const getJobService = new JobService(sdk);
const job = await getJobService.get(
GetJobRequest.create({ id: "<job_ID>" }),
);
console.log(job);
GetJobRequest, set id to the job ID that you saved when you created the job.If the state doesn’t indicate that the job has started, wait a few seconds and run the code again. You can repeat the request until the job reaches the COMPLETED state.Get the job and check the In the request, specify:
status.state parameter in the response:curl --request GET \
--url "https://api.nebius.cloud/ai/v1/jobs/<job_ID>" \
--header "Authorization: Bearer <access_token>"
- Your access token in the
Authorizationheader. - In the request path, the job ID returned in the
resourceIdparameter when you created the job.
COMPLETED state.(Optional) Delete the job
When the job is complete, Serverless AI automatically releases all allocated computing resources and the container disk of the job. When you delete a completed job, you remove it from the list of Serverless AI jobs. If you delete a running job, all the resources are released as well.- Web console
- CLI
- Go SDK
- Python SDK
- JavaScript SDK
- REST API
- In the sidebar, go to
Serverless AI → Jobs.
- Find the job and then click
→ Delete.
- In the window that opens, confirm deleting the job.
To delete the job, run the following command:
nebius ai job delete $JOB_ID
To delete the job, run the following code:In
deleteJobService := sdk.Services().Ai().V1().Job()
deleteJobOperation, err := deleteJobService.Delete(
ctx,
&ai.DeleteJobRequest{Id: "<job_ID>"},
)
if err != nil {
return fmt.Errorf("delete job: %w", err)
}
if _, err = deleteJobOperation.Wait(ctx); err != nil {
return fmt.Errorf("wait for job deletion: %w", err)
}
ai.DeleteJobRequest, set Id to the job ID that you saved when you created the job.To delete the job, run the following code:In
delete_job_service = JobServiceClient(sdk)
delete_job_operation = await delete_job_service.delete(
DeleteJobRequest(id="<job_ID>"),
)
await delete_job_operation.wait()
DeleteJobRequest, set id to the job ID that you saved when you created the job.To delete the job, run the following code:In
const deleteJobService = new JobService(sdk);
const deleteJobOperation = await deleteJobService.delete(
DeleteJobRequest.create({ id: "<job_ID>" }),
).result;
await deleteJobOperation.wait();
DeleteJobRequest, set id to the job ID that you saved when you created the job.To delete the job, send the following request:In the request, specify:
curl --request DELETE \
--url "https://api.nebius.cloud/ai/v1/jobs/<job_ID>" \
--header "Authorization: Bearer <access_token>"
- Your access token in the
Authorizationheader. - In the request path, the job ID returned in the
resourceIdparameter when you created the job.