Repository navigation
wiretuple v0.1.0
Initial public release of wiretuple, a zero-dependency HTTP reverse proxy written in Go (go 1.23, no external go.mod requirements, single static binary) that cuts LLM Structured Outputs and Function Calling output tokens by 35–60%, losslessly and transparently.
Point OPENAI_BASE_URL or ANTHROPIC_BASE_URL at wiretuple — no changes to application code or prompts.
Highlights
- Protocol coverage: OpenAI
/v1/chat/completions(response_format.json_schema.schema,tools[].function.parameters) and Anthropic/v1/messages(tools[].input_schema), for bothstream: falseand incrementalstream: trueSSE. - Break-even gate: Inspects schemas before compiling; passes small payloads through untouched when net savings stay below
-break-even. - Incremental byte-level rehydrator: Handles split multi-byte UTF-8, escaped quotes/backslashes, nested tuples, and bounded graceful degradation to raw output on shape violations or capture overflow.
- Passive audit (
-shadow): Simulates savings without altering traffic and writes metrics to a zero-dependency SQLite 3 file.
Benchmarks (make bench)
| Scenario | tokens_before | tokens_after | output_savings_% | net_savings_% | p99_overhead_ms | equality |
|---|---|---|---|---|---|---|
| E-commerce invoice line items | 2041 | 801 | 60.8% | 59.2% | 0.095 | OK |
| Dev-tool pull request batch | 1602 | 889 | 44.5% | 43.0% | 0.078 | OK |
| MCP tool invocations batch | 1617 | 711 | 56.0% | 53.7% | 0.084 | OK |
CLI Flags
| Flag | Default | Description |
|---|---|---|
-upstream |
– | Upstream base URL (required) |
-listen |
127.0.0.1:8787 |
Listen address |
-break-even |
5.0 |
Minimum net savings (%) to rewrite a schema |
-legend-tokens |
0 |
Fixed legend cost (0 = estimate from legend) |
-activate |
true |
Master switch for schema rewriting |
-shadow <path> |
– | Passive audit into a SQLite 3 database file |
-max-body |
4 MiB |
Maximum request body size |