채팅 모델 통합
채팅 모델 통합
LangChain JavaScript로 채팅 모델과 통합하는 방법을 안내할게요.
출처: 문서
본문
채팅 모델은 일련의 메시지를 입력으로 받고 메시지를 출력으로 반환하는 언어 모델이에요
설치 및 사용
<CodeGroup>
```bash npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npm install @langchain/openai @langchain/core
```
```bash yarn theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
yarn add @langchain/openai @langchain/core
```
```bash pnpm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pnpm add @langchain/openai @langchain/core
```
</CodeGroup>
Add environment variables:
```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
OPENAI_API_KEY=your-api-key
```
Instantiate the model:
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { ChatOpenAI } from "@langchain/openai";
const model = new ChatOpenAI({ model: "gpt-5.4-mini" });
```
```javascript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
await model.invoke("Hello, world!")
```
<CodeGroup>
```bash npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npm i @langchain/anthropic @langchain/core
```
```bash yarn theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
yarn add @langchain/anthropic @langchain/core
```
```bash pnpm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pnpm add @langchain/anthropic @langchain/core
```
</CodeGroup>
Add environment variables:
```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
ANTHROPIC_API_KEY=your-api-key
```
Instantiate the model:
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { ChatAnthropic } from "@langchain/anthropic";
const model = new ChatAnthropic({
model: "claude-sonnet-4-6",
temperature: 0
});
```
```javascript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
await model.invoke("Hello, world!")
```
<CodeGroup>
```bash npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npm install @langchain/google @langchain/core
```
```bash yarn theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
yarn add @langchain/google @langchain/core
```
```bash pnpm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pnpm add @langchain/google @langchain/core
```
</CodeGroup>
Add environment variables:
```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
GOOGLE_API_KEY=your-api-key
```
Instantiate the model:
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { ChatGoogle } from "@langchain/google";
const model = new ChatGoogle("gemini-2.5-flash");
```
```javascript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
await model.invoke("Hello, world!")
```
<CodeGroup>
```bash npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npm install @langchain/mistralai @langchain/core
```
```bash yarn theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
yarn add @langchain/mistralai @langchain/core
```
```bash pnpm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pnpm add @langchain/mistralai @langchain/core
```
</CodeGroup>
Add environment variables:
```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
MISTRAL_API_KEY=your-api-key
```
Instantiate the model:
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { ChatMistralAI } from "@langchain/mistralai";
const model = new ChatMistralAI({
model: "mistral-large-latest",
temperature: 0
});
```
```javascript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
await model.invoke("Hello, world!")
```
<CodeGroup>
```bash npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npm install @langchain/groq @langchain/core
```
```bash yarn theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
yarn add @langchain/groq @langchain/core
```
```bash pnpm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pnpm add @langchain/groq @langchain/core
```
</CodeGroup>
Add environment variables:
```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
GROQ_API_KEY=your-api-key
```
Instantiate the model:
```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { ChatGroq } from "@langchain/groq";
const model = new ChatGroq({
model: "openai/gpt-oss-120b",
temperature: 0
});
```
```javascript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
await model.invoke("Hello, world!")
```
주요 모델 (Featured models)
| Model | Stream | [Tool Calling](/oss/javascript/langchain/tools/) | [`withStructuredOutput()`](/oss/javascript/langchain/models#structured-output) | [`Multimodal`](/oss/javascript/langchain/messages#multimodal) | Downloads |
| :--- | :--- | :--- | :--- | :--- | :--- |
| [`ChatOpenAI`](/oss/javascript/integrations/chat/openai) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatAnthropic`](/oss/javascript/integrations/chat/anthropic) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatBedrockConverse`](/oss/javascript/integrations/chat/bedrock_converse) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatGroq`](/oss/javascript/integrations/chat/groq) | ✅ | ✅ | ✅ | ❌ |
|
| [`ChatOllama`](/oss/javascript/integrations/chat/ollama) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatMistralAI`](/oss/javascript/integrations/chat/mistral) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatCohere`](/oss/javascript/integrations/chat/cohere) | ✅ | ✅ | ✅ | ❌ |
|
| [`ChatXAI`](/oss/javascript/integrations/chat/xai) | ✅ | ✅ | ✅ | ❌ |
|
| [`ChatGoogle`](/oss/javascript/integrations/chat/google) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatCloudflareWorkersAI`](/oss/javascript/integrations/chat/cloudflare_workersai) | ✅ | ❌ | ❌ | ✅ |
|
| [`ChatFireworks`](/oss/javascript/integrations/chat/fireworks) | ✅ | ✅ | ✅ | ❌ |
|
| [`ChatTogetherAI`](/oss/javascript/integrations/chat/togetherai) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatPerplexity`](/oss/javascript/integrations/chat/perplexity) | ✅ | ❌ | ✅ | ❌ |
|
더 많은 옵션은 아래 채팅 모델 통합 전체 목록을 참고하세요.
라우터 및 프록시 (Routers & proxies)
라우터와 프록시는 단일 API와 자격 증명으로 여러 제공자의 모델에 접근할 수 있게 해줘요. 청구를 단순화하고, 통합 변경 없이 모델 간 전환을 가능하게 하며, 자동 폴백과 같은 기능을 제공해요.
| 제공자 | 통합 | 설명 |
|---|---|---|
| OpenRouter | ChatOpenRouter |
OpenAI, Anthropic, Google, Meta 등의 모델에 대한 통합 접근 |
| FuturMix | ChatOpenAI |
OpenAI 호환 API와 99.99% SLA를 갖춘 22개 이상 모델을 위한 통합 AI 게이트웨이 |
Chat Completions API
일부 모델 제공자는 OpenAI의 (레거시) Chat Completions API와 호환되는 엔드포인트를 제공해요. 이 경우 커스텀 base_url로 ChatOpenAI를 사용해 이러한 엔드포인트에 연결할 수 있어요. Chat Completions API 위에 구축된 기능은 ChatOpenAI에서 완전히 지원되지 않을 수 있다는 점에 유의하세요. 그런 경우 가능하다면 제공자별 클래스를 사용하는 것을 고려하세요.
Auxen은 OpenAI 호환 Chat Completions API를 갖춘 고객 전용 LLM 엔드포인트를 호스팅해요. 커스텀 base URL과 인스턴스별 API 키로 ChatOpenAI를 사용하세요.
Tuning Engines는 관리되는 OpenAI 호환 Chat Completions API를 제공해요. baseURL https://api.tuningengines.com/v1과 Tuning Engines 추론 키로 ChatOpenAI를 사용하세요.
모든 채팅 모델
| Model | Stream | [Tool Calling](/oss/javascript/langchain/tools/) | [`withStructuredOutput()`](/oss/javascript/langchain/models#structured-output) | [`Multimodal`](/oss/javascript/langchain/messages#multimodal) | Downloads |
| :--- | :--- | :--- | :--- | :--- | :--- |
| [`AzureChatOpenAI`](/oss/javascript/integrations/chat/azure) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatOpenAI`](/oss/javascript/integrations/chat/openai) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatAnthropic`](/oss/javascript/integrations/chat/anthropic) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatBedrockConverse`](/oss/javascript/integrations/chat/bedrock_converse) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatGoogleGenerativeAI`](/oss/javascript/integrations/chat/google_generative_ai) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatVertexAI`](/oss/javascript/integrations/chat/google_vertex_ai) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatGroq`](/oss/javascript/integrations/chat/groq) | ✅ | ✅ | ✅ | ❌ |
|
| [`ChatOllama`](/oss/javascript/integrations/chat/ollama) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatMistralAI`](/oss/javascript/integrations/chat/mistral) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatCohere`](/oss/javascript/integrations/chat/cohere) | ✅ | ✅ | ✅ | ❌ |
|
| [`ChatXAI`](/oss/javascript/integrations/chat/xai) | ✅ | ✅ | ✅ | ❌ |
|
| [`ChatGoogle`](/oss/javascript/integrations/chat/google) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatDeepSeek`](/oss/javascript/integrations/chat/deepseek) | ✅ | ✅ | ✅ | ❌ |
|
| [`ChatOpenRouter`](/oss/javascript/integrations/chat/openrouter) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatCerebras`](/oss/javascript/integrations/chat/cerebras) | ✅ | ✅ | ✅ | ❌ |
|
| [`ChatBaiduQianfan`](/oss/javascript/integrations/chat/baidu_qianfan) | | | | |
|
| [`ChatCloudflareWorkersAI`](/oss/javascript/integrations/chat/cloudflare_workersai) | ✅ | ❌ | ❌ | ✅ |
|
| [`ChatFireworks`](/oss/javascript/integrations/chat/fireworks) | ✅ | ✅ | ✅ | ❌ |
|
| [`ChatWatsonx`](/oss/javascript/integrations/chat/ibm) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatTogetherAI`](/oss/javascript/integrations/chat/togetherai) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatYandexGPT`](/oss/javascript/integrations/chat/yandex) | | | | |
|
| [`ChatPerplexity`](/oss/javascript/integrations/chat/perplexity) | ✅ | ❌ | ✅ | ❌ |
|
| [`ChatKServe`](https://gitlab.com/bitkaio/langchain/kserve-provider) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatInterfaze`](https://interfaze.ai/docs) | ✅ | ✅ | ✅ | ✅ |
|
| [`ChatSCX`](https://scx.ai/) | ✅ | ✅ | ✅ | ✅ |
|
| [`Auxen`](https://auxen.ai) | ✅ | ✅ | ✅ | ❌ | N/A |
| [`FakeListChatModel`](/oss/javascript/integrations/chat/fake) | | | | | N/A |
| [`FuturMix`](https://futurmix.ai/) | ✅ | ✅ | ✅ | ✅ | N/A |
| [`Tuning Engines`](https://www.tuningengines.com/) | ✅ | ✅ | ✅ | ❌ | N/A |
더 알아보기
- 이 문서를 MCP로 연결하면 Claude, VSCode 등에서 실시간 답변을 받을 수 있어요.
- GitHub에서 이 페이지 편집하기 또는 이슈 제출하기.