---
type: study
created: 2026-08-11
updated: 2026-08-11
sensitivity: standard
status: evergreen
tags: [langchain, python, providers, model-api]
topic: LangChain Python 独立模型 API 与检索服务供应商
sources:
  - https://docs.langchain.com/oss/python/integrations/providers/ai21
  - https://docs.langchain.com/oss/python/integrations/providers/aimlapi
  - https://docs.langchain.com/oss/python/integrations/providers/anthropic
  - https://docs.langchain.com/oss/python/integrations/providers/baseten
  - https://docs.langchain.com/oss/python/integrations/providers/cerebras
  - https://docs.langchain.com/oss/python/integrations/providers/cohere
  - https://docs.langchain.com/oss/python/integrations/providers/deepseek
  - https://docs.langchain.com/oss/python/integrations/providers/fireworks
  - https://docs.langchain.com/oss/python/integrations/providers/groq
  - https://docs.langchain.com/oss/python/integrations/providers/mistralai
  - https://docs.langchain.com/oss/python/integrations/providers/modelscope
  - https://docs.langchain.com/oss/python/integrations/providers/openai
  - https://docs.langchain.com/oss/python/integrations/providers/openrouter
  - https://docs.langchain.com/oss/python/integrations/providers/parallel
  - https://docs.langchain.com/oss/python/integrations/providers/perplexity
  - https://docs.langchain.com/oss/python/integrations/providers/pipeshift
  - https://docs.langchain.com/oss/python/integrations/providers/predictionguard
  - https://docs.langchain.com/oss/python/integrations/providers/replicate
  - https://docs.langchain.com/oss/python/integrations/providers/sambanova
  - https://docs.langchain.com/oss/python/integrations/providers/together
  - https://docs.langchain.com/oss/python/integrations/providers/upstage
  - https://docs.langchain.com/oss/python/integrations/providers/voyageai
  - https://docs.langchain.com/oss/python/integrations/providers/xai
last_verified: 2026-08-11
---

# 独立模型服务供应商

## 定位

这些 provider 主要通过独立 Python 包暴露 Chat、LLM、Embedding、Rerank 或搜索能力。与“大云全家桶”相比，它们往往接入快、模型特性更新快，但数据位置、账户层级、速率限制和客户端成熟度差异更大。

## 供应商速查

| Provider | 包/主要组件 | 能力重点 | 必查风险 |
|---|---|---|---|
| AI21 | `langchain-ai21`; ChatAI21、AI21LLM、ContextualAnswers、SemanticTextSplitter | Chat + 传统 LLM + 语义分块 | 文档将部分能力标为 deprecated，新项目不要依赖旧类 |
| AI/ML API | `langchain-aimlapi`; ChatAIMLAPI、AIMLAPILLM、AIMLAPIEmbeddings | 多模型 API | 网关后的真实 provider/model 会影响特性、费用与数据路由 |
| Anthropic | `langchain-anthropic` | Claude Chat/LLM，tool use、structured output、图像/PDF、prompt caching | 严格工具模式、细粒度工具流与普通 stream 需分别测试；实验性 tools wrapper 已废弃 |
| Baseten | `langchain-baseten`; ChatBaseten、BasetenEmbeddings | 托管/自定义模型端点 | 只有部署实现能决定工具、多模态和 schema 能力 |
| Cerebras | `langchain-cerebras`; ChatCerebras | 低延迟 Chat、流式/异步、tool + structured output | 文档能力表无多模态/logprobs；必须设置并发与限流预算 |
| Cohere | `langchain-cohere`; ChatCohere、Cohere LLM/Embeddings/Rerank/RAG retriever | 生成、检索、rerank 组合 | provider 页混合多组件；应分开管理 generation 与 embedding/rerank 的配额和版本 |
| DeepSeek | `langchain-deepseek`; ChatDeepSeek | tool、structured output、streaming | 不应用 `ChatOpenAI` 替代专用类，否则 reasoning 扩展字段可丢失 |
| Fireworks | `langchain-fireworks`; Chat + Embeddings | 模型托管、tool/structured output、logprobs | 模型 ID 与 serverless/dedicated 端点应固定，不以账户默认值上线 |
| Groq | `langchain-groq`; ChatGroq | 高速 Chat、tool、structured output，部分视觉 | 图像能力取决于模型；配额、突发并发与 429 退避需实测 |
| Mistral AI | `langchain-mistralai`; ChatMistralAI、MistralAIEmbeddings | Chat + Embeddings | 文档能力表的 Chat 不含多模态/logprobs，不要从品牌模型能力反推类能力 |
| ModelScope | `langchain-modelscope-integration`; Chat/Endpoint/Embeddings | ModelScope 托管端点 | SDK token、endpoint 版本和模型许可需同时校验 |
| OpenAI | `langchain-openai`; ChatOpenAI、OpenAI/Azure LLM、Embeddings | Responses/Chat Completions、tools、schema、多模态、streaming usage | 仅针对 OpenAI 官方规范；代理端点非标准字段不保留；`base_url` 可改变 `stream_usage` 默认行为 |
| OpenRouter | `langchain-openrouter`; ChatOpenRouter | 多 provider 路由、tools/schema/reasoning/多模态 | 应锁定路由策略和允许 provider；失败切换可改变输出契约、数据地域和成本 |
| Parallel | `langchain-parallel`; Chat、tools、retrievers | 研究模型、引用和检索 | Chat 文档显示无 tool calling，structured output 仅研究模型；应保留引用并验证可访问性 |
| Perplexity | `langchain-perplexity`; Chat、SearchRetriever/Tool、Embeddings | 带搜索证据的回答 | structured output 需特定账户层级；搜索结果/引用元数据是产品契约的一部分 |
| Pipeshift | `langchain-pipeshift`; ChatPipeshift、Pipeshift LLM | Chat + 传统 LLM | 文档能力较少，上线前要补齐 timeout/retry/stream/schema 实测 |
| PredictionGuard | `langchain-predictionguard`; Chat/LLM/Embeddings | PII、prompt injection、toxicity、factuality 等防护 | 防护结果应 fail-closed 还是降级必须明确；不能将它当作业务授权替代品 |
| Replicate | `replicate` | 调用 Replicate 模型 | 输入/输出 schema 由模型版本决定；必须 pin version，处理异步任务、超时和费用上限 |
| SambaNova | `langchain-sambanova`; Chat + Embeddings | tool/schema、stream/async、图像/音频 | 多模态与 async 要用目标模型实测；账户限流不应共用无界重试 |
| Together | `langchain-together`; ChatTogether、Together LLM/Embeddings | 多模型托管、多模态 | Chat 能力表显示 native async 为否，应避免在 async 服务中默认假设非阻塞 I/O |
| Upstage | `langchain-upstage`; Chat、Embeddings、Document Parse、Groundedness | Solar + 文档处理/RAG | 各组件应分开超时和配额；文档解析结果不能默认视为完整或安全 |
| Voyage AI | `langchain-voyageai`; VoyageAIEmbeddings、VoyageAIRerank | 检索向量 + rerank | embedding 和 reranker 必须分别固定模型；换模型需全量重建/重评估 |
| xAI | `langchain-xai`; ChatXAI | tool/schema、web search、reasoning | Chat 文档能力表无多模态且无 native async；搜索工具需额外的数据与引用策略 |

## 接入契约

- 每个 provider 的 package 版本单独锁定；不要仅升级 `langchain` 就假设集成包同步兼容。
- 用统一应用内部类型封装 model ID、timeout、retry、temperature/max output、stream 和 trace metadata，但保留 provider-specific response metadata，不强行丢弃 reasoning/citation/safety 字段。
- 对 400/401/403/404 默认不重试；对 429/5xx 只在请求幂等、剩余 deadline 足够且服务端未接受工具副作用时进行有界重试。
- 建立“最小能力”契约测试：普通 invoke、stream 终止、usage、一个工具、一个严格 schema、一个拒答/安全结果；多模态产品再增加 URL/base64/file 输入边界。

## 不应混为一件事的能力

Chat 生成、web search、embedding、rerank、文档解析和安全审核是不同的可用性与费用域。即使同一 provider 包同时提供这些类，也应分开配额、超时、熔断、敏感数据授权与 SLO，避免一个检索故障拖垮所有对话请求。
