From ed30b62d83914ad793928f7c7072669575d71831 Mon Sep 17 00:00:00 2001 From: Sam Shuang Wu Date: Sat, 28 Mar 2026 13:08:58 -0700 Subject: [PATCH] fix: use OpenAI default_headers for Kimi User-Agent The httpx Client headers were being overwritten by the OpenAI SDK's own User-Agent. Using default_headers on the OpenAI client ensures the header reaches Kimi's agent whitelist check. Verified: full pipeline run succeeds with real Kimi API. Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/app/providers/kimi.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/backend/app/providers/kimi.py b/backend/app/providers/kimi.py index 9114611..be0e319 100644 --- a/backend/app/providers/kimi.py +++ b/backend/app/providers/kimi.py @@ -31,17 +31,13 @@ def __init__(self, api_key: str | None = None, model: str = KIMI_MODEL): def _get_client(self): if self._client is None: - import httpx from openai import OpenAI - http_client = httpx.Client( - headers={"User-Agent": KIMI_USER_AGENT}, - timeout=120.0, - ) self._client = OpenAI( api_key=self._api_key, base_url=KIMI_BASE_URL, - http_client=http_client, + default_headers={"User-Agent": KIMI_USER_AGENT}, + timeout=120.0, ) return self._client