Popular Chat Model Providers
OpenAI
GPT-4, GPT-4o, GPT-3.5 Turbo, and more
Anthropic
Claude 3.5 Sonnet, Claude 3 Opus, and Haiku
Gemini 2.0, Gemini 1.5 Pro and Flash
Mistral AI
Mistral Large, Medium, and Small models
Cohere
Command R and Command R+ models
Groq
Fast inference with Llama, Mixtral, and Gemma
OpenAI
The@langchain/openai package provides access to OpenAI’s chat models including GPT-4, GPT-4o, and GPT-3.5 Turbo.
Installation
Usage
Streaming
Tool Calling
Anthropic
The@langchain/anthropic package provides access to Anthropic’s Claude models.
Installation
Usage
Vision Support
@langchain/google-genai package provides access to Google’s Gemini models.
Installation
Usage
Mistral AI
The@langchain/mistralai package provides access to Mistral’s models.
Installation
Usage
Cohere
The@langchain/cohere package provides access to Cohere’s Command models.
Installation
Usage
Groq
The@langchain/groq package provides fast inference with various open-source models.
Installation
Usage
Additional Providers
AWS Bedrock
@langchain/aws - Access Claude, Llama, and other models via AWSAzure OpenAI
@langchain/openai - Use OpenAI models through AzureOllama
@langchain/ollama - Run local models with OllamaDeepSeek
@langchain/deepseek - DeepSeek models for reasoningCerebras
@langchain/cerebras - Fast inference with Cerebras hardwarexAI
@langchain/xai - Grok models from xAICommunity Integrations
Additional chat models are available in@langchain/community:
Common Features
All chat models in LangChain.js implement theBaseChatModel interface and support:
- Invoke: Single message generation
- Stream: Token-by-token streaming
- Batch: Process multiple inputs in parallel
- Tool Calling: Function/tool invocation (where supported by provider)
- Structured Output: Extract structured data with schemas
- Vision: Image understanding (where supported by provider)
- Callbacks: Track tokens, timing, and errors
Best Practices
- Use environment variables for API keys
- Enable streaming for better user experience
- Set appropriate timeouts for production applications
- Monitor token usage to control costs
- Handle rate limits with retries and backoff
- Use batch processing when possible for efficiency
Next Steps
Working with Chat Models
Learn to use chat models effectively
Building Agents
Build autonomous agents with tool calling
Prompt Engineering
Create reusable prompts for your models
Embeddings
Generate embeddings for semantic search
