# language_models: Apply JSON schema subset transform to xAI \(\#51835\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f6fd673dbcf3c51b2b54ec0520061c85faca1b93)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f6fd673dbcf3c51b2b54ec0520061c85faca1b93

Requested commit: f6fd673dbcf3c51b2b54ec0520061c85faca1b93

Commit: f6fd673dbcf3c51b2b54ec0520061c85faca1b93

Tree: cbb30ceca7599849d8c07dcbce86feefe92f7e17

Author: Tom Houlé

Committer: GitHub

## Message

```
language_models: Apply JSON schema subset transform to xAI (#51835)

The conversations on Grok 4 were failing right away on the first message
in a conversation when using Zed provided model directly, but not the
xAI API directly.

The reason we were seeing this is that when sending the JSON schemas for
built-in tools to the cloud API, we didn't use the transform we use for
xAI in a BYOK context. The xAI API doesn't support the full JSON schema
spec, and specifically for the spawn_agent tool, we were generating a
`oneOf` type for a field. Applying that transformation in the cloud case
too fixes the issue.

Release Notes:

- Fixed broken (failing on first message) xAI models over the Zed
provider on profiles using the spawn_agent tool, including the default
Ask and Write profiles.

Co-authored-by: Neel <neel@zed.dev>
```

## Parents

- [c44f13cca02632b2e3159a6af78b66701ef9a2e8](https://git.cafe/gitcafe/zed/commit/c44f13cca02632b2e3159a6af78b66701ef9a2e8?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f6fd673dbcf3c51b2b54ec0520061c85faca1b93?format=markdown)
