capix
A thin, stateless wrapper around the Claude Messages API. Send a prompt, get text back — no conversation history, no session state.
Install
uv tool install capix # global CLI
pip install capix # or into a project, for the library
uvx capix "hello" # or run it without installing anything
Set ANTHROPIC_API_KEY in your environment, or put it in a .env file in the
directory you run from — the CLI loads .env automatically.
Developing on it
Managed with uv. Install it once
(curl -LsSf https://astral.sh/uv/install.sh | sh), then:
uv sync # creates .venv and installs the project
cp .env.example .env # then paste your key into .env
uv sync reads uv.lock, so everyone gets the same dependency versions. After
editing [project.dependencies], run uv lock (or just uv sync, which
re-locks when pyproject.toml changed) and commit the updated lockfile.
.env is gitignored. The key is read from the environment by the Anthropic SDK;
the CLI loads .env into the environment first. An exported
ANTHROPIC_API_KEY in your shell takes precedence over the one in .env.
Note that loading .env is CLI-only. Imported as a library, capix reads the
real environment and never touches .env — loading it would be a surprising
side effect in someone else's application.
.env also accepts ANTHROPIC_MODEL to set the default model for every call.
CLI
capix "explain CRDTs in two sentences"
capix -e low "what's the capital of France?"
cat notes.md | capix "summarize this"
From a source checkout, prefix with uv run (uv run capix "...") — that
works without activating anything.
Output streams as it arrives. Options:
| Flag | Meaning |
|---|---|
-v, --version |
Print the installed version and exit |
-s, --system |
System prompt |
-m, --model |
Model id (default: ANTHROPIC_MODEL, else claude-haiku-4-5) |
-t, --max-tokens |
Output ceiling (default 16000) |
-e, --effort |
low … max; only on models that support it (see below) |
--no-stream |
Wait for the complete response, then print |
python -m capix "..." works the same way.
Library
from capix import ask
answer = ask("explain CRDTs in two sentences")
# With a system prompt and cheaper settings
answer = ask("classify: positive or negative?\n\nthis is great", system="Reply with one word.", effort="low")
# Print tokens as they arrive
ask("write a haiku", on_text=lambda chunk: print(chunk, end="", flush=True))
ask_message(...) returns the full message object instead of a string, if you
need usage, stop_reason, or the raw content blocks.
Choosing a model
Resolution order for every call: explicit model= / -m → ANTHROPIC_MODEL
→ the built-in claude-haiku-4-5.
| Id | Notes |
|---|---|
claude-haiku-4-5 |
the default; fastest and cheapest, 200K context |
claude-sonnet-5 |
near-Opus quality, 1M context |
claude-opus-5 |
strongest for coding and agentic work |
claude-fable-5 |
most capable overall, priced above Opus |
Not every model takes the same parameters, so the wrapper sends them
conditionally (see THINKING_MODELS / FALLBACK_MODELS in client.py):
- Adaptive thinking and
--effortare sent only to Sonnet 4.6+/Opus 4.6+ and the 5-series. Haiku 4.5 rejects both, so they are omitted for it — passing--effortwith such a model raises aValueErrorup front rather than letting the API 400. - Server-side refusal fallbacks are sent only to Opus 5, Fable 5, and Mythos 5, whose safety classifiers can decline a request. Other models don't accept the parameter.
Both sets are plain frozensets — extend them as new models ship.
Notes
- Context-free by construction. Each call builds a fresh
[{"role": "user", ...}]array. The Messages API is stateless, so there is nothing to clear between calls. - Always streams internally, even when you don't consume the chunks — this keeps long responses from hitting request timeouts.
- Refusals raise
RefusalErrorrather than returning empty text.
Releasing
Published to PyPI from the command line with twine — see RELEASING.md.
Unofficial
capix is a personal, unofficial client. It is not affiliated with or endorsed
by Anthropic. "Claude" is a trademark of Anthropic, PBC.
Metadata
Release files for capix 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| capix-0.1.2.tar.gz | 11.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| capix-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.7 kB
Release files / capix-0.1.2.tar.gz
| Download URL | capix-0.1.2.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f8b64f9cc72ebf7bffe85e43ad0966d78f172017d4135a1fc938c3a903fbba6
|
|
BLAKE2b-256 checksum How to use checksums |
c856151612a68e12c5e8f16360daca4d323b353d97f90e16c4fc8497ddcf0493
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / capix-0.1.2-py3-none-any.whl
| Download URL | capix-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
745f4987bd812540684cf9fa09f5b0eb47c62a3c24e0a9b372d9f8bbb39ef1d6
|
|
BLAKE2b-256 checksum How to use checksums |
83582b210783baa33774921134994db47ee47add375f2f8d037f0052ad5c20db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for capix 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.