Skip to main content

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
-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 lowmax; 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= / -mANTHROPIC_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 --effort are 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 --effort with such a model raises a ValueError up 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 RefusalError rather 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

capix-0.1.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

capix-0.1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file capix-0.1.1.tar.gz.

File metadata

  • Download URL: capix-0.1.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for capix-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0374f5ba722544f353011d275a3368d26165037adfd0748817083e50b6c0d657
MD5 c3f3c87270fb42d3e3fa595d5e811aa5
BLAKE2b-256 6c4a40d175ec8fc91c576bc62e6d73ffabaf3a06f4af059702b8a53a7fd605cc

See more details on using hashes here.

File details

Details for the file capix-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: capix-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for capix-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 229ceba26fe074e55720bdf947541e1d311b277beb395823cf8ef4362264230a
MD5 ef8a66ad26462faa9c0f60704d292a5a
BLAKE2b-256 7a6c9ea4ffd176ae2b75ff508af51e133f2ca9f902afb2f66e13a3ed6c546f18

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page