Skip to content

v1.0.3 — Fix AsyncOpenAI cost/token extraction regression

Choose a tag to compare

@Mandark-droid Mandark-droid released this 06 Apr 07:43
· 23 commits to main since this release

Bug Fix

Fixed: AsyncOpenAI _record_result_metrics argument order was swapped in v1.0.2, causing cost and token attributes (gen_ai.usage.cost.total, gen_ai.usage.prompt_tokens, etc.) to be missing from spans when using litellm or AsyncOpenAI clients.

What was broken

  • v1.0.2 added _create_async_span_wrapper with _record_result_metrics(result, span, kwargs, start_time)
  • Correct order: _record_result_metrics(span, result, start_time, kwargs)
  • This silently failed — no crash, but no cost/token data on spans

Impact

Any application using litellm.acompletion() or AsyncOpenAI with genai-otel-instrument v1.0.2 was missing cost and token tracking on LLM spans.

Upgrade

pip install genai-otel-instrument==1.0.3