langchain_openai
0.9.0, released 3 months ago by langchaindart.dev
LangChain.dart integration module for OpenAI APIs.
What it does
Provides wrappers around OpenAI services including LLMs, Chat models, Embeddings, specialized chains, and image generation tools within the LangChain.dart ecosystem.
AI-written summary of version 0.9.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building a LangChain.dart application that requires OpenAI models like GPT-5 or o3.
- You need OpenAI-based embeddings, QA chains with sources, or DALL-E image generation tools.
Skip it when
- You are using on-device models or a completely different backend provider not supported by OpenAI.
- You do not use LangChain.dart in your application architecture.
Strengths
- Seamless integration with LangChain.dart components, memory, and agents.
- Supports advanced features such as reasoning efforts, service tiers, and OpenRouter reasoning details.
Weaknesses
- Tied directly to the LangChain.dart ecosystem and OpenAI API standards.
- Requires maintaining appropriate API keys and remote network requests.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 7
Add the package dependency and configure your OpenAI API keys as required by the library.
final chat = ChatOpenAI(apiKey: 'your-api-key');
final response = await chat.invoke(PromptValue.string('Hello!'));Alternatives
Packages that do the same job and could replace langchain_openai.
- firebase_ai
If you prefer using Google's Firebase AI services instead of OpenAI.
86Compare - llamadart
If you want to run local or alternative language models instead of relying on OpenAI.
93Compare
Works with
Packages commonly used together with langchain_openai: ones it builds on, ones built on it, and its own family.
- uuidlangchain_openai depends on itGenerates and parses RFC‑4122/9562 UUIDs (v1‑v8) for Dart.
- openai_dartlangchain_openai depends on itDart and Flutter client for OpenAI REST APIs and realtime WebSocket/WebRTC workflows.
- langchain_corelangchain_openai depends on itCore abstractions and LangChain Expression Language for LangChain.dart.
- langchainSame familyA Dart/Flutter library for building LLM‑powered applications with LangChain patterns.
- langchain_googleSame familyLangChain.dart integration module for Google AI, Gemini, and VertexAI.