SDK reference

Three steps to
a governed call

Install the package, set one environment variable, wrap the function.
Every decorator, context, and exception lives in the full reference.

1 · Install

pip install nullrun openai

Pure Python wheel, no native dependencies. The vendor package is yours to choose: swap openai for whichever one the card below names.

2 · Set your API key

Sign in and create a key under Control Center → API keys. Export it once per shell:


export NULLRUN_API_KEY=nr_live_...

NULLRUN_API_KEY is the only required variable.

3 · Wrap a function

Put @protect on any function that talks to a model. The runtime is created lazily from NULLRUN_API_KEY on the first protected call:

from openai import OpenAI
from nullrun import protect, shutdown

client = OpenAI()

@protect
def answer(prompt: str) -> str:
    return client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": prompt}],
    ).choices[0].message.content

if __name__ == "__main__":
    try:
        print(answer("What does NullRun do?"))
    finally:
        shutdown()

Frameworks

Same @protect decorator, whichever framework you call. Install the framework's own package. The SDK attaches to it on the first protected call:

Everything else

The decorator reference, the exception hierarchy, and the env-var reference are in the docs.
The SDK is Apache-2.0 — pin the version while it is in alpha.

    SDK reference