mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-11-04 23:03:55 +08:00
增加 New API 接入教程 (#63)
* chore: add new api * fix: typos --------- Co-authored-by: Junyan Qin <[email protected]>
This commit is contained in:
@@ -218,6 +218,10 @@ export default defineConfig({
|
||||
text: "容器网络配置详解",
|
||||
link: "/zh/workshop/network-details",
|
||||
},
|
||||
{
|
||||
text: "使用 New API 中转多种渠道模型",
|
||||
link: "/zh/workshop/newapi-integration"
|
||||
},
|
||||
{
|
||||
text: "接入来自胜算云的模型",
|
||||
link: "/zh/workshop/shengsuanyun-integration"
|
||||
@@ -466,6 +470,10 @@ export default defineConfig({
|
||||
text: "Container Network Configuration Details",
|
||||
link: "/en/workshop/network-details",
|
||||
},
|
||||
{
|
||||
text: "Using New API to Transmit Models from Multiple Channels",
|
||||
link: "/en/workshop/newapi-integration"
|
||||
},
|
||||
{
|
||||
text: "Integrating PPIO API Model",
|
||||
link: "/en/workshop/ppio-integration"
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 176 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 186 KiB |
@@ -0,0 +1,44 @@
|
||||
# Integrating LangBot with New API
|
||||
|
||||
New API is a next-generation large model gateway and AI asset management system, designed to address issues such as fragmented access to multiple AI service providers, difficulty in cost control, and insufficient service stability. Its core advantages are focused on three aspects:
|
||||
|
||||
1. **Multi-provider compatibility**: It has integrated **over 30 AI service providers** and achieved **100% OpenAI compatibility** (that is, it supports calling models from other service providers in the OpenAI interface format, reducing development costs);
|
||||
2. **High availability**: It promises **99.9% service availability** to meet enterprise-level stability requirements;
|
||||
3. **Ease of use and controllability**: It supports "one-click deployment" for quick access, and also provides a "flexible billing" function to help users control AI usage costs, while taking into account "security and stability" features.
|
||||
|
||||
## 1. Deploy New API Locally (Docker Container Method)
|
||||
|
||||
> For more deployment methods, refer to the [New API Deployment Guide](https://docs.newapi.pro/installation/)
|
||||
|
||||
This deployment method uses an SQLite database (lightweight, no additional deployment required).
|
||||
|
||||
Enter in the command line:
|
||||
|
||||
```bash
|
||||
docker run --name new-api -d --restart always \
|
||||
-p 3000:3000 \
|
||||
-e TZ=Asia/Shanghai \
|
||||
-v ./new-api/data:/data \
|
||||
calciumion/new-api:latest
|
||||
```
|
||||
|
||||
> ⚠️ Note:
|
||||
> - Replace `./new-api/data` with the actual folder you want to use.
|
||||
|
||||
After deployment, open `http://server-IP:3000` to configure New API.
|
||||
|
||||
## 2. Connect LangBot to Local New API
|
||||
|
||||
1. **Add New API Model**
|
||||
- Model Name: Enter the model name configured in New API
|
||||
- Model Provider: Select New API
|
||||
- Request URL: Enter `http://server-IP:3000/v1`
|
||||
- API Key: Enter the token created in New API
|
||||
|
||||

|
||||
|
||||
2. **Select the newly configured model in the pipeline**
|
||||
|
||||

|
||||
|
||||
3. Now you can use the models in New API.
|
||||
@@ -0,0 +1,44 @@
|
||||
# LangBot 接入 New API
|
||||
|
||||
New API 是新一代大模型网关与 AI 资产管理系统,旨在解决多 AI 服务商接入分散、成本难管控、服务稳定性不足等问题,核心优势集中在三点:
|
||||
|
||||
1. **多服务商兼容**:已整合 **30+ AI 服务商**,且实现 **100% OpenAI 兼容**(即支持按 OpenAI 接口格式调用其他服务商模型,降低开发成本);
|
||||
2. **高可用性**:承诺 **99.9% 服务可用性**,满足企业级稳定需求;
|
||||
3. **易用与可控**:支持 “一键部署” 快速接入,同时提供 “灵活计费” 功能,帮助用户管控 AI 使用成本,兼顾 “安全稳定” 特性。
|
||||
|
||||
## 一、本地部署 New API(Docker 容器方式)
|
||||
|
||||
> 更多部署方式,参考 [New API 部署指南](https://docs.newapi.pro/installation/)
|
||||
|
||||
本部署方式使用 SQLite 数据库(轻量无需额外部署)
|
||||
|
||||
命令行中输入
|
||||
|
||||
```bash
|
||||
docker run --name new-api -d --restart always \
|
||||
-p 3000:3000 \
|
||||
-e TZ=Asia/Shanghai \
|
||||
-v ./new-api/data:/data \
|
||||
calciumion/new-api:latest
|
||||
```
|
||||
|
||||
> ⚠️ 注意:
|
||||
> - 把 `./new-api/data` 替换成你要使用的实际文件夹
|
||||
|
||||
部署完成后,打开`http://服务器IP:3000`进行配置 New API
|
||||
|
||||
## 二、LangBot 连接本地 New API
|
||||
|
||||
1. **添加 New API 模型**
|
||||
- 模型名称:输入 New API 中配置的模型名称
|
||||
- 模型供应商:选择 New API
|
||||
- 请求 URL:输入`http://服务器IP:3000/v1`
|
||||
- API Key:输入 New API 中创建的令牌
|
||||
|
||||

|
||||
|
||||
2. **流水线选择使用刚才配置的模型**
|
||||
|
||||

|
||||
|
||||
3. 接下来就可以使用 New API 中的模型了
|
||||
Reference in New Issue
Block a user