Token Optimization
APXY supports three output formats that balance readability with compactness for terminal and automation workflows.
Output formats
| Format | Token Reduction | Best For |
|---|---|---|
| JSON (trimmed) | ~60% | Structured parsing by agents |
| Markdown | ~75% | Human-readable in chat interfaces |
| TOON | ~90% | Large result sets, token-constrained contexts |
Using formats
CLI output supports a format parameter on traffic inspection commands:
# CLI
apxy logs list --format json
apxy logs list --format markdown
apxy logs list --format toonJSON (trimmed)
The default JSON format applies several optimizations:
- Removes noisy headers (e.g., internal proxy headers)
- Masks sensitive header values (Authorization, Cookie)
- Handles binary bodies gracefully
- Trims large bodies to configurable size limits
Markdown
Structured output with tables and fenced code blocks — ideal for displaying in chat interfaces:
| # | Method | URL | Status | Duration |
|---|--------|----------------------|--------|----------|
| 1 | GET | /api/users | 200 | 45ms |
| 2 | POST | /api/auth/login | 401 | 120ms |TOON
Ultra-compact single-line-per-record format designed for maximum token efficiency (~90% reduction):
1|GET /api/users|200|45ms
2|POST /api/auth/login|401|120msTOON is especially useful when you need to review large result sets without a noisy terminal output.
Last updated on