Skip to content

docs: add Paritok proxy callback integration - #784

Open
illiand wants to merge 1 commit into
BerriAI:mainfrom
illiand:docs/paritok-callback-integration
Open

docs: add Paritok proxy callback integration#784
illiand wants to merge 1 commit into
BerriAI:mainfrom
illiand:docs/paritok-callback-integration

Conversation

@illiand

@illiand illiand commented Aug 5, 2026

Copy link
Copy Markdown

What is Paritok

Paritok is an open-source context-compression layer for LLM agents. Coding agents in particular re-send a large, growing prefix every turn — tool schemas, file reads, tool outputs, prior history — and you pay the upstream provider for all of it on every request. Paritok shrinks that prefix before it leaves LiteLLM:

  • Tool-schema filtering — only the tools relevant to the current turn are sent in full; the rest are stubbed (a large, fixed per-request saving).
  • Content compression — large file reads / tool outputs and old history are compressed by a small open model (the Paritok 4B, self-hostable via Ollama or a hosted GPU endpoint) and replaced with a [REF:id] stub.
  • Non-destructive recall — the model can call a virtual read_original tool to get the exact, verbatim bytes of anything that was shortened, so nothing is permanently lost.
  • Edit recoveryEdit / str_replace calls the model authored against a compressed view are rewritten to match the real file, so exact-match edits still apply.

The net effect: fewer tokens billed upstream and a context window that lasts more turns, with no change to the user's app or agent code.

Why this PR

litellm-paritok is a standard LiteLLM Proxy CustomLogger — it plugs in purely through the documented callbacks: ["module.instance"] mechanism and requires no changes to LiteLLM itself. This PR only adds documentation pointing users at the pip package, so LiteLLM Proxy users can enable compression with a single config line.

How it works (in LiteLLM terms)

  • async_pre_call_hook → filter tools + compress content, return the modified request.
  • async_post_call_success_hook → resolve read_original recall calls and apply edit recovery on the response.

Both are the proxy-only call hooks documented in Custom Callback Class, so the integration is Proxy-scoped (called out on the page).

Changes

  • New page: docs/observability/paritok_integration.md
  • sidebars.js: one line under Callbacks and customization
  • docs/observability/callbacks.md: one bullet under Supported Callback Integrations

Links

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview Aug 5, 2026 7:30pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant