nebius-serverless
Unofficial Python client for Nebius Serverless AI: jobs, endpoints, images and tasks. Describe a container workload in Python or YAML, create it on a Nebius GPU or CPU, and wait for it from a script, a notebook, or CI.
Unofficial package. Not an official Nebius product, and Nebius does not support it. For the official Python SDK, see github.com/nebius/pysdk. Report problems in this project's GitHub issues.
Beta. 0.x releases may change the API.
Install
pip install nebius-serverless
Python 3.10 or later. It depends on nebius>=0.6.43,<0.7, PyYAML>=6, and rich>=13. The import name is nebius_serverless.
create() and jobs.get() need a Nebius CLI profile (nebius profile create), or in CI a service account or NEBIUS_IAM_TOKEN (Run in CI). ns.whoami() shows the account, and the project and region create() will use, without creating anything.
Run a job
import nebius_serverless as ns
job = ns.Job(
command=["nvidia-smi"],
image="nvidia/cuda:13.1.1-runtime-ubuntu24.04",
gpu="h100",
timeout="1h",
)
job.dry_run() # the request as data; nothing is created
job.create() # once; sets job.id
job.wait()
job.display()
Building a Job makes no Nebius calls. gpu="h100" asks Nebius for one H100, and Nebius picks the platform and preset in the project's region. On a GPU, jobs run on spot by default: cheaper, but Nebius can preempt them. Pass pricing="on-demand" to avoid that. job.create() creates the job once and returns when Nebius has accepted it. job.wait() polls until the job ends and prints each new state. job.get() fetches once, job.cancel() requests cancellation, and ns.jobs.get(id) reloads a job from a saved id. job.dry_run() returns the request and creates nothing. Logs are nebius ai job logs <id>: this library does not stream them.
To load a job from YAML, reuse it with changes, or save it, use a spec: ns.Job(ns.JobSpec.from_yaml("job.yaml")). See Specs as data.
Run a function as a task
def count_words(text: str) -> dict[str, int]:
"""Count each word in a text. Runs in the job, so it imports there."""
from collections import Counter
return dict(Counter(text.split()))
count = ns.Task(count_words, image="python:3.12-slim-bookworm", timeout="10m")
print(count(text="to be or not to be")) # runs a job, returns the dict
A task runs a Python function as a job and returns what it returned. Reading the result needs Object Storage credentials, and the first run creates the bucket ns-workspace-<project id>: see First task.
Serve an endpoint
An endpoint is a container that stays up and answers on a managed https:// URL. It bills for compute while it runs, until you stop or delete it. On a GPU it runs on spot by default: a preemption stops it, and endpoint.start() runs it again.
endpoint = ns.Endpoint(
image="vllm/vllm-openai:v0.19.1",
command=["bash", "-c", "vllm serve Qwen/Qwen3-0.6B --port 8000"],
gpu="h100",
port=8000,
)
endpoint.dry_run() # the request as data; nothing is created
endpoint.create() # once; sets endpoint.id and endpoint.token
endpoint.wait(probe="/v1/models") # RUNNING, and the server answers
print(endpoint.url, endpoint.token)
endpoint.delete()
Endpoints require a bearer token by default: callers send Authorization: Bearer {endpoint.token}. A random token is generated on create, and endpoint.reveal_token() fetches it again later. For production, keep it in MysteryBox with token_secret=. auth="none" makes a public URL that anyone who has it can call, at your cost.
Documentation
The documentation site is mnrozhkov.github.io/nebius-serverless:
- Quickstarts: install, first job, first endpoint, first image, first task, first Prefect flow, notebooks
- Examples: fine-tuning with Axolotl and a parallel sweep, serving a model with vLLM, batch jobs, a pipeline of tasks, agents
- Integrations: run tasks as a Prefect flow
- Guides: machines, storage, secrets, retries, CI, YAML and the CLI
- Reference: every class, function, and error
The runnable scripts are in examples/, and the pages themselves in docs/.
Work on the client
From a checkout, uv installs the package with the locked dependencies (nebius==0.6.43, PyYAML==6.0.3, rich==15.0.0) and the test and lint tools:
uv sync
uv run pytest
uv run python examples/quickstarts/job_quickstart.py
uv run --group docs mkdocs serve # the documentation site, locally
License
Apache-2.0. Copyright 2026 Mikhail Rozhkov and Evgeny Zholkovskiy. See LICENSE and NOTICE.
Metadata
Release files for nebius-serverless 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nebius_serverless-0.2.1.tar.gz | 124.2 kB | With provenance | Details for nebius_serverless-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nebius_serverless-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for nebius_serverless-0.2.1-py3-none-any.whl |
Total release size: 269.7 kB
Release files / nebius_serverless-0.2.1.tar.gz
| Download URL | nebius_serverless-0.2.1.tar.gz |
|---|---|
| Size | 124.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bdf15524176424cabc77795fc1d259245800b42cd8b4745f5aa1f3aa52fc0584
|
|
BLAKE2b-256 checksum How to use checksums |
099aae3992e15497565ec064f319dc59f7eb445a2064701a6c6e9e5a34910440
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / nebius_serverless-0.2.1-py3-none-any.whl
| Download URL | nebius_serverless-0.2.1-py3-none-any.whl |
|---|---|
| Size | 145.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
791f8c315e143afdb47383486d2f38d59f8a9e1de7bbcee4f503387cc14ca01c
|
|
BLAKE2b-256 checksum How to use checksums |
668cf1afc3c82c4ec76b263837283e1bb06d31df90cec51098acfe48ee6400db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for nebius-serverless 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for nebius_serverless-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.