Strata runs Mixture-of-Experts models larger than your RAM by keeping a budget of experts resident and streaming the rest from SSD. Install it once, then use it two ways: as a Python library inside your app, or as a CLI / OpenAI-compatible server.
One install gives you both the strata Python library and the strata command-line tool. The [mlx] extra pulls in the Apple-Silicon runtime.
pip install 'amperor-strata[mlx]'Contributors / from source: git clone https://github.com/amperor-org/amperor-strata then pip install -e 'packages/strata[mlx]'.
After installing (above), import Strata and load a model bigger than your RAM — experts stream from SSD under the budget you set. This is the way to run a large local model inside an app on a machine that can’t hold it.
# pip install 'amperor-strata[mlx]'
import strata
# GLM-4.5-Air is ~60 GB on disk — load it under a 16 GB budget
model = strata.load("mlx-community/GLM-4.5-Air-4bit", target_ram_gb=16)
# one call, returns the full completion
print(model.generate("Explain how a CPU pipeline works.", max_tokens=256))
# or stream tokens as they arrive
for piece in model.stream("Write a haiku about caches"):
print(piece, end="")Measured on a 128 GB M5 Max: that ~60 GB model loads and generates at a ~11.5 GB peak under target_ram_gb=16 (peak scales with the budget you pick).
strata.load(
model, # HF repo id or local MLX dir
target_ram_gb=None, # fit the working set into N GB (default: this machine)
budget=None, # or set resident experts/layer directly
store_dir=None, # paged-store location (default: ~/.cache/strata/…)
policy="none", # routing/paging policy: none|warm|cache|hybrid
) -> Strata
Strata.generate(prompt, *, max_tokens=256, temperature=0.0) -> str
Strata.stream(prompt, *, max_tokens=256, temperature=0.0) -> Iterator[str]The same install gives you the strata command. Use it to benchmark a model on your machine, or to serve it behind an OpenAI-compatible endpoint.
Downloads the model, builds its expert store once, and reports fit + throughput + fidelity. --target-ram previews a smaller device.
strata bench --model mlx-community/Qwen3-30B-A3B-4bit
strata bench --model mlx-community/Qwen3-30B-A3B-4bit --target-ram 16Binds 127.0.0.1:8399 and exposes the API under /v1. The config is a flat key: value file (produced by strata optimize): model, store, expert_budget are required; policy / prefetch optional.
strata serve --config strata-deployment.yaml --host 127.0.0.1 --port 8399Point base_url at the server — no code changes, no custom SDK. No API key is required (pass any placeholder).
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8399/v1", api_key="strata")
resp = client.chat.completions.create(
model="strata", # the server serves its configured model
messages=[{"role": "user", "content": "Explain a CPU pipeline."}],
max_tokens=256,
)
print(resp.choices[0].message.content)CORS is open; the server is batch-1 and unauthenticated — put it behind your own gateway beyond a trusted network.
strata <command> --help for flags. Every result carries full provenance — see the methodology and the JSON schema.
Source-available under BSL 1.1 (becoming Apache 2.0 on 2030-08-04). Free for non-production use; production/commercial licensing: licensing@amperor.ai.