From 241d4047bb6774b83851c16e2df0534df6ae4fd8 Mon Sep 17 00:00:00 2001 From: stdrc Date: Sat, 11 Oct 2025 12:34:54 +0000 Subject: [PATCH] fix: encode httpx headers with utf-8 --- src/openai/_base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openai/_base_client.py b/src/openai/_base_client.py index 58490e4430..9339a367b9 100644 --- a/src/openai/_base_client.py +++ b/src/openai/_base_client.py @@ -436,7 +436,7 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 self._validate_headers(headers_dict, custom_headers) # headers are case-insensitive while dictionaries are not. - headers = httpx.Headers(headers_dict) + headers = httpx.Headers(headers_dict, encoding="utf-8") idempotency_header = self._idempotency_header if idempotency_header and options.idempotency_key and idempotency_header not in headers: