# language_models: Skip empty delta text content in OpenAI and OpenAI compatible provider \(\#37626\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 8c9442ad11691004278607d83a4205807c644e82

Requested commit: 8c9442ad11691004278607d83a4205807c644e82

Commit: 8c9442ad11691004278607d83a4205807c644e82

Tree: 4ffbe9f9ea0d366618bf6f873a8ba8c22e3e7a99

Author: Umesh Yadav

Committer: GitHub

## Message

````
language_models: Skip empty delta text content in OpenAI and OpenAI compatible provider (#37626)

Closes #37302 

Related: #37614 

In case of open_ai_compatible providers like Zhipu AI and z.ai they
return empty content along with usage data. below is the example json
captured from z.ai. We now ignore empty content returned by providers
now to avoid this issue where we would return the same empty content
back to provider which would error out.

```
OpenAI Stream Response JSON:
{
  "id": "2025090518465610d80dc21e66426d",
  "created": 1757069216,
  "model": "glm-4.5",
  "choices": [
    {
      "index": 0,
      "finish_reason": "tool_calls",
      "delta": {
        "role": "assistant",
        "content": ""
      }
    }
  ],
  "usage": {
    "prompt_tokens": 7882,
    "completion_tokens": 150,
    "total_tokens": 8032,
    "prompt_tokens_details": {
      "cached_tokens": 7881
    }
  }
}
```

Release Notes:

- Skip empty delta text content in OpenAI and OpenAI compatible provider

Signed-off-by: Umesh Yadav <git@umesh.dev>
````

## Parents

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

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