import { Callout } from "nextra/components"; # API / Gateway 参考 DeerFlow Gateway 是基于 FastAPI 构建的,提供交互式 API 文档,可通过 http://localhost:8001/docs 访问。 ## 基础 URL ``` http://localhost:8001 ``` 通过 nginx 代理: ``` http://localhost:2026/api ``` ## 核心端点 ### 系统 | 方法 | 路径 | 描述 | |---|---|---| | `GET` | `/health` | 服务健康检查 | | `GET` | `/api/models` | 获取已配置的模型列表 | ### Agent 管理 | 方法 | 路径 | 描述 | |---|---|---| | `GET` | `/api/agents` | 列出所有 Agent | | `POST` | `/api/agents` | 创建自定义 Agent | | `GET` | `/api/agents/{name}` | 获取 Agent 配置 | | `PUT` | `/api/agents/{name}` | 更新 Agent 配置 | | `DELETE` | `/api/agents/{name}` | 删除 Agent | | `POST` | `/api/agents/check` | 检查/建议 Agent slug 唯一性 | ### 线程和记忆 | 方法 | 路径 | 描述 | |---|---|---| | `GET` | `/api/threads` | 列出线程 | | `DELETE` | `/api/threads/{thread_id}` | 删除线程 | | `GET` | `/api/memory` | 获取全局记忆 | | `GET` | `/api/memory/{agent_name}` | 获取 Agent 特定记忆 | | `DELETE` | `/api/memory` | 清除全局记忆 | ### 扩展 | 方法 | 路径 | 描述 | |---|---|---| | `GET` | `/api/extensions` | 列出所有扩展(MCP 服务器和技能) | | `POST` | `/api/extensions/mcp/{name}/enable` | 启用 MCP 服务器 | | `POST` | `/api/extensions/mcp/{name}/disable` | 禁用 MCP 服务器 | | `POST` | `/api/extensions/skills/{name}/enable` | 启用技能 | | `POST` | `/api/extensions/skills/{name}/disable` | 禁用技能 | ### 文件上传 | 方法 | 路径 | 描述 | |---|---|---| | `POST` | `/api/uploads/{thread_id}` | 上传文件到线程工作区 | | `GET` | `/api/uploads/{thread_id}/{filename}` | 获取上传的文件 | 完整的交互式 API 文档请访问 `http://localhost:8001/docs`(Swagger UI)。