Tool Tutorial

LangChain 接入 aliapi.me API 教程

在 LangChain 中使用 OpenAI compatible 配置,把 Chat、Embedding、RAG 和 Agent 请求统一发送到 aliapi.me。

接入步骤

  1. 在项目环境变量里配置 aliapi.me API Key。
  2. 创建 ChatOpenAI 实例时传入自定义 baseURL。
  3. 设置模型名称,例如 gpt-4o-minideepseek-chatqwen-plus
  4. RAG 项目中同时配置 Embedding 模型。
  5. 通过控制台查看 Agent 多轮调用的延迟、Token 和错误。

示例配置

baseURL: "https://api.aliapi.me/v1"
apiKey: process.env.ALIAPI_KEY
model: "deepseek-chat"