本页还没有译文
本页 43 段还没译成한국어,下面显示的是英文原文。Chat model integrations
还没翻译译自英文(docs.langchain.com)本页 43 段都还没译
Chat models are language models that use a sequence of messages as inputs and return messages as outputs (as opposed to plaintext).
Install and use
OpenAI
Install:
npm install @langchain/openai @langchain/coreyarn add @langchain/openai @langchain/corepnpm add @langchain/openai @langchain/coreAdd environment variables:
OPENAI_API_KEY=your-api-keyInstantiate the model:
import { ChatOpenAI } from "@langchain/openai";
const model = new ChatOpenAI({ model: "gpt-5.4-mini" });await model.invoke("Hello, world!")Anthropic
Install:
npm i @langchain/anthropic @langchain/coreyarn add @langchain/anthropic @langchain/corepnpm add @langchain/anthropic @langchain/coreAdd environment variables:
ANTHROPIC_API_KEY=your-api-keyInstantiate the model:
import { ChatAnthropic } from "@langchain/anthropic";
const model = new ChatAnthropic({
model: "claude-sonnet-4-6",
temperature: 0
});await model.invoke("Hello, world!")Google Gemini
Install:
npm install @langchain/google @langchain/coreyarn add @langchain/google @langchain/corepnpm add @langchain/google @langchain/coreAdd environment variables:
GOOGLE_API_KEY=your-api-keyInstantiate the model:
import { ChatGoogle } from "@langchain/google";
const model = new ChatGoogle("gemini-2.5-flash");await model.invoke("Hello, world!")MistralAI
Install:
npm install @langchain/mistralai @langchain/coreyarn add @langchain/mistralai @langchain/corepnpm add @langchain/mistralai @langchain/coreAdd environment variables:
MISTRAL_API_KEY=your-api-keyInstantiate the model:
import { ChatMistralAI } from "@langchain/mistralai";
const model = new ChatMistralAI({
model: "mistral-large-latest",
temperature: 0
});await model.invoke("Hello, world!")Groq
Install:
npm install @langchain/groq @langchain/coreyarn add @langchain/groq @langchain/corepnpm add @langchain/groq @langchain/coreAdd environment variables:
GROQ_API_KEY=your-api-keyInstantiate the model:
import { ChatGroq } from "@langchain/groq";
const model = new ChatGroq({
model: "openai/gpt-oss-120b",
temperature: 0
});await model.invoke("Hello, world!")Featured models
Info
While these LangChain classes support the indicated advanced feature, you may need to refer to provider-specific documentation to learn which hosted models or backends support the feature.
| Model | Stream | Tool Calling | withStructuredOutput() | Multimodal | Downloads |
|---|---|---|---|---|---|
ChatOpenAI | ✅ | ✅ | ✅ | ✅ | |
ChatAnthropic | ✅ | ✅ | ✅ | ✅ | |
ChatBedrockConverse | ✅ | ✅ | ✅ | ✅ | |
ChatGroq | ✅ | ✅ | ✅ | ❌ | |
ChatOllama | ✅ | ✅ | ✅ | ✅ | |
ChatMistralAI | ✅ | ✅ | ✅ | ✅ | |
ChatGoogle | ✅ | ✅ | ✅ | ✅ | |
ChatXAI | ✅ | ✅ | ✅ | ❌ | |
ChatCohere | ✅ | ✅ | ✅ | ❌ | |
ChatFireworks | ✅ | ✅ | ✅ | ❌ | |
ChatCloudflareWorkersAI | ✅ | ❌ | ❌ | ✅ | |
ChatTogetherAI | ✅ | ✅ | ✅ | ✅ | |
ChatPerplexity | ✅ | ❌ | ✅ | ❌ |
See the full list of chat model integrations below for more options.
Routers & proxies
Routers and proxies give you access to models from multiple providers through a single API and credential. They can simplify billing, let you switch between models without changing integrations, and offer features like automatic fallbacks.
| Provider | Integration | Description |
|---|---|---|
| OpenRouter | ChatOpenRouter | Unified access to models from OpenAI, Anthropic, Google, Meta, and more |
| FuturMix | ChatOpenAI | Unified AI gateway for 22+ models with OpenAI-compatible API and 99.99% SLA |
Chat Completions API
Certain model providers offer endpoints that are compatible with OpenAI's (legacy) Chat Completions API. In such case, you can use ChatOpenAI with a custom base_url to connect to these endpoints. Note that features built on top of the Chat Completions API may not be fully supported by ChatOpenAI; in such cases, consider using a provider-specific class if available.
All chat models
| Model | Stream | Tool Calling | withStructuredOutput() | Multimodal | Downloads |
|---|---|---|---|---|---|
AzureChatOpenAI | ✅ | ✅ | ✅ | ✅ | |
ChatOpenAI | ✅ | ✅ | ✅ | ✅ | |
ChatAnthropic | ✅ | ✅ | ✅ | ✅ | |
ChatGoogleGenerativeAI | ✅ | ✅ | ✅ | ✅ | |
ChatBedrockConverse | ✅ | ✅ | ✅ | ✅ | |
ChatVertexAI | ✅ | ✅ | ✅ | ✅ | |
ChatGroq | ✅ | ✅ | ✅ | ❌ | |
ChatOllama | ✅ | ✅ | ✅ | ✅ | |
ChatMistralAI | ✅ | ✅ | ✅ | ✅ | |
ChatGoogle | ✅ | ✅ | ✅ | ✅ | |
ChatXAI | ✅ | ✅ | ✅ | ❌ | |
ChatCohere | ✅ | ✅ | ✅ | ❌ | |
ChatOpenRouter | ✅ | ✅ | ✅ | ✅ | |
ChatDeepSeek | ✅ | ✅ | ✅ | ❌ | |
ChatCerebras | ✅ | ✅ | ✅ | ❌ | |
ChatFireworks | ✅ | ✅ | ✅ | ❌ | |
ChatBaiduQianfan | |||||
ChatCloudflareWorkersAI | ✅ | ❌ | ❌ | ✅ | |
ChatTogetherAI | ✅ | ✅ | ✅ | ✅ | |
ChatWatsonx | ✅ | ✅ | ✅ | ✅ | |
ChatPerplexity | ✅ | ❌ | ✅ | ❌ | |
ChatYandexGPT | |||||
ChatInterfaze | ✅ | ✅ | ✅ | ✅ | |
ChatKServe | ✅ | ✅ | ✅ | ✅ | |
ChatWebLLM | ✅ | ✅ | ✅ | ||
RecallToolkit | |||||
ChatSCX | ✅ | ✅ | ✅ | ✅ | |
Auxen | ✅ | ✅ | ✅ | ❌ | N/A |
ChatEmpirioLabs | ✅ | ✅ | ✅ | ✅ | N/A |
FakeListChatModel | N/A | ||||
FuturMix | ✅ | ✅ | ✅ | ✅ | N/A |
Tuning Engines | ✅ | ✅ | ✅ | ❌ | N/A |
Info
If you'd like to contribute an integration, see Contributing integrations.