pypi / langchain-openai
langchain-openai
What changed in langchain-openai 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-20.
4 breaking5 security25 new APIs and options8 behavior and defaults60 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initlangchain-openai 1102 changes
Breaking changes 4
The stream path now raises on error events.
The stop field is dropped from Responses API payloads.
The minimum required langchain-core version was bumped.
Updates the file index key name, affecting code that reads or writes this key.
Security 5
Preserves encrypted reasoning in streamed responses.
Redacts MCP authorization.
Image token counting now uses an SSRF-safe transport.
Text content blocks in chat completions are now sanitized.
URLs are sanitized when counting tokens in images.
New APIs and options 25
Model profiles now declare mid-conversation support, allowing developers to identify models with this capability.
Adds support for the decisions API.
Azure workload identity is now discovered.
Added profile augmentations for Opus 5.5 and GPT-6.
Added support for async tools.
Added support for configuration_update.
Adds standard model exception types for handling model errors.
langchain-openai supports the OpenAI 3.0 SDK, allowing developers to use that SDK with the integration.
LangSmith gateway support is available through an environment variable.
Adds reasoning_effort as a standard chat model parameter.
Adds support for explicit prompt caching.
Adds package version tracking to tracing metadata and renames the package version trace metadata.
Support the apply_patch built-in tool.
Content-block-centric streaming (v2) was added.
The OpenAI integration now supports the phase parameter.
OpenRouter adds support for streaming token usage.
Tool search is now supported.
Support was added for automatic server-side compaction.
Adds ContextOverflowError, which is raised in OpenAI when context overflows.
Adds text_inputs to model profiles.
Adds text_outputs to model profiles.
Adds a strict flag to structured output.
Adds the missing tools parameter to ChatOpenAI.with_structured_output.
Adds OpenAI moderation middleware.
OpenAI service tier token details are now populated.
Behavior and default changes 8
Tool changes can now be made on SystemMessage instances mid-conversation.
Gateway metadata is extracted from response headers when available.
The model token mapping was extended through gpt-5.2 for modelname_to_contextsize.
Model profiles were updated, which may affect model capability information used by the package.
Maximum input token limits were updated for the gpt-5 series.
Uses the responses API when the model is gpt-5.2-pro.
The openai_api_key parameter now supports callable values.
Enables stream_usage when using the default base URL and client.
Fixes and other changes 60
Responses stream items stay on one block when output_index drifts.
Request constraints are supported for GPT-6.
Inferred Responses API routing is exposed at initialization.
Adds GPT-6 Astra reasoning effort support.
Fixed support for Azure AD authentication with OpenAI 3.8.
Corrected the reasoning_effort_levels for gpt-5 and gpt-5.1 profiles.
Corrected routing for gpt-5.6-sol to use the Responses API.
Raises a clear error when
_create_chat_resultreceives an unexpected response type.Supports o-series models when counting tokens from messages.
Reasoning item boundaries are preserved.
Invalid tool calls are filtered from content.
Filters LangChain-generated content block IDs.
Handles ContextWindowExceededError.
Preserves Responses text options.
Corrected the profile for this model.
Suppresses a Pydantic serializer warning on the structured output parsed field.
Tools are only set to strict=True for OpenAI-compatible models.
Response item IDs are dropped when store is false.
Normalizes v1 streamed tool calls.
Broadens the condition for ContextOverflowError to accommodate other providers.
Guards httpx finalizers to prevent errors during finalization.
The Responses API check now includes gpt-5.5 pro.
Prevents silent streaming hangs in ChatOpenAI.
Streaming now tolerates prompt_cache_retention drift.
Azure chat profiles are now inferred from the model name.
Model profile data was refreshed.
Streaming now accommodates dict response items.
Placeholder filenames are imputed for OpenAI file inputs.
Responses API conversion now handles content blocks that lack a type key.
Usage metadata token extraction now uses is-not-None checks.
A user-provided User-Agent can override the Azure default.
Missing ModelProfile fields were added, and schema drift now produces a warning.
Streaming function_call chunks now preserve the namespace field.
Responses API input items now include type: message.
PIL Image handles are closed during token counting to prevent a file descriptor leak.
Valid responses that are falsy at runtime are now accepted.
File URL inputs accommodate breaking changes, with CSV called out in the change.
Model detection for the Responses API is updated to handle pro and codex models.
Structured output avoids PydanticSerializationUnexpectedValue.
The error message for non-OpenAI embedding providers was enhanced.
A model property was added.
The error message for null choices in OpenAI-compatible APIs was improved.
The gpt-5.2-pro Model Profile structured_output key was fixed.
Codex models are now detected for Responses API preference.
Structured output refusals now raise the proper OpenAIRefusalError.
The Responses API now handles empty assistant content.
Token counting now handles function_call content.
Token counting now filters function_call blocks.
Relies on langchain-core for setting chunk_position.
Reverts the switch from nano to mini when using flex.
Corrects the aspect ratio caps used when resizing images.
Handles responses API content blocks that lack a text key.
Allows temperature when reasoning is set to the string 'none'.
Fixes an error when using the Responses API with built-in tools and custom tools.
GPT-5 temperature validation is now case-insensitive.
create_agent and response_format are fixed for the Responses API.
Embedding requests respect the API's 300k token limit.
Backward compatibility for response_format is fixed.
The response.incomplete event is handled when using stream_mode=['messages'].
Conditionally skips stream_usage in chat completions when OPENAI_BASE_URL is set.