Install
Build the portable CPU CLI with Git and Rust. The repository selects its pinned toolchain.
git clone https://github.com/abird-ai/zerogravity.git
cd zerogravity
cargo install --locked --path crates/zerogravity-cli \
--no-default-features --features cpu,model-qwen35,text,tui,web
zerogravity --helpKeep $CARGO_HOME/bin (usually $HOME/.cargo/bin) on PATH. This build includes CPU text inference, TUI, and Web. Installation downloads no model weights.
GPU backends and the full native build
GPU backends, model acquisition, and serving require the full native build and applicable runtime dependencies. On x86-64 Linux, the default Nix package supplies the native runtime libraries:
nix build .#zerogravity
nix run .# -- --versionSee build instructions and the native package guide for Cargo, Nix, and device requirements.
Prepare the model files
Use a local Qwen3.5 0.8B or 2B GGUF with its matching config.json and tokenizer.json alongside it. All three files must belong to the same model.
model.ggufconfig.jsontokenizer.jsonRun the following commands from that directory, or supply an explicit local path. Model weights retain their own licenses.
Run and inspect
zerogravity run ./model.gguf "Explain Rust ownership." --backend cpu
zerogravity inspect ./model.ggufThe first command runs a prompt on CPU; the second inspects the model. Use zerogravity help run for the installed build's options. Accelerator compatibility is specific to model, source, and device; an explicit backend is satisfied or refused.
Use TUI or Web controls
zerogravity # Native terminal UI
zerogravity web # Open the private URL printed in the terminalBoth interfaces run in the foreground. Keep the terminal process running.
Serve an OpenAI-compatible API
Requires the full native build with the serve feature. The portable install above excludes serving. If the full native executable is on PATH, start it with a compatible local model:
zerogravity serve --model local=./model.gguf --listen 127.0.0.1:8000For the default Nix package on x86-64 Linux, run its packaged launcher from the repository root. Building or running the package does not replace the portable executable on PATH. Replace /absolute/path/model.gguf with your model's absolute path:
nix run .# -- serve --model local=/absolute/path/model.gguf --listen 127.0.0.1:8000Connect with Python
With the OpenAI Python SDK installed, connect to the listener and use its local model alias:
from openai import OpenAI
client = OpenAI(
base_url="http://127.0.0.1:8000/v1",
api_key="local-key", # use the configured key when authentication is enabled
)
models = client.models.list()
response = client.responses.create(
model="local", input="Explain resource ownership briefly.",
store=False, temperature=0, max_output_tokens=64,
)
print(response.output_text)The API is loopback-only. Set ZEROGRAVITY_API_KEY before starting the server to require bearer authentication; use that value in the client. Remote access requires a separately secured proxy and deployment policy. Web control authentication is separate.
Ordinary supported text uses deterministic greedy execution. Unsupported parameters and capabilities are refused. See the endpoint matrix for exact limits.
Use this endpoint with aw, the agent harness you can program live. aw manages context, tools, and workflows; zerogravity runs inference. Follow aw’s setup guide to connect your model.
Operator controls
Use zerogravity help serve for options in your build. Configure limits for the selected model and backend before increasing concurrency.
| Control | Purpose |
|---|---|
--backend | Select a compiled, compatible execution backend. |
--max-context | Configure the serving context limit. |
--max-output | Bound generated output for serving. |
--active-per-worker | Set active-session capacity per worker; this differs from client concurrency. |
--offline | Prohibit model acquisition. Local files and already available cache entries remain usable. |
GET /health | Read native listener diagnostics. |
Foreground serving writes timestamped diagnostics to stderr. TUI and Web hosts keep private JSONL session logs. Use the logging guide for destinations and retention, and the ordinary benchmark client to measure the same public listener.
Rust SDK
Own a Service and use its Client to load models, run requests, and control the stack.
use zerogravity::Service;
let service = Service::embedded().await?;
let zg = service.client();
let source = zg.pull("catalog:qwen3.5-0.8b").await?;
let model = zg.load(source).await?;
println!("{}", model.run("Explain Rust ownership.").await?.text());
service.shutdown().await?;To change execution live, inspect a region, derive a revision, prepare its mapping, compare it against your workload, and activate it for new requests. Existing sessions retain their revision. Use the same operations through MCP to let an agent measure and improve the stack.