You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
backend: distinguish platform vs BYOK errors in LLM logging #7290
OpenAI errors in prod logs (RateLimitError, AuthenticationError, PermissionDeniedError) look identical whether they originate from our platform key or a user's BYOK key. This makes triage hard — we can't tell at a glance if it's our problem or a user's broken key.
What we see in prod today:
31× RateLimitError insufficient_quota — all BYOK users with no credits
5× AuthenticationError with key hint 0 — invalid BYOK key
2× AuthenticationError with OpenRouter key mistakenly set as OpenAI key
1× PermissionDeniedError on project proj_r5oIEByGgGNJktsG78vdQvDi — not our project
All of these log identically to platform key errors, polluting alerts and dashboards.
Root Cause
_OpenAIEmbeddingsProxy (utils/llm/clients.py:55-77) and _cached_openai_chat route to BYOK keys transparently — errors bubble up without tagging the source. There's no source=platform|byok distinction in log output.
Proposed Fix
Tag all LLM errors with source=platform|byok in the log message or structured labels so alerts and dashboards can filter. The BYOK context is already available via get_byok_key() at call time.
Activity
beastoin commentedon Jun 10, 2026
Closing as not planned per CTO directive (2026-06-10).
by AI for @beastoin