你可以把 LangChain 当作 OpenAI 来用。
你只需要设置 base URL 与 API key。
你先准备什么
- 你在 Console 创建 API key。
- 你准备好 base URL:
https://api.yelinai.com/v1
Python 示例
对话补全
查看端点与参数。
模型列表
获取模型 id。
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Nano Banana 调价:Pro $0.08,Banana2 $0.05 → Try / 试用
让 LangChain 指向 YeLin AI 的 OpenAI 兼容接口。
https://api.yelinai.com/v1import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["YELIN_API_KEY"],
base_url="https://api.yelinai.com/v1",
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "用一句话解释 RAG"}],
)
print(resp.choices[0].message.content)