Files
aios/docs/12_INTERFACE_API_SPEC_V1R1C0_CN.md
T

2.0 KiB

AIOS V1R1C0 接口规格:GitOps + custom LLM + Runtime Selector

默认本地服务:127.0.0.1:18890。

1. 认证

写接口必须带:

Authorization: Bearer <AIOS_GITOPS_TOKEN>
X-AIOS-User: <username>
X-AIOS-Role: owner|admin|user

2. GitOps 接口

方法 路径 功能
GET /api/status 查看 GitOps 状态
GET /api/base 当前 baseline
GET /api/ver 版本列表
GET /api/diff?from=&to= 版本差异
GET /api/patch Patch 列表
POST /api/branch 创建分支
POST /api/file 写文件并 commit
POST /api/commit 提交已有变更
POST /api/tag 创建 VxRxCx tag
POST /api/rollback checkout 指定版本
POST /api/nl 自然语言路由

3. custom LLM 接口

添加用户自定义模型

POST /api/model/custom/add

{
  "provider_name": "my-local-oneapi",
  "base_url": "http://127.0.0.1:13000/v1",
  "model_name": "my-qwen-local",
  "display_name": "我的本地 Qwen",
  "api_key": "只在请求中出现,服务端转为 secret_ref",
  "context_window": 32768,
  "supports_tools": true,
  "supports_vision": false,
  "supports_reasoning": true,
  "priority": 10
}

设置模型优先级

POST /api/model/priority/set

{
  "items": [
    {"model_id": "custom.alice.abc", "priority": 1},
    {"model_id": "base.deepseekv4-flash", "priority": 20},
    {"model_id": "base.qwen3.6-35b", "priority": 30}
  ]
}

解析实际模型路由

POST /api/model/route/resolve

系统按用户 priority 排序,选择第一个可用模型;如果没有用户配置,则退回角色默认基础模型。

4. Runtime 接口

方法 路径 功能
POST /api/runtime/select 根据 role/tier/risk 选择 shared/dedicated/sandbox
POST /api/runtime/register 注册 runtime 实例
POST /api/runtime/heartbeat runtime 心跳
GET /api/runtime/status runtime 列表