跳到正文Skip to content
OpenMousse
完整的文档索引见llms.txt。在网址后加.md可以拿到 Markdown 版本;本页的 Markdown 版本是api.zh-CN.md。
开发

程序调用接口

通过兼容 OpenAI 的 API 或 ACP 协议将 OpenMousse 作为模型或 agent 直接调用 [即将推出]。

本页介绍如何通过兼容 OpenAI 的 API 或 ACP 协议 即将推出,在代码编辑器或外部程序中直接调用 OpenMousse。

除手机 app 与网页端外,OpenMousse 内核 即将推出 对外提供标准化的程序调用接口。支持自定义模型接口或 ACP 协议的外部工具(如代码编辑器、命令行脚本或本地工作流)可以直接向你的 OpenMousse 服务器发起请求,在调用模型的同时复用世界树与功能 Agent 的能力。在 server.json 中启用 engine.api(设为 true 或限制可用 agents 的对象)后,在服务器上运行 python3 tokens.py add api(可调用全部 Agent)或创建名为 api-<agent id> 的令牌(仅限单个 Agent),通过请求头 Authorization: Bearer <token>(或 X-API-Key)认证即可调用 GET /v1/models、GET /v1/models/{id}、POST /v1/chat/completions(兼容 OpenAI 格式,stream: true 返回 SSE;model 填 openmousse/<agent id>,填 openmousse 或留空则对应主对话,可通过 X-Session-Id 请求头延续会话)、GET /v1/openmousse/sessions 与 POST /v1/openmousse/approvals/{id}(例如:curl https://<your-server>/v1/chat/completions -H "Authorization: Bearer $OPENMOUSSE_TOKEN" -H "Content-Type: application/json" -d '{"model": "openmousse/main", "messages": [{"role": "user", "content": "..."}]}')。

支持的协议

  • •兼容 OpenAI 的 API:提供标准的对话补全接口。你可以将外部工具的 API 基础地址(Base URL)指向你的 OpenMousse 服务器,填入服务器签发的访问令牌,将其作为标准 OpenAI 模型调用。
  • •ACP 协议:支持通过 ACP(Agent Client Protocol,采用一行一条 JSON-RPC 消息的通信格式)供代码编辑器等客户端直接调用 OpenMousse agent,并按内核的发言方权限分档处理请求。
注意:调用权限与工具边界

经由程序调用接口发起的请求同样受内核的工具分档与权限规则约束。涉及付款、对外发送、提交或登录等撤不回的操作,仍会生成确认卡放入收件箱,等你批准后才会执行。

与世界树 MCP 接口的区别

你可以根据外部工具的类型选择接入方式:

接入方式适用场景读写范围与能力
世界树 MCP 接口Claude、ChatGPT、Gemini、Notion、Claude Code 等自带模型的外部 AI 应用。外部应用使用其自身的模型回答;仅通过 profile、recall、remember、recent、forget 五个工具读写世界树,不访问各功能 Agent 与对话记录。
程序调用接口(OpenAI 兼容 / ACP) 即将推出代码编辑器、自动化脚本或需要由 OpenMousse 内核驱动的客户端。由 OpenMousse 内核调用你配置的模型并组装上下文,以对应 Agent 的身份运行回合并遵循其工具与确认门控:撤不回的操作仍会在该 Agent 的对话中生成确认卡等待你在 app 内确认;调用方仅可批准或拒绝自身会话中产生的确认卡(若 engine.api.approve 设为 false 则不可审批);API 令牌不能配对设备,也不能调用服务端其余 /api 接口。

另见

  • •内核(agent harness):了解内核的权限回合与工具三档机制。
  • •把你常用的 AI 接进世界树:使用 MCP 地址将外部 AI 应用接入世界树。
最后更新于 2026-10-19这一页有帮助吗?
For a complete index of the docs, see llms.txt. Append .md to any URL for the Markdown version; this page's Markdown is at api.md.
Developer

Programmatic API

Call OpenMousse directly as a model or agent via the OpenAI-compatible API or ACP protocol [Coming soon].

This page explains how to call OpenMousse directly from code editors or external programs via the OpenAI-compatible API or the ACP protocol Coming soon.

In addition to the mobile app and web app, the OpenMousse engine Coming soon exposes standardized programmatic APIs. External tools that support custom model endpoints or the ACP protocol (such as code editors, command-line scripts, or local workflows) can send requests directly to your OpenMousse server, reusing the memory tree and functional agent capabilities alongside model calls. Enable engine.api in server.json (true, or an object limiting agents), create a token on the server with python3 tokens.py add api (all agents) or a token named api-<agent id> (one agent only), and send it as Authorization: Bearer <token> (or X-API-Key) to call GET /v1/models, GET /v1/models/{id}, POST /v1/chat/completions (OpenAI format, with stream: true returning SSE; set model to openmousse/<agent id>, or openmousse / empty for main chat, and pass X-Session-Id to continue a session), GET /v1/openmousse/sessions, and POST /v1/openmousse/approvals/{id} (for example: curl https://<your-server>/v1/chat/completions -H "Authorization: Bearer $OPENMOUSSE_TOKEN" -H "Content-Type: application/json" -d '{"model": "openmousse/main", "messages": [{"role": "user", "content": "..."}]}').

Supported Protocols

  • •OpenAI-compatible API: Provides a standard chat completions endpoint. Point your external tool's API Base URL to your OpenMousse server and supply an access token issued by the server to call it as a standard OpenAI model.
  • •ACP protocol: Supports ACP (Agent Client Protocol, a communication format using newline-delimited JSON-RPC messages) so clients such as code editors can call an OpenMousse agent directly, with requests governed by the engine's speaker permission tiers.
Important: Call permissions and tool boundaries

Requests made through the programmatic API are subject to the same engine tool tiers and permission rules. Irreversible operations involving payments, external messages, submissions, or logins still generate an approval card in the inbox and execute only after you approve.

Comparison with the Memory Tree MCP Endpoint

Choose an integration method based on the type of external tool:

Integration MethodUse CaseRead/Write Scope and Capabilities
Memory tree MCP endpointExternal AI apps that bring their own models, such as Claude, ChatGPT, Gemini, Notion, and Claude Code.The external app answers using its own model; it reads and writes the memory tree exclusively through the five tools profile, recall, remember, recent, and forget, without accessing functional agents or conversation history.
Programmatic API (OpenAI-compatible / ACP) Coming soonCode editors, automation scripts, or clients that need to be driven by the OpenMousse engine.The OpenMousse engine calls your configured model, assembles context, and runs turns as the target agent with that agent's own tools and approval gates: irreversible actions still wait for approval in the app attached to that agent's chat; the caller may approve or reject only cards raised in its own sessions (and not at all if engine.api.approve is false); API tokens cannot pair devices or act on the rest of the server's /api.

See Also

  • •Engine (Agent Harness): Learn about the engine's permission turns and three-tier tool mechanism.
  • •Connect Your AIs to the Memory Tree: Connect external AI apps to the memory tree using an MCP URL.
Last updated 2026-10-19Was this page helpful?

这一页给 agent 读的版本:在网址后加 .md 就是下面这份纯文本,和给人看的那页由同一份内容生成。Agent-readable version of this page: append .md to the URL to get the plain text below, generated from the same source as the human view.