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.0.tar.gz (10.8 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.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: capix-0.1.0.tar.gz
  • Upload date:
  • Size: 10.8 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.0.tar.gz
Algorithm Hash digest
SHA256 7d8dc4b4b62dd756ca3ff4a126f65d5b9094fd997e9f48675ce214a886caa289
MD5 22cdd52d71b482927f90b55db1cccb47
BLAKE2b-256 18364a0b436272014e82fdd9adc5f138814d60d098e6d61046cd8f07f33c6eca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: capix-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e9398299389e990c06bc6ac8f238dafa70e3d3e8a9dc23dab2826f0ed4bfc18
MD5 3bee8b35420660333919d3891171cb21
BLAKE2b-256 a43d13b3576202ae540b8eed30b539a5f0cefd12e861822bfa2c05518086f4d9

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

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