Handling structured JSON output when switching between OpenAI, Anthropic, and local vLLM behind one router
We have a unified gateway (9routerx / OpenAI-compatible proxy) that routes requests across hosted frontier APIs and our internal vLLM cluster.
Regular chat completions swap cleanly, but strict structured JSON outputs (response_format / Pydantic schemas) keep tripping us up whenever a request fails over or switches providers:
- One provider rejects
defaultortitlefields inside strict JSON Schema. - Another requires
additionalProperties: falseon every nested object. - Local
vLLM(xgrammar) handles simple schemas fast, but chokes or stalls on deeply nestedanyOfunions generated by Pydantic v2.
How are teams normalizing Pydantic schemas in one place so structured outputs work predictably across every backend?