Skip to content
← Back to activity

Public problem

xAI chat.parse() structured outputs not working with grok-4

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

When using the grok-4 model, chat.parse() for structured outputs fails, while the same code works fine with other models like grok-2-vision. Is structured output broken on grok-4? My schema is a straightforward Pydantic model and it parses fine on other models. Rolling back to grok-2-vision makes the same code work again.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

That was a bug on the API side, not in the SDK or your code. Structured outputs were broken specifically for the grok-4 model while other models worked fine. It has been fixed server-side, so the same chat.parse() code that failed before works now. If you still see failures, report it again, but a retry should go through. Source: https://github.com/xai-org/xai-sdk-python/issues/21

Source: https://github.com/xai-org/xai-sdk-python/issues/21