From Python to remote compute
Install bladekit, connect the CLI to your account, and use the reference to build functions, endpoints and GPU workloads.
pip install bladekit
blade setup --api-url https://cp.run.blade.shAI Fabric access is opening gradually. Use an account with AI Fabric enabled to run these examples.
Core API
App & decorators
Construct a bladekit.app and register remote work with @app.function, @app.cls, @app.method and the @bladekit.enter() lifecycle hook.
Functions & calls
Invoke registered functions with .local(), .remote() and .spawn(), fan out over the fleet with .map()/.starmap(), and reach deployed endpoints via Function.from_name().
Serving & autoscaling
Web endpoints
Expose functions and long-lived servers over HTTP: per-request handlers, mounted ASGI apps, in-container web servers, and the per-replica concurrency ceiling.
Autoscaling
Replica bounds, concurrency, scale-to-zero, the ingress queue bound and the autoscaling-v2 policy knobs (target_inputs, buffer_replicas, vllm_target_waiting, scaledown_window, reserved_replicas) shared by every endpoint decorator.
Images & storage
Images
bladekit.Image: a chained, immutable image-definition DSL — catalog and registry bases, apt/pip/env/run layers, and the content hash that drives idempotent builds.
Volumes
Named network volumes for persisting data across runs — mount by path, and publish a container's writes as a new generation with commit().
Secrets
Named, encrypted key-value bundles referenced by name and injected as environment variables at run time.
Primitives
Sandboxes
Imperative GPU/CPU container primitive: create a sandbox, exec commands, stream output, read and write files, open tunnels, and terminate.
Cron schedules
Declare a UTC cron schedule on a function with bladekit.Cron and trigger it automatically once the app is deployed.
Queues & Dicts
Distributed FIFO queue and key-value store, persistent on the control plane, for coordinating producer/consumer functions and sharing state between workers.
Resilience & errors
Preemption & checkpoints
Handle preemption of interruptible GPUs with the on_preempt hook, durable checkpoints on a Volume, and the preemption budget on functions and classes.
Exceptions
The full AI Fabric exception hierarchy — platform/API errors, run-level infrastructure failures, and the wrapper for exceptions raised by your own remote code.
CLI & configuration
Reference from the Blade console · Updated .