mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-28 19:35:27 +08:00
docs: rewrite Service API — Provider+Model architecture, add missing endpoints
- Rewrite OpenAPI specs (zh/en/ja) with Provider+Model two-layer architecture - Remove old model schema (requester/requester_config/api_keys on model level) - Add ModelProvider CRUD endpoints - Add missing endpoints: knowledge engines, parsers, plugin config/upgrade, pipeline copy/extensions - Update Service API overview pages (zh/en/ja) with core concepts - Update models config page to explain Provider+Model architecture - Bump API version to 4.9.5
This commit is contained in:
+40
-1
@@ -2,7 +2,7 @@
|
||||
title: "Service API Overview"
|
||||
---
|
||||
|
||||
LangBot provides a set of APIs for external services to integrate. These APIs are authenticated with API keys, which are a subset of the HTTP API. To view the API documentation for frontend-backend communication, please go to the [Development](/en/develop/dev-config) section.
|
||||
LangBot provides a set of RESTful APIs for external services to integrate and automate management. These APIs are authenticated with API keys, which are a subset of the HTTP API.
|
||||
|
||||
<Warning>
|
||||
Service API is currently in Beta and some APIs may change frequently.
|
||||
@@ -18,6 +18,45 @@ After creation, copy the API Key and save it.
|
||||
|
||||

|
||||
|
||||
## Authentication
|
||||
|
||||
All Service APIs support two authentication methods:
|
||||
|
||||
- **API Key**: Via `X-API-Key: <your-key>` or `Authorization: Bearer <your-key>` header
|
||||
- **User Token**: Via `Authorization: Bearer <user-token>` header (obtained after login)
|
||||
|
||||
## Use API
|
||||
|
||||
The left sidebar lists all available APIs. You can fill in your instance address (the port address exposed by the backend, default is `http://localhost:5300`) and API Key, then click the `Try it out` button to call the API.
|
||||
|
||||
## Core Concepts
|
||||
|
||||
### Provider + Model Architecture
|
||||
|
||||
LangBot uses a **Provider + Model** two-layer architecture for AI model management:
|
||||
|
||||
- **Provider**: Defines the API endpoint (`base_url`), requester type, and API keys. A single provider can be associated with multiple models.
|
||||
- **Model**: Associated with a provider (via `provider_uuid`), defining the specific model name and parameters. Models inherit the provider's API endpoint and keys.
|
||||
|
||||
```
|
||||
Provider (OpenAI)
|
||||
├── base_url: https://api.openai.com/v1
|
||||
├── api_keys: [sk-xxx]
|
||||
├── LLM: gpt-4o
|
||||
├── LLM: gpt-4o-mini
|
||||
└── Embedding: text-embedding-3-small
|
||||
```
|
||||
|
||||
This architecture allows you to manage multiple models under a single provider, sharing API configuration and avoiding redundant key entries.
|
||||
|
||||
### Requester
|
||||
|
||||
A requester defines the communication protocol with AI services. Use `GET /api/v1/provider/requesters` to list available requesters. Common requesters include:
|
||||
|
||||
- `openai-chat-completions` — OpenAI-compatible chat completions API (also works with SiliconFlow, DeepSeek, etc.)
|
||||
- `anthropic-messages` — Anthropic Claude API
|
||||
- `openai-embeddings` — OpenAI-compatible embeddings API
|
||||
|
||||
### Async Tasks
|
||||
|
||||
Some operations (plugin install/delete/upgrade) run asynchronously and return a `task_id`. You can track progress in the WebUI.
|
||||
|
||||
+36
-3
@@ -2,7 +2,7 @@
|
||||
title: "Service API 概要"
|
||||
---
|
||||
|
||||
LangBotは、外部サービスと統合するための一連のAPIを提供します。これらのAPIはAPIキーで認証され、HTTP APIのサブセットです。フロントエンドとバックエンドの通信用APIドキュメントを表示するには、[開発](/en/develop/dev-config)セクションにアクセスしてください。
|
||||
LangBotは、外部サービスと統合・自動管理するための RESTful API を提供します。これらのAPIはAPIキーで認証され、HTTP APIのサブセットです。
|
||||
|
||||
<Warning>
|
||||
Service APIは現在ベータ版であり、一部のAPIは頻繁に変更される可能性があります。
|
||||
@@ -10,7 +10,7 @@ Service APIは現在ベータ版であり、一部のAPIは頻繁に変更され
|
||||
|
||||
## APIキーの取得
|
||||
|
||||
WebUIのサイドバーにある`API Keys`ボタンをクリックして、APIキーを作成します。
|
||||
WebUIのサイドバーにある `API Keys` ボタンをクリックして、APIキーを作成します。
|
||||
|
||||

|
||||
|
||||
@@ -18,6 +18,39 @@ WebUIのサイドバーにある`API Keys`ボタンをクリックして、API
|
||||
|
||||

|
||||
|
||||
## 認証方法
|
||||
|
||||
すべてのService APIは、以下の2つの認証方法をサポートしています:
|
||||
|
||||
- **APIキー**: `X-API-Key: <your-key>` または `Authorization: Bearer <your-key>` ヘッダー経由
|
||||
- **ユーザートークン**: `Authorization: Bearer <user-token>` ヘッダー経由(ログイン後に取得)
|
||||
|
||||
## APIの使用
|
||||
|
||||
左サイドバーには、利用可能なすべてのAPIが一覧表示されています。インスタンスアドレス(バックエンドが公開するポートアドレス、デフォルトは`http://localhost:5300`)とAPIキーを入力し、`Try it out`ボタンをクリックしてAPIを呼び出すことができます。
|
||||
左サイドバーには、利用可能なすべてのAPIが一覧表示されています。インスタンスアドレス(デフォルトは `http://localhost:5300`)とAPIキーを入力し、`Try it out` ボタンをクリックしてAPIを呼び出せます。
|
||||
|
||||
## コアコンセプト
|
||||
|
||||
### Provider + Model アーキテクチャ
|
||||
|
||||
LangBotは **プロバイダー(Provider)+ モデル(Model)** の2層アーキテクチャでAIモデルを管理します:
|
||||
|
||||
- **プロバイダー**: APIエンドポイント(`base_url`)、リクエスタータイプ、APIキーを定義。1つのプロバイダーに複数のモデルを関連付け可能。
|
||||
- **モデル**: プロバイダーに関連付け(`provider_uuid` 経由)、具体的なモデル名とパラメータを定義。プロバイダーのAPIエンドポイントとキーを継承。
|
||||
|
||||
```
|
||||
Provider (OpenAI)
|
||||
├── base_url: https://api.openai.com/v1
|
||||
├── api_keys: [sk-xxx]
|
||||
├── LLM: gpt-4o
|
||||
├── LLM: gpt-4o-mini
|
||||
└── Embedding: text-embedding-3-small
|
||||
```
|
||||
|
||||
### リクエスター
|
||||
|
||||
リクエスターはAIサービスとの通信プロトコルを定義します。`GET /api/v1/provider/requesters` で利用可能なリクエスター一覧を取得できます。
|
||||
|
||||
### 非同期タスク
|
||||
|
||||
一部の操作(プラグインのインストール/削除/アップグレード)は非同期で実行され、`task_id` を返します。WebUIで進捗を確認できます。
|
||||
|
||||
+1650
-1700
File diff suppressed because it is too large
Load Diff
+1655
-1705
File diff suppressed because it is too large
Load Diff
+1235
-2130
File diff suppressed because it is too large
Load Diff
+42
-3
@@ -2,7 +2,7 @@
|
||||
title: "Service API 概述"
|
||||
---
|
||||
|
||||
LangBot 提供了一套供外部服务使用的 API 接口,便于集成。这些接口以 API Key 鉴权,是目前 HTTP API 的子集。要查看前后端通信的 API 文档,请前往[开发](/zh/develop/dev-config)部分。
|
||||
LangBot 提供了一套供外部服务使用的 RESTful API 接口,便于集成和自动化管理。这些接口以 API Key 鉴权,是目前 HTTP API 的子集。
|
||||
|
||||
<Warning>
|
||||
Service API 目前处于 Beta 阶段,部分接口可能会频繁变动。
|
||||
@@ -10,7 +10,7 @@ Service API 目前处于 Beta 阶段,部分接口可能会频繁变动。
|
||||
|
||||
## 获取 API Key
|
||||
|
||||
点击 WebUI 侧栏的`API Keys`按钮,创建一个 API Key。
|
||||
点击 WebUI 侧栏的 `API Keys` 按钮,创建一个 API Key。
|
||||
|
||||

|
||||
|
||||
@@ -18,6 +18,45 @@ Service API 目前处于 Beta 阶段,部分接口可能会频繁变动。
|
||||
|
||||

|
||||
|
||||
## 认证方式
|
||||
|
||||
所有 Service API 都支持以下两种认证方式:
|
||||
|
||||
- **API Key**:通过请求头 `X-API-Key: <your-key>` 或 `Authorization: Bearer <your-key>` 传递
|
||||
- **用户令牌**:通过请求头 `Authorization: Bearer <user-token>` 传递(登录后获取)
|
||||
|
||||
## 使用 API
|
||||
|
||||
左侧列出了所有可用的 API,您可以填入您的实例地址(后端开放的端口地址,默认为 `http://localhost:5300`)和 API Key,然后点击`Try it out`按钮即可调用 API。
|
||||
左侧列出了所有可用的 API,您可以填入您的实例地址(后端开放的端口地址,默认为 `http://localhost:5300`)和 API Key,然后点击 `Try it out` 按钮即可调用 API。
|
||||
|
||||
## 核心概念
|
||||
|
||||
### Provider + Model 架构
|
||||
|
||||
LangBot 采用 **供应商(Provider)+ 模型(Model)** 的两层架构来管理 AI 模型:
|
||||
|
||||
- **供应商(Provider)**:定义 API 地址(base_url)、请求器类型(requester)和 API 密钥(api_keys)。一个供应商可以关联多个模型。
|
||||
- **模型(Model)**:关联到一个供应商(通过 `provider_uuid`),定义具体的模型名称和参数。模型继承供应商的 API 地址和密钥。
|
||||
|
||||
```
|
||||
Provider (OpenAI)
|
||||
├── base_url: https://api.openai.com/v1
|
||||
├── api_keys: [sk-xxx]
|
||||
├── LLM: gpt-4o
|
||||
├── LLM: gpt-4o-mini
|
||||
└── Embedding: text-embedding-3-small
|
||||
```
|
||||
|
||||
这种架构允许您在同一供应商下管理多个模型,共享 API 配置,避免重复填写密钥。
|
||||
|
||||
### 请求器(Requester)
|
||||
|
||||
请求器定义了与 AI 服务通信的协议。可通过 `GET /api/v1/provider/requesters` 获取可用请求器列表。常见的请求器包括:
|
||||
|
||||
- `openai-chat-completions` — OpenAI 兼容的聊天补全 API(也适用于国内服务商如硅基流动、DeepSeek 等)
|
||||
- `anthropic-messages` — Anthropic Claude API
|
||||
- `openai-embeddings` — OpenAI 兼容的向量嵌入 API
|
||||
|
||||
### 异步任务
|
||||
|
||||
部分操作(插件安装/删除/升级)为异步执行,接口返回 `task_id`。可通过 WebUI 查看任务进度。
|
||||
|
||||
@@ -12,7 +12,23 @@ LangBot Models 是 LangBot 官方提供的模型服务。当您使用 LangBot Sp
|
||||
|
||||
## 自定义模型
|
||||
|
||||
您也可以添加其他来源的模型。
|
||||
您也可以添加其他来源的模型。LangBot 采用 **供应商(Provider)+ 模型(Model)** 的两层架构:
|
||||
|
||||
- **供应商**:定义 API 地址(Base URL)和 API 密钥。同一供应商下的所有模型共享这些配置。
|
||||
- **模型**:关联到一个供应商,指定具体的模型名称和能力。
|
||||
|
||||
```
|
||||
供应商 (OpenAI)
|
||||
├── Base URL: https://api.openai.com/v1
|
||||
├── API Keys: [sk-xxx]
|
||||
├── LLM 模型: gpt-4o
|
||||
├── LLM 模型: gpt-4o-mini
|
||||
└── 向量模型: text-embedding-3-small
|
||||
```
|
||||
|
||||
<Tip>
|
||||
同一供应商下可以添加多个模型,它们会自动继承供应商的 API 地址和密钥,无需重复填写。
|
||||
</Tip>
|
||||
|
||||
### 对话模型 (LLM Model)
|
||||
|
||||
@@ -20,16 +36,15 @@ LangBot Models 是 LangBot 官方提供的模型服务。当您使用 LangBot Sp
|
||||
|
||||

|
||||
|
||||
可以添加多个模型,然后再流水线中选择具体使用什么模型
|
||||
可以添加多个模型,然后在流水线中选择具体使用什么模型。
|
||||
|
||||
<img width="400px" src="/images/zh/deploy/models/model_config.png" alt="model_config" />
|
||||
|
||||
填入这四个参数`模型名称`、`模型供应商`、`请求 URL`、`API Key`,然后提交即可
|
||||
填入 `模型名称`、选择 `模型供应商`(或新建供应商并填入 `请求 URL` 和 `API Key`),然后提交即可。
|
||||
|
||||
模型能力方面,请根据具体模型特性来选择:
|
||||
|
||||
- 视觉能力:需要启用才可以识图
|
||||
|
||||
- 函数调用:需要启用才可以在对话中使用 Agent 工具
|
||||
|
||||
### 嵌入模型 (Embedding Model)
|
||||
@@ -38,7 +53,7 @@ LangBot Models 是 LangBot 官方提供的模型服务。当您使用 LangBot Sp
|
||||
|
||||
<img width="400px" src="/images/zh/deploy/models/embedding_model.png" alt="embedding_model" />
|
||||
|
||||
填入这四个参数`模型名称`、`模型供应商`、`请求 URL`、`API Key`,然后提交即可,之后请在知识库中配置使用此模型。
|
||||
填入 `模型名称`、选择 `模型供应商`,然后提交即可。之后请在知识库中配置使用此模型。
|
||||
|
||||
### 使用 seekdb 内置嵌入模型(零配置)
|
||||
系统已集成 seekdb 提供的官方嵌入模型,无需填写任何参数。
|
||||
|
||||
Reference in New Issue
Block a user