Skip to content

[bot] OpenAI Realtime API (client.realtime.*) not instrumented (openai + ruby-openai gems) #206

Description

@braintrust-bot

Summary

Both the official openai gem and the community ruby-openai gem expose OpenAI's Realtime API — a low-latency, speech-to-speech (and SIP call-control) generative execution surface — and neither is instrumented by this SDK. This is a distinct generative execution path from the already-instrumented Chat Completions and Responses APIs: it establishes a session (via an ephemeral client secret) that then drives a live, bidirectional model conversation over WebRTC/WebSocket, optionally with tool calling and VAD-based turn detection.

What is missing

Official openai gem

client.realtime exposes (per OpenAI's official Ruby API reference):

  • client.realtime.client_secrets.create(**kwargs)POST /realtime/client_secrets — mints the ephemeral session + client_secret used to open the actual realtime connection. This is the generative-session-initiating call, analogous to chat.completions.create for this API family.
  • client.realtime.calls.accept/hangup/refer/reject(call_id, **kwargs) → SIP call-control endpoints for realtime phone calls.
  • Related sub-resources: RealtimeSessions, RealtimeTranscriptionSessions, RealtimeTranslations (+ their own client_secrets), and a large client/server event model (RealtimeClientEvent/RealtimeServerEvent, SessionCreatedEvent, conversation items, tool/MCP integration, VAD/turn-detection config).
  • None of this is wrapped by any Patcher in this repo — lib/braintrust/contrib/openai/patcher.rb only defines ChatPatcher, ResponsesPatcher, ModerationsPatcher.
  • Maturity note: RealtimeSession is documented as "for the beta interface," and there's a separate legacy "Realtime Beta" section — so the surface is evolving, not hardened GA, but it is officially documented and shipped in the gem today (gem is pre-1.0, ~v0.69 as of July 2026).

ruby-openai gem

  • client.realtime.create(parameters: { model: "gpt-4o-realtime-preview-2024-12-17" }) — documented in the gem's own README, returns a session object plus a client_secret (ephemeral key) used to establish a WebRTC peer connection. The README's tagline explicitly advertises "Realtime WebRTC conversations" as a supported feature.
  • lib/braintrust/contrib/ruby_openai/patcher.rb has the same three patchers (ChatPatcher, ResponsesPatcher, ModerationsPatcher) and no realtime equivalent.

What a span should capture

Braintrust docs status

unclearhttps://www.braintrust.dev/docs/integrations/ai-providers/openai mentions the Realtime API exactly once, as a Cookbooks link title ("Evaluating audio with the OpenAI Realtime API" → `/docs/cookbook/recipes/Realtime"), with no description of what tracing/instrumentation support exists, and no connection to Ruby anywhere on the page. The page's Ruby-specific tracing table only documents Chat Completion, Responses, and Moderations. https://www.braintrust.dev/docs/integrations/sdk-integrations does not mention Realtime at all.

Upstream sources

Braintrust docs sources checked

Local repo files inspected

  • lib/braintrust/contrib/openai/patcher.rb — defines ChatPatcher, ResponsesPatcher, ModerationsPatcher; no realtime patcher
  • lib/braintrust/contrib/openai/instrumentation/ — contains chat.rb, responses.rb, moderations.rb, common.rb; no realtime.rb
  • lib/braintrust/contrib/ruby_openai/patcher.rb and lib/braintrust/contrib/ruby_openai/instrumentation/ — same file set, same gap
  • Grep for realtime/Realtime across lib/braintrust/, test/, and examples/ returns zero matches anywhere in code, tests, or examples (only unrelated cassette filename false-positives)
  • Searched all 48 currently-open issues in this repo for "realtime" — zero matches, confirming this is a distinct, non-duplicate gap

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions