Skip to main content

promptkit-claude

Token-efficient prompting and agentic workflows for Claude.

Install

pip install promptkit-claude

Quick Start — Offline (no API key needed)

from claude_kit.compress import compress
from claude_kit.templates import summarize

# Remove filler phrases from any prompt (no API key needed)
prompt = compress("Please carefully analyze the following and provide a detailed summary")
# → "analyze the following and provide a summary"

# Build a token-efficient prompt
prompt = summarize(document, format="bullet", max_bullets=5)

Quick Start — With API Key

from claude_kit.cache import CachedClient

client = CachedClient()

# NOTE: First call warms the cache — expect 0% hit rate.
# Subsequent calls with the same system prompt hit the cache.
response = client.message(
    system="You are a helpful assistant with a long system prompt...",
    user="Hello!",
    cache_system=True,
)

print(client.cache_stats())
# → {"cache_hit_rate": "74%", "tokens_saved": 1840, "savings_usd": "$0.0023"}

Session Cost Tracking

from claude_kit.tracker import Tracker

with Tracker() as tracker:
    response = tracker.client.messages.create(
        model="claude-sonnet-4-5",
        max_tokens=1024,
        messages=[{"role": "user", "content": "Summarize quantum computing."}],
    )

print(tracker.summary())
# → {"input_tokens": 12, "output_tokens": 340, "total_cost_usd": "$0.0014"}

Agent Composition

from claude_kit.agent import Chain, Retry

# Chain: pipe output of one prompt into the next
result = Chain([
    "Summarize this document: {input}",
    "Extract action items from: {input}",
]).run(input=document)

# Retry: retry on failure with exponential backoff
safe_call = Retry(max_attempts=3).wrap(client.message)
response = safe_call(user="Tell me a joke.")

Async Support

from claude_kit.cache import AsyncCachedClient

client = AsyncCachedClient()

async def main():
    response = await client.message(
        system="You are a concise assistant.",
        user="What is 2 + 2?",
        cache_system=True,
    )
    return response

CLI

promptkit-claude compress "Please carefully explain this in detail"
# → "explain this in detail"

Modules

Module What it does Needs API key?
compress Removes filler phrases from prompts No
templates Token-efficient prompt templates No
tracker Session cost tracking Yes (wraps SDK)
cache CachedClient with cache_control Yes
agent Chain / Retry / Fallback / Parallel Yes

Versioning

We follow semver. Patch: bug fixes. Minor: new APIs, backwards compatible. Major: breaking changes with migration notes in CHANGELOG.

v0.2 Roadmap

  • Fallback and Parallel agent primitives with full test coverage
  • cache_tools support in CachedClient for tool-use payloads
  • templates.classify() and templates.extract() for common extraction tasks
  • Token budget warnings and hard caps via Tracker
  • Rich CLI output with cost breakdown per call
  • LangChain and LlamaIndex adapter shims

Metadata

Release files for promptkit-claude 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for promptkit-claude 0.1.0
File Size Uploaded
promptkit_claude-0.1.0.tar.gz 27.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for promptkit-claude 0.1.0
File Interpreter ABI Platform
promptkit_claude-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.1 kB

Release files / promptkit_claude-0.1.0.tar.gz

Download URL promptkit_claude-0.1.0.tar.gz
Size 27.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9b6d545882954ebe4a29f0e835fdcebe6d06464b6538e71bccfa5a0c9d97f835
BLAKE2b-256 checksum
How to use checksums
49dba959da029f1fa060742a4d1d675f6769c76ac1dd815f8668d8cf995d00b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release files / promptkit_claude-0.1.0-py3-none-any.whl

Download URL promptkit_claude-0.1.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
420c06ee92c020cd4e539b5900277653155d3607d9840fe867bb3a351b9e03f2
BLAKE2b-256 checksum
How to use checksums
bcd4eaf5c1896cd8c1c06b22d24a597c8873842e4dbfbe788b837f2d4e86767b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release 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