> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-docs-zh.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenRouter 集成

> 通过 LangChain JavaScript 使用 OpenRouter 的统一 API 访问多个提供商的模型。

[OpenRouter](https://openrouter.ai/) 是一个统一 API，通过单个端点提供对来自多个提供者（OpenAI、Anthropic、Google、Meta 等）的模型的访问，具有提供商路由和多模型回退等功能。

## 安装

```bash theme={null}
npm install @langchain/openrouter @langchain/core
```

设置 `OPENROUTER_API_KEY` 在您的环境。有关详细信息，请参阅 [ChatOpenRouter](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/chat/openrouter.md) 页面。

## 对话模型

> [card] [ChatOpenRouter](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/chat/openrouter.md)
>
> 通过 OpenRouter 统一 API 访问来自多个提供商的对话模型。

***

> 官方原文：[src/oss/javascript/integrations/providers/openrouter.mdx](https://github.com/langchain-ai/docs/blob/main/src/oss/javascript/integrations/providers/openrouter.mdx) · 非官方翻译，译文由 AI 生成，以英文原文为准。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.