npm / @langchain/openai
@langchain/openai
What changed in @langchain/openai 0.3 to 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
2 breaking3 security31 new APIs and options1 performance10 behavior and defaults42 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@langchain/openai 188 changes
Breaking changes 2
Applies per-call options before modelKwargs, then the constructor field; on Chat Completions, modelKwargs values are no longer dropped and take precedence over the constructor field.
Applies per-call options before modelKwargs, then the constructor field; on Chat Completions, modelKwargs values are no longer dropped and take precedence over the constructor field.
Security 2
LangChain: MongoDBChatMessageHistory query injection can allow cross-session access
Encrypted reasoning is now included in the input for zero-data-retention (ZDR) responses.
New APIs and options 31
Responses API accepts an additional_tools block on a SystemMessage and sends it as a top-level input item preceding the message. It throws if used with Chat Completions or on a non-SystemMessage, except assistant messages.
ModelProfile now includes fileMimeTypes so models can advertise accepted MIME types for generic file inputs; OpenAI Responses API models report the types supported by input_file.
Adds support for content-block breakpoints.
Supports explicit prompt cache options.
Supports configuration_update content blocks for changing reasoning effort mid-conversation without invalidating the cached prompt prefix.
OpenAI chat models can now use LangSmith Gateway environment configuration.
Adds native event converters for streamEvents.
Responses API messages now support phase on text content blocks, including streaming events, and round-trip it through raw provider and standard content paths.
Propagates defer_loading from LangChain tool extras through bindTools() into the Responses API payload, enabling on-demand tool discovery.
Adds a factory for the OpenAI Responses API tool_search built-in tool, supporting server-executed and client-executed modes.
Added gpt-5.4 to profiles, making it available to developers using the package.
Structured output now supports Standard Schema, allowing developers to use Standard Schema schemas for structured output.
File input conversion supports docx, pptx, xlsx, and csv document types.
OpenAI now raises ContextOverflowError for context overflow, giving callers a specific error to handle.
Adds support for codex 5.3.
The image generation tool accepts an action option with generate, edit, and auto choices.
Adds local_shell_call support to the streaming converter and input reconstruction.
Adds shell_call support to the streaming converter and input reconstruction.
Adds a deprecated call-option shorthand for reasoning.effort; reasoning.effort takes precedence when both are provided.
Adds support for the apply patch tool.
Adds support for the code interpreter tool.
Adds support for the computer use tool.
Adds support for the file search tool.
Adds support for the image generation tool.
Adds support for the local shell tool.
Adds support for the MCP connector tool.
Adds moderateContent to ChatOpenAI for content moderation.
Adds support for prompt cache retention.
Adds support for the shell tool.
Adds support for the web search tool.
apiKey now supports a callable function.
Performance 1
Stream chunk aggregation was optimized and redundant sorting was removed.
Behavior and default changes 10
The v0 default replay path reuses response_metadata.output directly, preserving every reasoning item's id and encrypted_content in original order under Zero Data Retention.
Timeouts and rate limits are marked retryable; aborts, context overflow, invalid tool results, bad credentials, and unknown models are marked non-retryable. Other errors remain unmarked and retry as before.
Strict tools are decoupled from strict structured output responses, so their behavior is no longer tied together.
Built-in tool progress events are now streamed.
Standard URL file blocks are now routed to native input_file in the Responses API.
Runnable traces now include package version metadata, making version information available in LangSmith trace metadata.
Stores response.output in response_metadata to support reasoning model round-trips.
Codex models, including codex-mini-latest and gpt-5-codex variants, are automatically routed to the Responses API.
OpenAI image generation outputs are now returned as proper image content blocks.
Prefers the Responses API for 5.2 pro.
Fixes and other changes 42
Wrapped configuration_update and mcp_approval_response blocks are now hoisted as Responses API input items, including blocks on messages built with contentBlocks. Chat Completions sends a non_standard block's payload rather than its wrapper.
Sends the in-memory retention value as in_memory because the API rejects the hyphenated value.
The v1 contentBlocks replay path preserves every reasoning item's id and encrypted_content in original order under Zero Data Retention.
Fixes base URL deserialization.
Routes gpt-5.6-sol to the Responses API so function tools work with reasoning.
Streaming now resolves encrypted_content from the canonical payload on the final done event, and it propagates without needing an include call option.
Tool-call-only v1 assistant messages now send content as null instead of an empty array.
OpenAI cache_write_tokens are mapped to cache_creation in usage_metadata.input_token_details instead of being silently dropped.
Gemini-native functionCall content blocks are dropped when converting messages to Chat Completions API params, preventing requests from failing during cross-provider handoffs.
A per-call maxRetries is forwarded to the retry loop so a surrounding retry loop can take over instead of multiplying retries.
Includes usage in response_metadata when system_fingerprint is absent.
Content blocks rejected by the chat completions API are filtered out of input.
tool_call content blocks are dropped from chat completions input.
Assistant content in responses input now emits output_text.
The converter no longer forwards content on reasoning input items, which only carry summary, avoiding a Responses API error.
When replaying reasoning items as Responses API input, the converter now omits id when it is absent, avoiding an OpenAI 400 error.
Responses API stream iteration errors are now wrapped with existing OpenAI client error handling.
AI messages preserve top-level Responses API ids.
Custom tool calls are streamed through Responses API chunks.
Handles JSON parsing failures caused by trailing non-whitespace characters without terminating the streaming response; the structured-output pipeline handles the typed failure.
Preserves v1 assistant tool calls.
Adds an index to streaming reasoning content blocks so chunks merge properly.
Preserves plain string responses content.
Placeholder filenames are supplied for OpenAI file inputs.
Preserves reasoning_content in ChatOpenAICompletions.
DeepSeek 400 errors containing maximum context length are now recognized as ContextOverflowError, allowing downstream code to handle context overflow correctly.
Guard JSON.parse in streaming json_schema when the text is empty.
Streaming and non-streaming converters handle tool_search_call and tool_search_output response items; core block translation maps them to server_tool_call and server_tool_call_result.
Fixes type narrowing for the new union type.
The Completions API streaming path now calls the callback for the final usage chunk, so callback-based consumers receive the usage_metadata chunk.
Passes service_tier to the API when using the Responses API.
Chat model invoke and streaming operations now check and propagate abort signals, enabling cancellation and allowing fallback chains to proceed after an abort.
Validation now allows file_url and file_id without filename metadata and avoids sending filename when it is not allowed.
ChatOpenAI now passes runManager to responses._generate.
A fix was made to OpenAI reasoning.
Reasoning tokens are now properly elevated.
The responses API now passes runManager to _streamResponseChunks.
Provider-native content in ToolMessage is passed through without stringification, preserving its original form.
Fixes content in AIMessage for tool and function calls.
Fixes filename and base64 conversions in OpenAI completions converters.
Allows setting the strict tag manually in providerStrategy.
Fix missing and inconsistent user agent headers.
@langchain/openai 0.31 changes
Security 1
Fixes CVE 2025 12735.