Skip to main content

Integrations: Chat Models

LangChain offers a number of Chat Models implementations that integrate with various model providers. These are:

OpenAI

import { ChatOpenAI } from "langchain/chat_models/openai";

const model = new ChatOpenAI({
temperature: 0.9,
openAIApiKey: "YOUR-API-KEY", // In Node.js defaults to process.env.OPENAI_API_KEY
});

Anthropic

import { ChatAnthropic } from "langchain/chat_models/anthropic";

const model = new ChatAnthropic({
temperature: 0.9,
apiKey: "YOUR-API-KEY", // In Node.js defaults to process.env.ANTHROPIC_API_KEY
});