Python.
The reference implementation. A local OpenAI-compatible proxy you launch in front of the upstream you already call, plus the controller itself.
Install from PyPI
pip install gubernaut-sdk==1.0.0Adoption
openai.base_url = "http://localhost:8000/v1"This is the only line that changes in your code. The proxy has to be running first.
Free and Apache-2.0, version 1.0.0, running entirely on your machine. View on PyPI
01 · Quickstart
How do I use it once it is installed?
Point your existing client at the local proxy and change nothing else. Every turn then passes the controller, which reads intensity, valence, repetition and holds a posture. A saturating loop is hard-stopped at turn 4.
import openai
from gubernaut_sdk import launch_proxy
# 1. start the governor in front of your upstream
launch_proxy(upstream="https://api.openai.com")
# 2. one line of adoption
openai.base_url = "http://localhost:8000/v1"
# 3. nothing else changes. every turn now passes the controller.
resp = openai.chat.completions.create(
model="gpt-5.6-sol",
messages=[{"role": "user", "content": "hello"}],
)
print(resp.headers.get("x-gcc-posture")) # DEFAULT | INHIBIT | REGROUND02 · Notes
Python specifics
Which attribute do I set?
Set base_url. The pre-v1 openai.api_base attribute is ignored silently by current OpenAI SDKs, so a request configured that way goes straight to the upstream ungoverned and nothing errors to tell you. The proxy listens on port 8000 by default.
Does it work with LangChain and LlamaIndex?
Yes. Both accept a base URL on their OpenAI client, so pointing that at the proxy is the whole integration. Worked demos for LangChain, LlamaIndex and AutoGen ship in the repository under wrappers.
What runs in-process versus over the wire?
The controller decision is in-process and allocation-light. The proxy hop is a local HTTP call. If you only want the decision and not the proxy, the Rust core exposes the controller on its own with no network involved.
03 · Why bother
What does the governor actually save?
On a saturating loop the governed arm cut upstream spend by up to 96%: the best measured case was gpt-5.6-sol at $0.1669 ungoverned to $0.0068 governed, a 95.9% reduction. Across seven model families the reduction ranged 79.8% to 95.9%. Both arms made the same number of attempts, so the delta is the measurement.
Source: Pre-registered receipts benchmark, 2026-07-19. Scored output of harness/report.py.
04 · Other runtimes
Other languages
The same controller ships for three runtimes. They share the deciding core, so a posture decision is identical whichever one you run.
- Rust / WASMgcc-coreThe deciding core with no proxy and no network: a pure state machine you can call directly, or compile to wasm and run at the edge.
- Web3 (npm)@gubernaut/plugin-gccAn ElizaOS plugin for autonomous on-chain agents, where a retry loop does not just cost tokens. It costs gas, every lap, until the wallet is empty.
Last reviewed 2026-08-02 · paper arXiv 2607.24339, DOI 10.5281/zenodo.21303518