Developer docs / AI Fabric / Getting started Waitlist

Get started with AI Fabric.
Your first function on a GPU.

Write plain Python, mark the function that needs a GPU, and run it on the fleet. Four steps, about five minutes.

How AI Fabric works

You keep your code. AI Fabric packages it, schedules it on a GPU of the fleet and streams the logs back to your terminal. Three words cover it:

App
The deployed unit, versioned, with its own endpoints.
Function
An invocable entry point that belongs to an app.
Run
One execution: the compute that uses GPU time.

1. Install the SDK

The client is bladekit on PyPI, installed with plain pip. Use Python 3.12 locally: blade run sends your arguments as pickled payloads, so your interpreter must match the fleet’s images (fabric/base, fabric/torch).

Terminal · Install
pip install bladekit

2. Connect this machine

Run this once per machine. It opens your browser to create an API token bound to your account, then stores it locally.

Terminal · Connect
blade setup --api-url https://cp.run.blade.sh

3. Write your first function

Save this as hello.py. The @app.function decorator marks the code that runs remotely; square.remote(42) sends the call to the fleet and waits for the result.

hello.py
import bladekit

app = bladekit.app("hello-gpu")

@app.function(gpu="RTX-A4500", image="fabric/base")
def square(n: int) -> int:
    return n * n

@app.local_entrypoint()
def main():
    result = square.remote(42)
    print(f"42² = {result}")  # runs on a GPU, the result comes back locally

4. Run it

Terminal · Run
blade run hello.py

AI Fabric packages your code, sends it to the scheduler and streams the logs back. The first run takes about 30 seconds while the image boots; later runs on the same warm container start immediately.

See the GPU at work

This script estimates π by Monte Carlo: the same computation on a CPU, then on a GPU of the fleet, timed. It uses the fabric/torch image, which ships PyTorch. Save it as get_started.py and run blade run get_started.py.

get_started.py
import bladekit

app = bladekit.app("example-get-started", image="fabric/torch")


@app.function(gpu="RTX-A4500")
def pi_benchmark(n: int = 200_000_000) -> str:
    """Estimate π by Monte Carlo: the same work on CPU, then on the GPU, timed."""
    import time

    import torch

    def estimate(device: str):
        if device == "cuda":
            torch.cuda.synchronize()
        t = time.perf_counter()
        x = torch.rand(n, device=device)
        y = torch.rand(n, device=device)
        inside = ((x * x + y * y) <= 1).double().mean().item()
        if device == "cuda":
            torch.cuda.synchronize()
        return 4 * inside, time.perf_counter() - t

    _, cpu = estimate("cpu")
    pi, gpu = estimate("cuda")
    return f"pi~{pi:.5f}, CPU {cpu:.2f}s vs GPU {gpu:.3f}s -> {cpu / gpu:.0f}x faster"


@app.local_entrypoint()
def main():
    print(pi_benchmark.remote())

It prints the estimate and how much faster the GPU was. The first run pulls the PyTorch image, so give it a minute.

Bring your own workload.

The same decorators serve a model behind a web endpoint, run batch jobs over many inputs, schedule work and open sandboxes for agents. Prepare your model, its dependencies and a representative request before onboarding.

Join the AI Fabric waitlist. If you need a hosted model API now, get started with Models.

Checked on against the console’s AI Fabric getting started and quick start. GPU classes, images and limits are confirmed when your access opens.

Contact the team

Loading the form…