Skip to main content

Chat models

Chat models are language models that use a sequence of messages as inputs and return messages as outputs (as opposed to using plain text). These are generally newer models.

info

If you'd like to write your own chat model, see this how-to. If you'd like to contribute an integration, see Contributing integrations.

pip install -qU langchain-openai
import getpass
import os

os.environ["OPENAI_API_KEY"] = getpass.getpass()

from langchain_openai import ChatOpenAI

model = ChatOpenAI(model="gpt-4o-mini")
model.invoke("Hello, world!")
info

While all these LangChain classes support the indicated advanced feature, you may have to open the provider-specific documentation to learn which hosted models or backends support the feature.

ProviderTool callingStructured outputJSON modeLocalMultimodalPackage
ChatAnthropiclangchain-anthropic
ChatMistralAIlangchain-mistralai
ChatFireworkslangchain-fireworks
AzureChatOpenAIlangchain-openai
ChatOpenAIlangchain-openai
ChatTogetherlangchain-together
ChatVertexAIlangchain-google-vertexai
ChatGoogleGenerativeAIlangchain-google-genai
ChatGroqlangchain-groq
ChatCoherelangchain-cohere
ChatBedrocklangchain-aws
ChatHuggingFacelangchain-huggingface
ChatNVIDIAlangchain-nvidia-ai-endpoints
ChatOllamalangchain-ollama
ChatLlamaCpplangchain-community
ChatAI21langchain-ai21
ChatUpstagelangchain-upstage
ChatDatabrickslangchain-databricks
ChatWatsonxlangchain-ibm
ChatXAIlangchain-xai

All chat models

NameDescription
AI21 LabsOverview
Alibaba Cloud PAI EASAlibaba Cloud PAI (Platform for AI) is a lightweight and cost-efficie...
AnthropicThis notebook provides a quick overview for getting started with Anth...
AnyscaleThis notebook demonstrates the use of langchain.chat_models.ChatAnysc...
Azure OpenAIThis guide will help you get started with AzureOpenAI chat models. Fo...
Azure ML EndpointAzure Machine Learning is a platform used to build, train, and deploy...
Baichuan ChatBaichuan chat models API by Baichuan Intelligent Technology. For more...
Baidu QianfanBaidu AI Cloud Qianfan Platform is a one-stop large model development...
AWS BedrockThis doc will help you get started with AWS Bedrock chat models. Amaz...
CerebrasThis notebook provides a quick overview for getting started with Cere...
Cloudflare Workers AIThis will help you getting started with CloudflareWorkersAI chat mode...
CohereThis notebook covers how to get started with Cohere chat models.
Coze ChatChatCoze chat models API by coze.com. For more information, see https...
Dappier AIDappier: Powering AI with Dynamic, Real-Time Data Models
DatabricksDatabricks Lakehouse Platform unifies data, analytics, and AI on one ...
DeepInfraDeepInfra is a serverless inference as a service that provides access...
Eden AIEden AI is revolutionizing the AI landscape by uniting the best AI pr...
EverlyAIEverlyAI allows you to run your ML models at scale in the cloud. It a...
FireworksThis doc help you get started with Fireworks AI chat models. For deta...
FriendliFriendli enhances AI application performance and optimizes cost savin...
GigaChatThis notebook shows how to use LangChain with GigaChat.
Google AIThis docs will help you get started with Google AI chat models. For d...
Google Cloud Vertex AIThis page provides a quick overview for getting started with VertexAI...
GPTRouterGPTRouter is an open source LLM API Gateway that offers a universal A...
GroqThis will help you getting started with Groq chat models. For detaile...
ChatHuggingFaceThis will help you getting started with langchainhuggingface chat mod...
IBM watsonx.aiChatWatsonx is a wrapper for IBM watsonx.ai foundation models.
JinaChatThis notebook covers how to get started with JinaChat chat models.
KineticaThis notebook demonstrates how to use Kinetica to transform natural l...
KonkoKonko API is a fully managed Web API designed to help application dev...
lindorm_chatLindorm Chat AI
LiteLLMLiteLLM is a library that simplifies calling Anthropic, Azure, Huggin...
LiteLLM RouterLiteLLM is a library that simplifies calling Anthropic, Azure, Huggin...
Llama 2 ChatThis notebook shows how to augment Llama-2 LLMs with the Llama2Chat w...
Llama APIThis notebook shows how to use LangChain with LlamaAPI - a hosted ver...
LlamaEdgeLlamaEdge allows you to chat with LLMs of GGUF format both locally an...
Llama.cppllama.cpp python library is a simple Python bindings for @ggerganov
maritalkIntroduction
MiniMaxMinimax is a Chinese startup that provides LLM service for companies ...
MistralAIThis will help you getting started with Mistral chat models. For deta...
MLXThis notebook shows how to get started using MLX LLM's as chat models.
MoonshotMoonshot is a Chinese startup that provides LLM service for companies...
NaverThis notebook provides a quick overview for getting started with Nave...
NVIDIA AI EndpointsThis will help you getting started with NVIDIA chat models. For detai...
ChatOCIModelDeploymentThis will help you getting started with OCIModelDeployment chat model...
OCIGenAIThis notebook provides a quick overview for getting started with OCIG...
ChatOctoAIOctoAI offers easy access to efficient compute and enables users to i...
OllamaOllama allows you to run open-source large language models, such as L...
OpenAIThis notebook provides a quick overview for getting started with Open...
PerplexityThis notebook covers how to get started with Perplexity chat models.
PremAIPremAI is an all-in-one platform that simplifies the creation of robu...
PromptLayer ChatOpenAIThis example showcases how to connect to PromptLayer to start recordi...
RekaThis notebook provides a quick overview for getting started with Reka...
SambaNovaCloudThis will help you getting started with SambaNovaCloud chat models. F...
SambaStudioThis will help you getting started with SambaStudio chat models. For ...
Snowflake CortexSnowflake Cortex gives you instant access to industry-leading large l...
solarRelated
SparkLLM ChatSparkLLM chat models API by iFlyTek. For more information, see iFlyTe...
Nebula (Symbl.ai)Overview
Tencent HunyuanTencent's hybrid model API (Hunyuan API)
TogetherThis page will help you get started with Together AI chat models. For...
Tongyi QwenTongyi Qwen is a large language model developed by Alibaba's Damo Aca...
UpstageThis notebook covers how to get started with Upstage chat models.
vLLM ChatvLLM can be deployed as a server that mimics the OpenAI API protocol....
Volc Enging MaasThis notebook provides you with a guide on how to get started with vo...
WriterThis notebook provides a quick overview for getting started with Writ...
xAIThis page will help you get started with xAI chat models. For detaile...
YandexGPTThis notebook goes over how to use Langchain with YandexGPT chat mode...
ChatYIThis will help you getting started with Yi chat models. For detailed ...
Yuan2.0This notebook shows how to use YUAN2 API in LangChain with the langch...
ZHIPU AIThis notebook shows how to use ZHIPU AI API in LangChain with the lan...

Was this page helpful?