Delete your subprocess wrappers around claude, codex, and gemini. spawnllm subshells all three CLIs plus local MLX and returns one Pydantic-validated Response, so the per-model plumbing you hand-rolled goes away.
Get started
uvx spawnllm status
Driving with an agent? Paste this:
Run `uv add spawnllm` in this project.
Replace our hand-rolled claude/codex subprocess code with spawnllm's `call_sync`,
or `extract_sync` with a Pydantic response model for structured output.
Verify available backends with `uvx spawnllm status`.
Docs: https://yasyf.github.io/spawnllm/
Use cases
Delete your hand-rolled claude/codex subprocess plumbing
Every small tool grows its own subprocess.run(["claude", "-p", ...]) — argv quirks, stdin piping, exit-code guesswork — and each copy drifts. One call replaces all of it:
from spawnllm import call_sync
print(call_sync("Reply with just the word: pong"))
Prints pong. With no backend=, spawnllm auto-selects the first installed, authenticated CLI, pipes the prompt over stdin, and retries transient 529/overloaded/rate-limit failures with capped backoff.
Get a validated Pydantic object back, not a string to parse
Scraping JSON out of a model's stdout means regexes, code fences, and silent schema drift. extract_sync validates instead:
from pydantic import BaseModel
from spawnllm import extract_sync
class Capital(BaseModel):
country: str
capital: str
result = extract_sync("What is the capital of France?", Capital)
print(result.capital) # Paris
The backend turns Capital into a JSON-schema constraint on the call itself, and a non-conforming reply raises pydantic.ValidationError instead of sneaking downstream.
Run Apple-Silicon MLX models with fused adapters and prompt-cache reuse
Shipping a LoRA-tuned local model means hand-rolling adapter fusion, model caching, and worker-thread lifecycle. The MLX extra owns all three:
uv add "spawnllm[mlx]"
AdapterFuser.ensure_fused fuses your compressed adapter into the base model once and caches the result in the Hugging Face hub layout; MlxEngine loads it on a dedicated worker thread, precomputes a prompt cache for your shared prefix messages, and batches generation. Wrap the engine in an MlxBackend and the same run_sync call works.
More in the docs
- Spec-driven runs — a literal model id, per-provider flag passthrough, and envelope-aware retry via
RunSpec— Running reference - Backend selection — the priority chain, plus
specialty=routing (debuggingandreviewgo to Codex,generalto Claude) — Backends reference - Transport helpers —
run_cli,collect_process, andmap_concurrent, the subprocess plumbing shared by every CLI backend — Transport reference - The CLI —
spawnllm call,status, andbackendsfrom any shell — CLI reference - MLX internals — the adapter codec, fuser, and runtime patches behind the local engine — MLX reference
Read the docs for the full guide and API reference. Licensed under MIT.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spawnllm-0.7.0.tar.gz.
File metadata
- Download URL: spawnllm-0.7.0.tar.gz
- Upload date:
- Size: 33.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f76dad3d9ca025ab14cf0d8a3bf4013e6fb778cbfdc64dce0b75ba3b9eab3241
|
|
| MD5 |
2b47f917526ea3199164578513d3cacb
|
|
| BLAKE2b-256 |
a4be8707a91a1cf380e936259141d339c7f20d5acade3cb7442b806d28da055b
|
Provenance
The following attestation bundles were made for spawnllm-0.7.0.tar.gz:
Publisher:
release-pypi.yml on yasyf/spawnllm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spawnllm-0.7.0.tar.gz -
Subject digest:
f76dad3d9ca025ab14cf0d8a3bf4013e6fb778cbfdc64dce0b75ba3b9eab3241 - Sigstore transparency entry: 2192582324
- Sigstore integration time:
-
Permalink:
yasyf/spawnllm@11cfa642dbc49632237195f2abdde2737982f571 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/yasyf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@11cfa642dbc49632237195f2abdde2737982f571 -
Trigger Event:
push
-
Statement type:
File details
Details for the file spawnllm-0.7.0-py3-none-any.whl.
File metadata
- Download URL: spawnllm-0.7.0-py3-none-any.whl
- Upload date:
- Size: 45.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
728b7f40d70b22cb311fbd85f0d7e8132d4bb1bfa44e982b7b856fc94b409580
|
|
| MD5 |
a92416710233d1969415589acec62466
|
|
| BLAKE2b-256 |
9ba8fcaa3fdbb655ae62f77d2e4476fe3e840c2c23e9f7bcc864bb4b4874f893
|
Provenance
The following attestation bundles were made for spawnllm-0.7.0-py3-none-any.whl:
Publisher:
release-pypi.yml on yasyf/spawnllm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spawnllm-0.7.0-py3-none-any.whl -
Subject digest:
728b7f40d70b22cb311fbd85f0d7e8132d4bb1bfa44e982b7b856fc94b409580 - Sigstore transparency entry: 2192582343
- Sigstore integration time:
-
Permalink:
yasyf/spawnllm@11cfa642dbc49632237195f2abdde2737982f571 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/yasyf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@11cfa642dbc49632237195f2abdde2737982f571 -
Trigger Event:
push
-
Statement type: