Skip to Content
Advanced FeaturesToken Optimization

Token Optimization

APXY supports three output formats that balance readability with compactness for terminal and automation workflows.

Output formats

FormatToken ReductionBest 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 flag on traffic inspection commands such as apxy logs list. See CLI Reference → Traffic for each subcommand’s supported formats.

Quick example:

apxy logs list --format toon

JSON (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

When an AI agent reads traffic, APXY also masks passwords, emails, and other secrets. See AI Data Redaction.

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|120ms

TOON is especially useful when you need to review large result sets without a noisy terminal output.

Last updated on