Skip to content

[JS] OpenAI Responses API support in @genkit-ai/compat-oai (tracking) #6002

Description

@cabljac

Tracking issue for Responses API support in @genkit-ai/compat-oai. Follows the direction discussed in #5236 (see RFC discussion there; #5345 tracks the Go side).

Approach

Per-model routing inside the existing openAI() plugin - one namespace, no sibling plugin:

  • Responses-only models (gpt-5-pro, gpt-5-codex, o1-pro, o3-pro, ...) register on /v1/responses. They are unreachable via compat-oai today, so this is purely additive.
  • Dual-transport models opt in explicitly: openAI.responsesModel('gpt-5'). Existing model references are unchanged - same wire protocol, same raw shape, same config.
  • Default behavior is stateless: store: false pinned, encrypted reasoning items round-tripped via part metadata (include: ['reasoning.encrypted_content']), with previousResponseId + store exposed as opt-in config for server-side threading.
  • Built-in tools (web_search_preview, file_search, code_interpreter) go through the existing config.tools passthrough - no new wrapper fields. Citations surface raw as metadata.annotations on text parts, matching the google-genai Interactions handling.

Deferred, out of scope here: flipping the default transport for gpt-5*/o3/o4-mini (breaking, needs its own proposal), and deep-research / computer-use models (long-running, need background-model actions; background mode also requires store: true).

Example

// After #6003 (PR #6006): Responses-only models work by name
await ai.generate({ model: openAI.model('gpt-5-pro'), prompt });

// After #6005: opt a dual-transport model onto Responses explicitly,
// with built-in tools via the existing config.tools passthrough
await ai.generate({
  model: openAI.responsesModel('gpt-5'),
  prompt: 'What changed in the news today?',
  config: { tools: [{ type: 'web_search_preview' }] },
});

Work items

One PR per item, in order:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions