Radicas Docs
Framework integrationsProviders

OpenAI SDK

Observe raw OpenAI API calls in Radicas via the OpenInference instrumentor — single LLM spans, no agent tree.

Status: experimental — implemented, not fixture-verified; no registry card yet. This is a telemetry source, not an agent framework: one LLM span per API call, no agent/tool tree. For agent flows use the OpenAI Agents SDK.

Install

pip install "radicas[openai]"      # = radicas + openinference-instrumentation-openai

Use

import radicas

radicas.init(service="my-service", feature="classification")
# instrument="auto" detects openai and activates OpenAIInstrumentor().instrument()
# — or: radicas.init(instrument=["openai-sdk"])   # alias: "openai"

from openai import OpenAI
client = OpenAI()
completion = client.chat.completions.create(model="gpt-4o-mini", messages=[...])
radicas.shutdown()

What it emits

  • Scope name: openinference.instrumentation.openaiexpected, pending fixture.
  • Namespace: llm.* / openinference.* — shim required.
  • Coverage: expected, pending fixture — model + token usage documented as captured; cache tokens (prompt caching) to verify.

Shim behavior

  • Client-side adapter: intended, pending card — until then spans pass through unmapped.
  • Server-side OTTL: pending the same card.

Known limitations

  • Not fixture-verified end-to-end.
  • Because so many frameworks depend on openai, detection fires often; in "auto" mode the strategy only activates when the radicas[openai] extra is actually installed — install it only if you want raw-client spans (they can duplicate LLM spans from a framework instrumentor watching the same calls).
  • The OTel-contrib route (opentelemetry-instrumentation-openai-v2, gen_ai.* native, light shim) is the documented alternative — but note it does not cover the Responses API yet; the deep-dive will pick the official route.

Verify it works

SELECT model, input_tokens, output_tokens, estimated_cost_usd
  FROM otel.llm_call ORDER BY ts DESC LIMIT 5;

Bench recipe: providers/openai-sdk/python in radicas-integrations.

On this page