feat: detect OpenAI-compatible providers (MiniMax, Groq, etc.) in telemetry spans#1306
Open
octo-patch wants to merge 1 commit intoAgentOps-AI:mainfrom
Open
Conversation
…emetry spans When users use the OpenAI SDK with a custom base_url pointing to an OpenAI-compatible provider like MiniMax, Groq, DeepSeek, or others, the gen_ai.system span attribute was always set to "OpenAI". This made it impossible to distinguish MiniMax or Groq calls from actual OpenAI calls in observability dashboards. This commit adds automatic provider detection by inspecting the OpenAI client's base_url at instrumentation time. The detection is applied to chat completions and Responses API wrappers (both sync and async), covering the most commonly used endpoints. Supported providers: MiniMax, Groq, Together AI, Fireworks AI, DeepSeek, Mistral AI, Perplexity AI, Google AI, xAI, SambaNova, Cerebras.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When users use the OpenAI SDK with a custom
base_urlpointing to an OpenAI-compatible provider (e.g., MiniMax, Groq, DeepSeek), thegen_ai.systemspan attribute was always hardcoded to"OpenAI". This made it impossible to distinguish calls to different providers in observability dashboards.This PR adds automatic provider detection by inspecting the OpenAI client base_url at instrumentation time:
provider_detection.pymaps known API base URLs to provider namesstream_wrapper.pychat completions and Responses API wrappers (sync + async) now detect the actual provider and setgen_ai.systemaccordinglySupported providers
api.minimax.io,api.minimax.chatapi.groq.comapi.together.xyz,api.together.aiapi.fireworks.aiapi.deepseek.comapi.mistral.aiapi.perplexity.aigenerativelanguage.googleapis.comapi.x.aiapi.sambanova.aiapi.cerebras.aiExample
Design decisions
Test plan