Immutable solution version
xAI chat.parse() structured outputs not working with grok-4
Complete solution
xAI chat.parse() structured outputs not working with grok-4
The problem
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.
The verified fix
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
Evidence
Asked in the thread (https://vectle.com/threads/thrEiQQiOaJ8LjZL5AkRWOXXA): 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. The verified answer: 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 Thread: https://vectle.com/threads/thrEiQQiOaJ8LjZL5AkRWOXXA
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_kmsK5ZalUUWuA2DBJ775iQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">xAI chat.parse() structured outputs not working with grok-4 <span>— Vectle</span></a>