Stop routing vision to text-to-speech models

FixAIService
Shipped
July 18, 2026 at 7:04 PM UTC
Author
Kamo
Commit
027a0dc

Found by probing production: org 1188756624575266822's vision calls resolved to gpt-4o-mini-tts-2025-03-20 — a TEXT-TO-SPEECH model — so every vision call returned 502. Document extraction and any other vision feature have been failing for that tenant. Two independent causes, both fixed: gpt-4o-mini-tts, gpt-4o-mini-transcribe and gpt-4o-mini-search-preview off one prefix, so speech models were recorded as vision-capable. EXCLUDED_PREFIXES did not catch them because it matches startsWith and these are suffixes. ModelModality checks hyphen- delimited modality TOKENS instead, and is a deny-list so a newly-released chat model keeps working. 2. Routing took findFirst() on an unordered query, so which vision model an org got was arbitrary — and it trusted supportsVision, which can be wrong (auto-discovered, and member-editable in the UI). It now rejects non-chat modalities outright and picks deterministically, so the same org resolves to the same model every call. Applied to the chat and text fallbacks too: those also did models.get(0), which could hand a conversation to an embedding or speech model. Also logs the upstream cause on a vision/text failure. It was discarded, so a 502 said nothing about WHY — a wrong model, a rejected key and a network fault looked identical. That cost real time diagnosing this. Existing rows carrying the bad flag still need correcting; discovery no longer writes it.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing