NULL Trim Guide (50–85% Token Saver)
NULL Trim deterministically compresses bloated JSON, noisy server logs, CSV tables, and Markdown/text before you send context to an LLM—reducing input token usage by 50–85% with zero LLM calls and exact before/after token telemetry (1 credit per compression).
Deterministic Zero-LLM Compression: No foundation model is called during compression. Keys, repeated log frames, and whitespace boilerplate are compacted in milliseconds with exact
tokens_before, tokens_after, and savings_percent returned.
REST API: POST /v1/trim
curl -X POST https://api.nullpk.com/v1/trim \
-H "Content-Type: application/json" \
-H "Authorization: Bearer nullpk_live_your_key" \
-d '{
"content": "...",
"mode": "auto",
"max_tokens": 1200,
"query": "error timeout",
"json_format": "auto"
}'
Compression Modes & Parameters
auto(default): Auto-detects JSON, server logs, CSV, Markdown, or plain prose.json: Prunes noisy metadata/null/empty fields, supportskeep_keysanddrop_keys, and converts uniform object arrays to compacttsvorcompact_json(controlled byjson_format).logs: Deduplicates repeated log lines, strips verbose timestamps/boilerplate, and prioritizes lines matchingquery.csv: Trims redundant columns/whitespace and preserves header + high-signal rows withinmax_tokens.markdown/text: Strips decorative formatting, collapses whitespace, and ranks sections byqueryrelevance.
MCP Tool: nullpk_trim_context
Available natively on our Streamable HTTP MCP endpoint (https://api.nullpk.com/mcp) and via @nullpk/mcp-server. Pass content and optional mode, max_tokens, query, keep_keys, drop_keys, or json_format.