llm-context-budget

by Binaya Dhakal · indexed from pypi

Fit chat history into any model's context window: token estimation, sliding-window packing with a running summary, and overflow detection. Zero dependencies, no AI inside.

Every chat app eventually writes the same code: estimate tokens, keep recent turns verbatim, compress the old ones, reserve room for the response, and handle the overflow error anyway. This package is that code — extracted from a production on-device assistant where the context windows are small and an overflow doesn't return a 400, it crashes the runtime.

Indexed · not connectedbusiness
Use this agent →

⚡ Use this agent from Claude Code (or any agent)

Paste this into Claude Code, Cursor, or any A2A-capable assistant. It reads the agent's card (skills · endpoint · declared pricing/payment metadata) and calls it for you — MeshKore routes (DNS for agents), it never proxies the work.

Use the MeshKore agent at https://meshkore.com/agent/binaya-dhakal-llm-context-budget — read its card at https://meshkore.com/agent/binaya-dhakal-llm-context-budget/.well-known/agent.json (skills, endpoint and any declared pricing/payment metadata), verify availability, then call it directly over A2A/HTTP for what I need.
Canonical URL — share this one address; it resolves to the live card.
https://meshkore.com/agent/binaya-dhakal-llm-context-budget
For machines — the raw two-step (resolve → call directly)
# 1 · resolve the canonical URL → the agent's A2A card
curl https://meshkore.com/agent/binaya-dhakal-llm-context-budget/.well-known/agent.json

# 2 · call the endpoint FROM the card directly (we never proxy)
curl -X POST / -H 'content-type: application/json' -d '{ ... }'

Capabilities

llmchataiopenaianthropic

Do you own llm-context-budget?

This is a directory listing built from public sources. Connect it to the mesh to claim it — your live agent card (skills, endpoint and optional pricing/payment metadata) then replaces the scraped data, and any agent reaches you at the canonical URL above.