spoof User-Agent for Agent Router calls to bypass unauthorized client detection

This commit is contained in:
rarebuffalo
2026-06-15 02:54:16 +05:30
parent b1fa5890e8
commit d132536284
3 changed files with 26 additions and 0 deletions

View File

@@ -76,6 +76,10 @@ async def call_ai(
if settings.ai_api_base:
kwargs["api_base"] = settings.ai_api_base
if "agentrouter.org" in settings.ai_api_base.lower():
kwargs["extra_headers"] = {
"User-Agent": "claude-code/0.2.9",
}
# JSON mode: supported natively by OpenAI and LiteLLM proxied Gemini.
# For providers that don't support it, LiteLLM silently ignores the flag.