ChatOpenAI / ChatAnthropic

LangChain wrappers around LLM providers that expose a consistent interface for chat-based models.

Syntax

langchain
new ChatOpenAI({ model, temperature })
new ChatAnthropic({ model, temperature })

Example

langchain
import { ChatOpenAI } from "@langchain/openai";
import { ChatAnthropic } from "@langchain/anthropic";

const openaiModel = new ChatOpenAI({ model: "gpt-4o", temperature: 0 });
const claudeModel = new ChatAnthropic({ model: "claude-opus-4-5" });

const response = await openaiModel.invoke("Hello!");
console.log(response.content);