/nebius-cloud:nebius-serverless-recipesfrom nebius-cloud
Provides end-to-end command chains for Nebius Serverless AI workflows: single/multi-GPU training, model serving, batch inference, fine-tuning with checkpoints, preemptible training, and CI jobs from GitHub Actions.
Ships in nebius-cloud. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Complete command chains for the workflows people actually run. Each recipe assembles flags whose details and traps live in the surface skills — read those for the gate itself:
nebius-serverless-jobsnebius-serverless-endpointsnebius-serverless-data-secretsnebius-serverless-setupnebius-serverless-troubleshootingThese rules apply to every command in this skill. Full detail lives in the nebius-cloud-basics skill.
Agent identification. Export AI_AGENT before any Nebius CLI call, including preflight and --help. Keep non-empty harness-set value; unset or empty → set own harness slug. Every call must inherit it, including new shells.
CLI present and configured. Before the first Nebius call in a session:
nebius version # CLI installed (a subcommand — there is no --version flag)
nebius profile list # at least one profile; [default] marks the active one
nebius config get parent-id # project-...
nebius config get tenant-id # tenant-...
These skills require CLI 0.12.247 or newer; an individual skill may state a higher floor (the Serverless skills need 0.12.277) — the stricter number wins. If nebius version is older, stop and ask the user to update the CLI before relying on the commands or schemas below.
If any check fails or an ID comes back empty, stop and walk the user through CLI installation and profile setup: curl -sSL https://artifacts.nebius.cloud/cli/install.sh | bash, then nebius profile create --parent-id <project-id>. Print those commands for the user to run — do not run them yourself: the installer writes to their machine and the shown federation-profile command opens a browser and blocks. An expired session does not show up here; it surfaces on the first real API call, and re-auth is the same human task.
Resolve context first — never guess IDs. Nearly every call needs --parent-id, and the CLI does not say which scope it wants:
nebius profile current # which profile is active
nebius config get parent-id [-p <profile>] # project-... (project scope)
nebius config get tenant-id [-p <profile>] # tenant-... (tenant scope)
Compute resources are generally project-scoped; public-image discovery is region-scoped. Quota allowances may be project- or tenant-scoped. Capacity advice, capacity block groups, and capacity intervals are tenant-scoped. The wrong scope often returns empty lists or permission errors, not a helpful message. Pass -p <profile> explicitly whenever the user names a profile.
Output. Add --format json to API calls and parse that; the default table output is for humans. On paginated list calls, add --all only when --help exposes it. Some list-like commands differ: for example, compute image list-public requires --region and has no --all. Never pass -i/--interactive: it opens interactive entry or alternate-screen pagination and hangs unattended sessions. Never pass --follow (e.g. compute instance logs --follow, logging query --follow): it streams until killed and hangs an unattended session the same way.
Editing. Never run edit or edit-by-name: they open $EDITOR and hang in a non-interactive shell. Use update with explicit flags or update -f <file> instead.
Async operations. Mutations return an operation; by default the CLI blocks until it completes. With --async it returns an operation id — poll with nebius <service> <resource> operation wait <operation-id>.
Safety tiers. Every operation falls in exactly one tier; when a command fits two, the higher (more restrictive) tier wins.
| Tier | Operations | Behavior |
|---|---|---|
| A — read | list, get, get-by-name, batch-get, list-*, logs, --help | Run freely — unless the command emits credential material, which puts it in C whatever its verb. |
| B — gated write | create, update, start, stop, quota/capacity allowance changes | Print the fully resolved command verbatim, state what it changes and the cost implication, wait for explicit user confirmation, then run it exactly once. Never batch mutations; never retry one after an ambiguous failure. A command or rendered template carrying a literal secret is never printed and never run: it accepts key material, so it is Tier C — replace the literal with a secret selector, or hand the command to the human with the value left as a placeholder. |
| C — refuse | delete, purge, credential issuance (iam get-access-token, access keys; sole exception: iam auth-public-key generate is Tier B), any command that emits or accepts token/key material whatever its verb — a raw read whose output carries a token (secret-store payloads, an endpoint spec's auth token) included, -I/--impersonate-service-account-id (a global flag, valid on every command — including otherwise-free reads) | Do not run. Print the exact command for the human to run themselves and explain the blast radius. Exposure is the line, not handling: a credential captured into an unechoed shell variable and consumed inside the same compound command stays at its verb's own tier — what Tier C refuses is the value reaching tool output, the transcript, shell history, or a file. So the endpoint smoke test (`TOKEN=$(… |
Tool errors. Use the nebius-api-debug skill for debug logs and request Trace IDs.
Secrets. Never print or persist tokens, access keys, or the contents of ~/.nebius/credentials.json. Some Tier A reads carry credential material in their output: on a token-auth endpoint ai endpoint get/get-by-name return the bearer token at .spec.auth_token and ai endpoint list returns it for every item it lists, while job and endpoint specs carry plain --env values and registry passwords. Never read those raw — project the fields you need, e.g. | jq '{id: .metadata.id, state: .status.state, urls: .status.public_endpoints}', or | jq '.items[]? | {…}' on a list (the ? matters: an empty list can come back as bare {}, and .items[] on that aborts with "Cannot iterate over null").
Every create / endpoint create below is a Tier B gated write. These recipes show the command chain — they are not a license to skip the gate. For each mutating step: dry-run, state the hourly/daily cost (https://nebius.com/prices), print the resolved command, wait for an explicit yes, run once. docker, aws, and curl are not pre-approved — they go through the normal permission flow. Never leave a job or endpoint in a billable state without telling the user, with its cost.
Conventions below: <reg> = short registry ID (strip the registry- prefix), <subnet> from nebius vpc subnet get-by-name --name default-subnet --format jsonpath='{.metadata.id}', <project> = your project ID. Placeholders like cr.eu-north1.nebius.cloud/e00example/... are examples, not real registries.
Build + push (amd64 mandatory), gate the submit, watch to terminal, collect artifacts from a bucket mount.
# Build + push (linux/amd64 is mandatory — arm64 images fail the pull at STARTING)
docker buildx build --platform linux/amd64 \
-t cr.eu-north1.nebius.cloud/<reg>/train:v1 --push .
# Dry-run first (validates without spending), then gate + submit
nebius ai job create --parent-id <project> --name train-abc123 \
--image cr.eu-north1.nebius.cloud/<reg>/train:v1 \
--platform gpu-h100-sxm --preset 1gpu-16vcpu-200gb \
--timeout 4h \
--volume <artifacts-bucket-id>:/artifacts:rw \
--subnet-id <subnet> --dry-run
# → state cost, confirm, re-run without --dry-run, add --async and capture the id.
# Watch to a terminal state (never --follow — poll)
until nebius ai job get --id <job-id> --format json | jq -er '.status.state|test("COMPLETED|FAILED|CANCELLED")' >/dev/null; do sleep 30; done
Artifacts land in the rw bucket path. Pull them with the AWS CLI against Object Storage (no native nebius storage cp) — see nebius-serverless-data-secrets.
One VM, many GPUs, driven by torchrun. --args splits on spaces (see nebius-serverless-jobs).
nebius ai job create --parent-id <project> --name train-8gpu-abc123 \
--image cr.eu-north1.nebius.cloud/<reg>/train:v1 \
--platform gpu-h100-sxm --preset 8gpu-128vcpu-1600gb \
--container-command torchrun \
--args "--standalone --nproc_per_node=8 /app/train.py --batch-size 64" \
--timeout 24h \
--volume <artifacts-bucket-id>:/artifacts:rw \
--subnet-id <subnet> --async
Multi-node is not supported on Serverless AI — use Managed Slurm (Soperator) or Managed Kubernetes with a GPU node group.
The endpoint gate, cost rule, and smoke test are in nebius-serverless-endpoints; the entrypoint form matters (vLLM's entrypoint is vllm):
nebius ai endpoint create --parent-id <project> --name my-llm \
--image vllm/vllm-openai:latest \
--platform gpu-h100-sxm --preset 1gpu-16vcpu-200gb \
--container-port 8000/http --auth token \
--container-command python3 \
--args "-m vllm.entrypoints.openai.api_server --model /models/ft --host 0.0.0.0 --port 8000" \
--volume <models-bucket-id>:/models:ro \
--env-secret HUGGING_FACE_HUB_TOKEN=<mb-selector> \
--subnet-id <subnet> --async
# → --async returns an operation id; poll and read the URL filtered. The raw get carries the
# bearer token at .spec.auth_token, so never read a token-auth endpoint unprojected:
nebius ai endpoint get --id <endpoint-id> --format json \
| jq '{state: .status.state, urls: .status.public_endpoints}'
Smoke-test the URL before declaring success: the token belongs in an unechoed shell variable, never in the transcript — the variable-only curl form is in nebius-serverless-endpoints.
Keep weights out of the image — mount the bucket ro and load from the mount.
Serverless AI has no array-job primitive, so a fan-out is N creates in a loop — which is exactly the batched mutation Tier B forbids the agent from issuing. So the agent does not run the loop: it produces the parameterized script and states the aggregate cost (N × preset rate × timeout), and the human runs it — the same split as the CI recipe below. The agent still runs single, individually-gated jobs itself.
# Hand this to the user; the agent does not execute the fan-out itself.
for i in $(seq 0 15); do
nebius ai job create --parent-id <project> --name infer-$i-abc123 \
--image cr.eu-north1.nebius.cloud/<reg>/infer:v1 \
--platform gpu-l40s-a --preset 1gpu-8vcpu-32gb \
--timeout 2h \
--env SHARD_INDEX=$i --env SHARD_TOTAL=16 \
--volume <input-bucket-id>:/in:ro --volume <output-bucket-id>:/out:rw \
--subnet-id <subnet> --async &
done
wait # wait for all submit calls to return
Then track the shards (a read, so the agent can do this) with nebius ai job list --parent-id <project> --format json filtered by the infer- name prefix. Alternative that stays a single gated create: one multi-GPU job consuming a manifest.
Checkpoint to a filesystem mount (bucket FUSE mounts choke on the small random writes — see nebius-serverless-data-secrets), and let the job resume on failure:
nebius ai job create --parent-id <project> --name ft-abc123 \
--image cr.eu-north1.nebius.cloud/<reg>/ft:v1 \
--platform gpu-h100-sxm --preset 1gpu-16vcpu-200gb \
--timeout 72h \
--restart-policy on-failure --restart-attempts -1 \
--volume <checkpoint-fs-id>:/ckpts:rw \
--env CKPT_DIR=/ckpts --env RESUME_FROM_LATEST=true \
--subnet-id <subnet> --async
Training code must resume from the newest checkpoint at startup for the restart to help.
--preemptible gets the spot discount but the VM can be reclaimed at any time — only safe when the job checkpoints frequently (every ~5–15 min of compute) and resumes. Not for tight wall-clock deadlines. --preemptible requires a pricing model — one of --follows-spot-price (uncapped, below) or --spot-pricing-policy-id <id> to cap the bid so a price spike preempts rather than overcharges (discover/create policies via nebius billing pricing-policy — see nebius-billing). Same shape as recipe 5, plus those flags:
nebius ai job create --parent-id <project> --name ft-spot-abc123 \
--image cr.eu-north1.nebius.cloud/<reg>/ft:v1 \
--platform gpu-h100-sxm --preset 1gpu-16vcpu-200gb \
--timeout 72h --preemptible --follows-spot-price \
--restart-policy on-failure --restart-attempts -1 \
--volume <checkpoint-fs-id>:/ckpts:rw \
--env CKPT_DIR=/ckpts --env RESUME_FROM_LATEST=true \
--subnet-id <subnet> --async
State the pricing model (uncapped vs capped bid), the live spot price (from the calculator with a spot flag + --preemptible-on-preemption STOP; with a policy, never above its bid), and that each preemption loses progress since the last checkpoint.
Authenticate non-interactively with a service-account key (see nebius-serverless-setup — the agent never generates or echoes the key; a human provisions the SA and stores credentials.json in the CI secret store). This YAML runs in your pipeline, not something the agent executes for you.
jobs:
train:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure non-interactive profile
run: |
printf '%s' "${{ secrets.NEBIUS_SA_CREDENTIALS }}" > "$RUNNER_TEMP/creds.json"
chmod 600 "$RUNNER_TEMP/creds.json"
nebius profile create ci \
--service-account-file-path "$RUNNER_TEMP/creds.json" \
--parent-id ${{ secrets.NEBIUS_PROJECT_ID }}
- name: Build + push (amd64)
run: |
docker buildx build --platform linux/amd64 \
-t cr.eu-north1.nebius.cloud/${{ secrets.NEBIUS_REGISTRY }}/app:${{ github.sha }} \
--push .
- name: Validate then submit
run: |
COMMON="--parent-id ${{ secrets.NEBIUS_PROJECT_ID }} \
--image cr.eu-north1.nebius.cloud/${{ secrets.NEBIUS_REGISTRY }}/app:${{ github.sha }} \
--platform gpu-l40s-a --preset 1gpu-8vcpu-32gb --timeout 1h \
--subnet-id ${{ secrets.NEBIUS_SUBNET_ID }}"
nebius ai job create --name ci-${GITHUB_SHA:0:7} $COMMON --dry-run # fail the build on a bad spec
nebius ai job create --name ci-${GITHUB_SHA:0:7} $COMMON --async
Keep the registry login to the pipeline (per the Nebius Container Registry docs); iam get-access-token stays a human/CI concern, never an agent step.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
nebius, serverless-ai, gpu-training, model-serving, batch-inference, fine-tuning
npx claudepluginhub nebius/skills --plugin nebius-cloud14 skills in this plugin
/nebius-api-debugUse when investigating failed Nebius CLI commands, Terraform provider operations, or SDK calls./nebius-billingNebius billing - resource price estimates and preemptible-VM pricing policies. Use for "how much will this cost", "hourly/monthly price of a GPU VM", "current spot price", "estimate the price", "set a max spot price", "create a pricing policy", "cap my preemptible bid", "list pricing policies", "why is my policy BLOCKED" - nebius billing v1alpha1 calculator estimate for on-demand and live spot prices, and pricing-policy list/create/update/delete for the id behind --spot-pricing-policy-id./nebius-capacity-quotasGPU capacity advice and quota checks for Nebius. Use for "can I launch 8xB200 in us-central1-b", "what GPU capacity is currently advised", "how much quota do I have", "what's in our reservation", or "request a quota increase"./nebius-cloud-basicsFoundation for the nebius CLI. Check before running Nebius CLI commands, or if the CLI is not installed or configured, or a nebius command needs the right profile, --parent-id, or output format, or fails with an unclear error. Public documentation questions do not require CLI setup./nebius-compute-inventoryRead-only inventory of Nebius Compute. Use for "list instances", "show disks", "find the GPU cluster", "which platforms and presets exist", "what images can I boot" - any question about what exists./nebius-compute-provisionGated provisioning for Nebius Compute. Use for "create a VM", "provision a GPU cluster", "launch 8xH200", "resize this disk", "add a filesystem", "stop that instance" - any create, update, start, or stop.Other plugins' skills for the same job