Skip to content
pubscout

langchain_openai

0.9.0, released 3 months ago by langchaindart.dev

LangChain.dart integration module for OpenAI APIs.

WASM-ready
$ flutter pub add langchain_openai
Source repository

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.

  • llamadart

    If you want to run local or alternative language models instead of relying on OpenAI.

Works with

Packages commonly used together with langchain_openai: ones it builds on, ones built on it, and its own family.