Skip to content

OpenAI images.generate() and images.edit() not instrumented (wrapper and auto-instrumentation) #1628

@braintrust-bot

Description

@braintrust-bot

Summary

The OpenAI Node SDK provides stable images.generate() and images.edit() methods for AI-powered image generation (DALL-E 3/gpt-image-1), but neither the wrapper (wrapOpenAI) nor the auto-instrumentation plugin instruments them. Calls to these methods produce no Braintrust spans. By contrast, OpenAI embeddings.create() and moderations.create() — also "secondary" AI model APIs — are fully instrumented.

What is missing

  • Wrapper (js/src/wrappers/oai.ts): No proxy for images resource. Only chat.completions, embeddings, moderations, and responses are wrapped.
  • Auto-instrumentation config (js/src/auto-instrumentations/configs/openai.ts): No config entry for images.generate or images.edit.
  • Channels (js/src/instrumentation/plugins/openai-channels.ts): No channel definitions for image generation.
  • Plugin (js/src/instrumentation/plugins/openai-plugin.ts): No handler for image generation calls.

Upstream reference

Braintrust docs status

The Braintrust wrapper docs page broadly mentions tracing "GPT models, embeddings, and other OpenAI APIs" but does not specifically enumerate images support (unclear).

Note on Responses API overlap

The OpenAI Responses API can generate images via the image_generation built-in tool, and this repo does instrument responses.create() including image_generation_call output conversion to Attachments (via processImagesInOutput in openai-plugin.ts). However, many users still use the dedicated images.generate() endpoint directly, especially for DALL-E 3 and gpt-image-1 workflows that don't use the Responses API.

Precedent in this repo

OpenAI embeddings and moderations — similarly "secondary" model APIs — are instrumented in all three layers:

  • Wrapper: js/src/wrappers/oai.ts
  • Auto-instrumentation config: js/src/auto-instrumentations/configs/openai.ts
  • Plugin: js/src/instrumentation/plugins/openai-plugin.ts

Local files inspected

  • js/src/wrappers/oai.ts
  • js/src/auto-instrumentations/configs/openai.ts
  • js/src/instrumentation/plugins/openai-channels.ts
  • js/src/instrumentation/plugins/openai-plugin.ts
  • js/src/vendor-sdk-types/openai.ts
  • js/src/vendor-sdk-types/openai-common.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions