#11754·langchainjs

openai: Responses API chat model event stream omits response_metadata.model_name

Author: SiKreuzCreated Sep 28, 2026Updated Sep 28, 2026

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

typescript
import { convertOpenAIResponsesStream } from "@langchain/openai";

async function* events() {
  yield { type: "response.created", response: { id: "resp_1", model: "gpt-5.4-2026-03-05" } };
  yield {
    type: "response.completed",
    response: { id: "resp_1", model: "gpt-5.4-2026-03-05", status: "completed", output: [] },
  };
}

for await (const event of convertOpenAIResponsesStream(events() as never)) {
  if (event.event === "message-finish") {
    console.log(event.responseMetadata);
    // { model_provider: "openai", id: "resp_1", model: "gpt-5.4-2026-03-05", status: "completed" }
    // model_name is missing
  }
}

In practice this hits every ChatOpenAI call that uses the Responses API (e.g. reasoning: { summary: "auto" }) while a chat-model stream event handler is attached, such as any call inside agent.streamEvents(..., { version: "v3" }): BaseChatModel then builds the final AIMessage from _streamChatModelEvents, so its response_metadata.model_name is undefined.

Error Message and Stack Trace (if applicable)

No response

Description

convertOpenAIResponsesStream (libs/providers/langchain-openai/src/utils/responses_stream_events.ts) builds the message-finish responseMetadata with model but not model_name:

typescript
responseMetadata = {
  model_provider: provider,
  id: event.response.id,
  model: event.response.model,
  status: event.response.status,
};

Every other OpenAI path sets response_metadata.model_name to the served model:

  • the core Chat Completions event stream (buildResponseMetadata in openai_completions_stream.ts),
  • the legacy Responses chunk stream (response.created in convertResponsesDeltaToChatGenerationChunk),
  • the non-streaming Responses path (convertResponsesMessageToAIMessage).

model_name is the field tracing integrations read the served model from. Langfuse's LangChain CallbackHandler, for example, records the requested model at handleLLMStart and overwrites it with response_metadata.model_name at handleLLMEnd. As a result, Responses API generations streamed through the v3 event protocol show up as gpt-5.4 while every other generation of the same model shows gpt-5.4-2026-03-05, which splits the model in dashboards and cost reports.

Expected: response_metadata.model_name is set to event.response.model, as on the other paths.

System Info

  • @langchain/openai 1.6.0 (also present on main)
  • @langchain/core 1.2.13
  • langchain 1.5.x (createAgent + streamEvents version: "v3")
  • macOS, Bun 1.3 / Node 26

Source: langchain-ai/langchainjs