# anthropic: Classify exhausted credits as payment required \(\#63988\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 7e0b34bad6b9576a92c4c7fb47108856d4b3cd64

Requested commit: 7e0b34bad6b9576a92c4c7fb47108856d4b3cd64

Commit: 7e0b34bad6b9576a92c4c7fb47108856d4b3cd64

Tree: f9f32eb2c01a55be0389549aff6c46291c526379

Author: Conrad Irwin

Committer: GitHub

## Message

```
anthropic: Classify exhausted credits as payment required (#63988)

Anthropic reports exhausted credits as `invalid_request_error` rather
than the documented `billing_error`. Recognize the specific
credit-balance message when converting Anthropic API errors to
`PaymentRequired`.

This preserves the original status, code, and message, handles errors
with or without an HTTP status, and leaves other invalid requests
unchanged. The comment links to Anthropic's error documentation.

Closes DELTA-77

Validation: the existing Anthropic billing-error test and package
formatting check pass. A temporary classification test also passed for
exhausted credits and malformed requests, with and without HTTP status;
it is not included in this PR.

Release Notes:

- Fixed Anthropic credit exhaustion being classified as a malformed
request instead of a payment issue.
```

## Parents

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

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