Skip to main content

nebius-serverless

PyPI Python Docs License

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nebius-serverless 0.2.0
File Size Uploaded Provenance Actions
nebius_serverless-0.2.0.tar.gz 141.9 kB With provenance Details for nebius_serverless-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nebius-serverless 0.2.0
File Interpreter ABI Platform Actions
nebius_serverless-0.2.0-py3-none-any.whl Python 3 none any Details for nebius_serverless-0.2.0-py3-none-any.whl

Total release size: 307.2 kB

Release files / nebius_serverless-0.2.0.tar.gz

Download URL nebius_serverless-0.2.0.tar.gz
Size 141.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c50757c6dc8836604d4ae38d4cefbab117424e869f165a1dac40760b3d864664
BLAKE2b-256 checksum
How to use checksums
8b9fe2924fb9f6e7eacf7df6fad80773b93ac75ab6c5a8e0ab7f7a8fb83a45eb
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 28, 2026.

Transparency log

Release files / nebius_serverless-0.2.0-py3-none-any.whl

Download URL nebius_serverless-0.2.0-py3-none-any.whl
Size 165.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7ff89b8359431dbf9d9a8ec912f6109eaff9de93322111e1871bd59dd3c213e
BLAKE2b-256 checksum
How to use checksums
8812a6383288f731395807824b482ee53639b7fe2329892e1b1908ec3a2679f3
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 28, 2026.

Transparency log

Security for nebius-serverless 0.2.0

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.

Select from 2 files

Attestation for nebius_serverless-0.2.0.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 28, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page