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

# LiteLLM 集成

> 使用 LangChain Python 与 LiteLLM 集成。

> [LiteLLM](https://github.com/BerriAI/litellm) 是一个简化调用 Anthropic、Azure、Huggingface、Replicate 等服务的库。

## 安装与设置

<CodeGroup>
  ```bash pip theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  pip install langchain-litellm
  ```

  ```bash uv theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  uv add langchain-litellm
  ```
</CodeGroup>

## 聊天模型

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_litellm import ChatLiteLLM
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_litellm import ChatLiteLLMRouter
```

更多详情请参阅 [LiteLLM 聊天指南](/oss/python/integrations/chat/litellm)。

***

## API 参考

有关所有 `ChatLiteLLM` 和 `ChatLiteLLMRouter` 功能与配置的详细文档，请访问 [API 参考](https://reference.langchain.com/python/langchain-litellm)。

***

<div className="source-links">
  <Callout icon="terminal-2">
    [连接这些文档](/use-these-docs) 到 Claude、VSCode 等工具，通过 MCP 获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/providers/litellm.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
