From 7de36ca0de6dfc9e38ed60feef9deade7bb6e69a Mon Sep 17 00:00:00 2001 From: kerthcet Date: Tue, 23 Jun 2026 23:48:47 +0800 Subject: [PATCH] fix how to get the right provider Signed-off-by: kerthcet --- alphatrion/tracing/cost_enrichment_processor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/alphatrion/tracing/cost_enrichment_processor.py b/alphatrion/tracing/cost_enrichment_processor.py index 7026e94c..6931d86b 100644 --- a/alphatrion/tracing/cost_enrichment_processor.py +++ b/alphatrion/tracing/cost_enrichment_processor.py @@ -55,14 +55,14 @@ def on_end(self, span: ReadableSpan): # Extract token usage attributes = span.attributes - # OpenAI SDK populates the `gen_ai.openai.api_base` with base URL - # whereas Bedrock SDK either only populates the `gen_ai.system` with "AWS" - # or the `gen_ai.provider.name` with "aws.bedrock" + # Keep getting the provider from api_base first because some providers (like DeepInfra) + # don't set the provider name in the attributes, it's still OPENAI, which is not correct. provider = determine_provider( str( attributes.get("gen_ai.openai.api_base") - or attributes.get("gen_ai.system") or attributes.get("gen_ai.provider.name") + # Being deprecated in favor of `gen_ai.provider.name` + or attributes.get("gen_ai.system") ) ) model = str(