pithio for Python
Shorter context for AI applications, without losing the answer. Runs on your machine; whatever is removed can be fetched back.
import pithio
r = pithio.compress(document, "Which law governs the agreement?", mode="text", keep=0.5)
print(r.ratio, r.tokens_in, r.tokens_out) # achieved compression and o200k token counts
print(r.text) # the most relevant paragraphs, verbatim; removed parts marked
pithio.more(r.handle) # the original, page by page
mode="text": documents and retrieved passages; keeps the paragraphs most relevant to the query.mode="auto": detects JSON, CSV, logs, test runs, web pages and prose, and uses the method made for each.compress_messages(messages): shortens the tool results inside an OpenAI or Anthropic chat request.
Agents on the Anthropic or OpenAI SDK: one line
import anthropic, pithio
client = pithio.wrap(anthropic.Anthropic()) # also openai.OpenAI() and the async clients
# in your tool loop, before your own tools:
result = pithio.handle_tool_call(block.name, block.input)
if result is not None:
... # send it back as that tool call's result
Every messages.create, chat.completions.create and responses.create request has its tool results shortened (the tool call that
produced each is its query); nothing else in the request changes, and the same input always gives the same bytes, so
the provider's prompt cache keeps working. Requests with tools get a pithio_more tool through which the model fetches
anything that was removed. Each call's usage and the request's make-up (token counts, never text) go to
~/.pithio/calls.jsonl: pithio diagnose --source api and the dashboard's Bill tab show where the money goes.
Replies, streamed or not, are returned unchanged. Not covered yet: the SDKs' messages.stream() / responses.stream() helpers.
Integrations: pithio.integrations.langchain.PithioCompressor (a document compressor for retrievers),
pithio.integrations.llamaindex.PithioNodePostprocessor, pithio.integrations.litellm.PithioGuardrail (a LiteLLM
proxy hook that shortens tool results before each model call).
Metadata
Release files for pithio-sdk 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 | Actions |
|---|---|---|---|---|
| pithio_sdk-0.1.2.tar.gz | 1.3 MB | With provenance | Details for pithio_sdk-0.1.2.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pithio_sdk-0.1.2-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for pithio_sdk-0.1.2-cp310-abi3-win_amd64.whl |
| pithio_sdk-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details for pithio_sdk-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl |
| pithio_sdk-0.1.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details for pithio_sdk-0.1.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| pithio_sdk-0.1.2-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64, macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64) | Details for pithio_sdk-0.1.2-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl |
Total release size: 24.2 MB
Release files / pithio_sdk-0.1.2.tar.gz
| Download URL | pithio_sdk-0.1.2.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e01bf951f07970d167ad35befdc14c83caf0a9412ad8955aa65b5bd7901d506b
|
|
BLAKE2b-256 checksum How to use checksums |
6a11c706bf511fb460f33f5911cf6d49d24b313d9787b176248873566b0655f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 3, 2026.
Transparency logRelease files / pithio_sdk-0.1.2-cp310-abi3-win_amd64.whl
| Download URL | pithio_sdk-0.1.2-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
49df0e0803cd28db9317616c7346e5f1c9bb51a12083c99d69af26905f998b44
|
|
BLAKE2b-256 checksum How to use checksums |
6e5ff62f0635c28007f0c61c5bddbc0007b1a619d600abb7a1863d9c2967dce8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 3, 2026.
Transparency logRelease files / pithio_sdk-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | pithio_sdk-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 4.7 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
7bdce21cc84f97e884984bac6004d5aa1e3129036ef81a6bec20d0f0ea6b97e6
|
|
BLAKE2b-256 checksum How to use checksums |
83a89392546066fd8a00a6bf34b914bb8ddbf6b3d5b7194e2d7f4ee997eef7a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 3, 2026.
Transparency logRelease files / pithio_sdk-0.1.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | pithio_sdk-0.1.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5a5e4038a8e21011a4cd08d920b61774816531177076e9fd3f2c30464d12ab6d
|
|
BLAKE2b-256 checksum How to use checksums |
0c1508d772e16841e481b09931a7c5d6d1d6be53f928807b386ab1338f32ef19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 3, 2026.
Transparency logRelease files / pithio_sdk-0.1.2-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
| Download URL | pithio_sdk-0.1.2-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl |
|---|---|
| Size | 9.0 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bd4ade408dbff89e8cb946ec8c0fab3994c1acaf1e172e32114a817342d8ffaa
|
|
BLAKE2b-256 checksum How to use checksums |
feb30dfce1b0cf6ef59d5e667d6d126b01aec7c548ef65e52615d25d57e1409b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 3, 2026.
Transparency logSecurity for pithio-sdk 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.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for pithio_sdk-0.1.2.tar.gz
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 Dec 3, 2026.
Transparency logA 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.