Skip to main content

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.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 pithio-sdk 0.1.0
File Size Uploaded Provenance Actions
pithio_sdk-0.1.0.tar.gz 1.3 MB With provenance Details for pithio_sdk-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pithio-sdk 0.1.0
File Actions
pithio_sdk-0.1.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for pithio_sdk-0.1.0-cp310-abi3-win_amd64.whl
pithio_sdk-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for pithio_sdk-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl
pithio_sdk-0.1.0-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.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pithio_sdk-0.1.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for pithio_sdk-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
pithio_sdk-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for pithio_sdk-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 24.2 MB

Release files / pithio_sdk-0.1.0.tar.gz

Download URL pithio_sdk-0.1.0.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
efb347bcd7b10fd63aa7ab5c96a942d196b45ab2bff74c0ed08dee2cbbd3ce8d
BLAKE2b-256 checksum
How to use checksums
1a953acd1162bcc08dc20e6a9e848cd68d56c76428054d2575b82d4f88678550
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 log

Release files / pithio_sdk-0.1.0-cp310-abi3-win_amd64.whl

Download URL pithio_sdk-0.1.0-cp310-abi3-win_amd64.whl
Size 4.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
104a575ff714a4d01f14c16a4811961181025a5954b8e3c89aefc18c80db7d86
BLAKE2b-256 checksum
How to use checksums
16a9b40e49b46e26f2bfa3ad6c70a6605867659a59f4f323d3765588a6e1b935
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 log

Release files / pithio_sdk-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL pithio_sdk-0.1.0-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
a22f6243e81dd7ebe861f48f62b52be6ccce2ad5fe526e99a64118967b267058
BLAKE2b-256 checksum
How to use checksums
2a0c08386763fe10b7a83ff86d49e80a65dd8aec2348dc67afd9eeeb142c523b
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 log

Release files / pithio_sdk-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pithio_sdk-0.1.0-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
1348657359af84c36bfe13cf010b675f9f1f890c3be01321cb24b5115810e6c9
BLAKE2b-256 checksum
How to use checksums
090f1098df0e2bd220b8d816c3a4f5e42dd1b1cf04a03e9fe6227f3e8a0e7b76
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 log

Release files / pithio_sdk-0.1.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL pithio_sdk-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Size 4.5 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0b4809ce11b66bd623c3df19d5ea1f7fd363c8db13f172df71dc88b531cf5310
BLAKE2b-256 checksum
How to use checksums
5cf55dd19d4e6c4bdd6cfdb253e51c6bd18aaa3af2830a2d4f2be312633755cc
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 log

Release files / pithio_sdk-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL pithio_sdk-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 4.6 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e9edf67eba1f1c48736d0f20dbfc2473b32842afd7c988d5cf0bbe66b3914f44
BLAKE2b-256 checksum
How to use checksums
18bd02e749fa093fc94a0600200f94dcbe2d35159450d2a3b7af3fc36f288b2a
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 log

Security for pithio-sdk 0.1.0

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 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pithio_sdk-0.1.0.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 log

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.

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