Anthropic Python SDK 2.17.0: Audit middleware headers before testing retries
Middleware now sees more request headers, and one class of dropped response is no longer retried. Gateway users should test logging, forwarding, and attempt counts separately.
If your Python service calls Claude through Anthropic's SDK and uses custom logging or forwarding middleware, make sure it does not log or forward the whole header collection before upgrading to 2.17.0. Anthropic's December 3, 2026 release changes the request headers middleware can see and fixes a case where a body-read failure did not honor x-should-retry: false. This is a client release, not a general change to Claude models, billing, or gateway protocols. 1
More visible headers can make old logging code unsafe
The release notes say APIRequest.headers now includes the SDK's own headers, client defaults, and credential headers. Names generated by the client are lowercase; headers supplied on the call retain their casing. Code that dumps the object or redacts only one spelling may now expose a credential that was previously absent at that point. Check exception reporting and tracing as well as application logs. 1
Prefer to log only what you need: a request identifier, status, duration, and route alias, for example. Do not persist header values by default. Where you must inspect certain headers, match names case-insensitively and test with dummy credentials to ensure raw values never appear. Also review middleware that adds business headers: as the release notes explain, merge order controls which value wins. Decide whether you mean to preserve a default or explicitly replace it. 1
Keep the gateway's two authentication hops separate
The credential your app presents to a gateway is not the credential the gateway presents to the model provider. Even if both clients live in one wrapper, don't pass request.headers wholesale to the next client. Let the destination client build its own authentication headers, and copy only explicitly approved business fields. Verify with two distinct dummy credentials: only the destination's credential should appear on the outgoing request, and neither should appear in diagnostic output. 1
The retry fix covers a specific failure
The documented case is a connection drop or timeout while reading a response body after receiving x-should-retry: false. The new client makes a single request on this path and raises the same error type as before. That does not mean all connection failures are now non-retryable, nor does a read failure prove the upstream never executed or billed the request. An application queue can resubmit and a gateway can retry independently; count those attempts separately. 1
Four checks before upgrading
- Pin the old and new SDK versions in an isolated environment and run identical test settings. Do not use production accounts, payloads, or credentials.
- Exercise middleware with dummy credentials and inspect normal logs, exception traces, and the destination request. If your gateway has header allowlists, check inbound and outbound rules separately.
- Have a test double return the header and then interrupt the body read. Count SDK attempts separately from application-level resubmissions. On this specific path, the new SDK should make one attempt.
- Start in a test environment you can roll back. Compare error types, request counts, and log samples. If you see exposed credentials or duplicate submissions, stop the rollout and fix the middleware or outer policy before proceeding.
Teams using the default client without custom middleware can focus on read failures and recovery. Teams maintaining gateways, log collectors, or wrappers around multiple clients should start by tracing where headers go. A successful chat proves the happy path still works; it does not replace either check.
Sources & attribution
This article references the public materials listed below. Analysis and wording are SalpX's own; quoted material remains the property of its original authors and publishers.
- Anthropic Python SDK v2.17.0 release notes — Anthropic · accessed 2026-12-04Note:Official release notes covering middleware header visibility and the response-body retry fix.
One key for Claude, GPT and 50+ models
The SalpX gateway is OpenAI-SDK compatible. Point base_url at https://www.salpx.com/v1 and you are done.