Skip to main content

Documentation Index

Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-naomid-1779801766-572e290.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Chat models are language models that use a sequence of messages as inputs and return messages as outputs .

Install and use

Install:
npm install @langchain/openai @langchain/core
Add environment variables:
OPENAI_API_KEY=your-api-key
Instantiate the model:
import { ChatOpenAI } from "@langchain/openai";

const model = new ChatOpenAI({ model: "gpt-5.4-mini" });
await model.invoke("Hello, world!")
Install:
npm i @langchain/anthropic @langchain/core
Add environment variables:
ANTHROPIC_API_KEY=your-api-key
Instantiate the model:
import { ChatAnthropic } from "@langchain/anthropic";

const model = new ChatAnthropic({
model: "claude-3-sonnet-20240620",
temperature: 0
});
await model.invoke("Hello, world!")
Install:
npm install @langchain/google @langchain/core
Add environment variables:
GOOGLE_API_KEY=your-api-key
Instantiate the model:
import { ChatGoogle } from "@langchain/google";

const model = new ChatGoogle("gemini-2.5-flash");
await model.invoke("Hello, world!")
Install:
npm install @langchain/mistralai @langchain/core
Add environment variables:
MISTRAL_API_KEY=your-api-key
Instantiate the model:
import { ChatMistralAI } from "@langchain/mistralai";

const model = new ChatMistralAI({
model: "mistral-large-latest",
temperature: 0
});
await model.invoke("Hello, world!")
Install:
npm install @langchain/groq @langchain/core
Add environment variables:
GROQ_API_KEY=your-api-key
Instantiate the model:
import { ChatGroq } from "@langchain/groq";

const model = new ChatGroq({
model: "llama-3.3-70b-versatile",
temperature: 0
});
await model.invoke("Hello, world!")
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.
ModelStreamTool CallingwithStructuredOutput()Multimodal
ChatOpenAI
ChatAnthropic
ChatGoogle
ChatBedrockConverse
ChatCloudflareWorkersAI
ChatCohere
ChatFireworks
ChatGroq
ChatMistralAI
ChatOllama
ChatPerplexity
ChatTogetherAI
ChatXAI
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.
ProviderIntegrationDescription
OpenRouterChatOpenRouterUnified access to models from OpenAI, Anthropic, Google, Meta, and more

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.
For OpenRouter, use the dedicated ChatOpenRouter integration (not ChatOpenAI with a custom base URL). Sign up and create an API key, then install and instantiate:
npm install @langchain/openrouter @langchain/core
export OPENROUTER_API_KEY="your-api-key"
import { ChatOpenRouter } from "@langchain/openrouter";

const model = new ChatOpenRouter({
  model: "anthropic/claude-sonnet-4.6",
});
See the ChatOpenRouter integration guide for tool calling, structured output, provider routing, and multi-model fallback.

All chat models

Anthropic

Azure OpenAI

Baidu Qianfan

Amazon Bedrock Converse

Cerebras

Cloudflare Workers AI

Cohere

DeepSeek

Fake LLM

Google Gemini

Groq

MistralAI

Ollama

OpenAI

Perplexity

xAI

Fireworks

IBM watsonx.ai

Together

If you’d like to contribute an integration, see Contributing integrations.