Using Visual Token Encoding With Gemini, Grok, and ChatGPT

Developer Guide

Cross-Model Compatibility

All major multimodal LLMs — Claude, Gemini, GPT-5.6, and Grok — can read text from images. The 5×8 bitmap atlas produces clean, high-contrast output that every vision encoder handles well. You can generate your dense PNGs once and use them across all providers.

Gemini 3.1 Pro: Token Efficiency

Google's Gemini models process images differently from Claude. Gemini uses a proprietary vision tokenizer that tends to produce slightly fewer tokens per image tile. In our testing, a 1000×720 pxpipe page costs approximately 1,100 tokens in Gemini versus 1,334 in Claude — making Gemini slightly more cost-effective for image-based workflows.

GPT-5.6: High and Low Detail Modes

OpenAI offers two image detail modes: 'high' and 'low.' In low detail mode, any image costs a flat 85 tokens regardless of content. In high detail mode, the image is tiled similarly to Claude. For dense text reading, high detail is required, but the flat-rate low detail mode can be useful for quick summaries of shorter payloads.

Grok 4.5: xAI Vision Capabilities

Grok 4.5 supports image inputs through the xAI API. While pricing details differ from Anthropic, the same principle applies: dense PNGs pack more data per image token than raw text tokenization. Grok's vision encoder handles the 5×8 atlas cleanly in our testing.

Best Practices Across Models

Keep images under 1500 pixels wide to avoid unnecessary tile splits. Use grayscale PNG format consistently. Include a brief text prompt describing what the image contains — this helps all models orient their reading. Test with a small sample before committing to large batch processing.

Sending a Dense PNG to OpenAI GPT-5.6


from openai import OpenAI
import base64

client = OpenAI()

with open("output_page_1.png", "rb") as f:
    img_b64 = base64.b64encode(f.read()).decode()

response = client.chat.completions.create(
    model="GPT-5.6",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Review this code for security vulnerabilities."},
            {"type": "image_url", "image_url": {
                "url": f"data:image/png;base64,{img_b64}",
                "detail": "high"
            }}
        ]
    }]
)
print(response.choices[0].message.content)

Frequently Asked Questions

Q: Which model reads dense text most accurately?
Claude Sonnet 4.6 and GPT-5.6 both achieve 99.9%+ accuracy on the 5×8 atlas. Gemini is close behind at approximately 99.7%. All are suitable for production use.
Q: Can I mix text and image inputs?
Yes. All models support interleaved text and image content. You can send a text prompt followed by multiple dense PNG pages in a single request.

Conclusion

Visual token encoding is a practical, immediately deployable optimization that works with your existing AI stack. Whether you are a developer building pipelines or a founder managing API budgets, the ~88% input cost reduction compounds into real savings that improve your margins and extend your runway.

Ready to try it? Open PXINK and drop a file to see your savings instantly.

Related Reading

Tags: Claude, pxpipe, token optimization, visual encoding, API, developer tools, LLM, context compression