# open_ai: Classify billing and content policy errors \(\#63208\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 3c2848e9195bd50e7d68d858a4b633a22748d5ac

Requested commit: 3c2848e9195bd50e7d68d858a4b633a22748d5ac

Commit: 3c2848e9195bd50e7d68d858a4b633a22748d5ac

Tree: 5d1feaf672121cd96b9fee305a60578b89bf6434

Author: Cole Miller

Committer: GitHub

## Message

```
open_ai: Classify billing and content policy errors (#63208)

OpenAI can return structured provider failures either as Responses
stream events or as non-success HTTP responses. The streaming path
classified the provider's error code, while the HTTP path treated the
body as opaque and classified only its status. As a result, exhausted
credit could look like a retryable rate limit, and prompt policy
rejections looked like generic provider failures.

This change gives billing failures their existing payment-required
category and adds a content-policy category for `invalid_prompt` and
`cyber_policy`. It also parses OpenAI's standard HTTP error envelope and
sends both HTTP and stream failures through the same classifier while
preserving the original status, code, and message. Responses with
another body format retain the previous status-based fallback.

Release Notes:

- N/A
```

## Parents

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

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