Anthropic Python and TypeScript SDKs add error classes per API error code (November 4, 2026)
Python 2.5.0 and TS 1.5.0 add error classes and error code fields. In Python, OverloadedError now counts as an InternalServerError.
Your keys
0 of 1 ready
Create each key on its own page, paste it below, then copy the finished lines into your project's .env file. What you paste stays in this tab. It is never sent to Wirestack or saved.
- Anthropic API keyANTHROPIC_API_KEYGet key
Click Create key. It starts with sk-ant- and is shown only once
What changed
On November 4, 2026 Anthropic released Python SDK anthropic 2.5.0 and TypeScript SDK @anthropic-ai/sdk 1.5.0.
- Python adds error classes for HTTP statuses and API error codes, and
error_code,detailsandapi_messageonAPIStatusError. - TypeScript adds error classes for HTTP statuses and API error codes, and
apiMessage,errorCodeanddetailsonAPIError. - In Python,
OverloadedErrorandServiceUnavailableErrorare now subclasses ofInternalServerError. - Both SDKs now reject path parameters such as
;xand..;x.
The next day, Python 2.6.0 and TypeScript 1.6.0 added error codes for ramp limit errors and External Key validation failures.
Prerequisites
- An Anthropic API key in
ANTHROPIC_API_KEY - Python with
anthropic2.5.0 or later, or Node.js with@anthropic-ai/sdk1.5.0 or later
Steps
- Upgrade:
pip install --upgrade "anthropic>=2.5.0"ornpm install @anthropic-ai/sdk@^1.5.0. - In Python, check every
tryblock that catches bothInternalServerErrorandOverloadedError. Put theOverloadedError(andServiceUnavailableError) branch first, or theInternalServerErrorbranch will now catch them. - Anthropic's errors guide says to catch the SDK's typed classes rather than string-match messages, handling the most specific classes first.
- Where you need the exact reason, read the error code field (
error_codein Python, in TypeScript). In the API response it sits at .
