Skip to content

How It Works

diegosouzapw edited this page Jul 8, 2026 · 1 revision

How It Works

OmniGlyph sits between your client and the provider. For each request it decides, block by block, whether rendering that block as an image would cost fewer tokens than sending it as text — and whether the target model can actually read it.

flowchart TD
    A[Incoming request] --> B[Split into blocks:<br/>system prompt · tool docs · history · large tool outputs]
    B --> C{Profitability gate<br/>exact billing math}
    C -->|image tokens < text tokens| D{Model gate<br/>fail-closed}
    C -->|text is cheaper| P[Keep as text]
    D -->|approved reader| E[Reflow + render<br/>1-bit 5×8 glyph atlas]
    D -->|unapproved model| P
    E --> F[Standard 1568×728 PNG pages]
    F --> G[Splice pages back in<br/>cache-friendly order]
    G --> H[Forward to provider]
    P --> H
    H --> I{Model refused the page?}
    I -->|yes| J[Replay original request as text]
    I -->|no| K[Stream response through untouched]
Loading

The two gates

1. Profitability gate

Computes the provider's exact image billing (see Billing Math) and converts a block only when the image token count is strictly lower than the text token count. A block that would cost more as an image stays text.

2. Model gate (fail-closed)

Only models that passed the reading benchmark receive images. The default is closed: an unknown or unproven model never gets an image, so a model that would silently misread a page can't. Approvals and blocks are backed by receipts:

Model Status Evidence
Claude Fable 5 ✅ approved 100% exact reads at production density
Opus 4.8 ⚠️ opt-in safe mode reads 77–87% only at 4× glyph size
GPT-5.5 ⛔ blocked 0/60 exact reads
Gemini 2.5-flash ⛔ blocked confabulates instead of abstaining

Rendering

Text is reflowed and drawn with an in-house 1-bit 5×8 glyph atlas (derived from Spleen/Unifont) onto standard-tier 1568×728 pages. The high-resolution tier is deliberately not used — it is a measured billing trap (billed full-size, but the vision encoder never receives the extra resolution).

Safety properties

  • Request-side only — model responses stream back untouched.
  • Local-first — nothing extra is sent to any third party.
  • Byte-exact values ride as text — hashes, IDs, and numbers are never trusted to an OCR round-trip.
  • Abstention over confabulation — a failed read abstains; zero silent confabulations across ~300 probes.
  • Refusal retry — if a model refuses the rendered page, the original text request is replayed automatically.

See ARCHITECTURE.md for the code-level map.

Clone this wiki locally