System Internal Interface Inventory

July 25, 2026 · View on GitHub

本文档把当前系统里可对接的内部接口一次性列出来,方便桌面端、Web 端、自动化脚本和第三方集成统一查看。
这份表不再只列页面上“常用”的那部分,而是按代码真实入口补齐:

1. 接口分层

  • Tauri 命令:桌面端调用入口,参数名以 Rust #[tauri::command] 为准
  • JSON-RPC 方法:service 进程对外的内部方法名,默认走 POST /rpc
  • direct 本地命令:仅桌面端本地可用,不经过 RPC
  • HTTP 路由:service / web 进程直接暴露的服务端接口

2. Tauri / RPC / direct 对照表

模块Tauri 命令RPC / 类型关键参数 / 备注
基础app_settings_getappSettings/get读取应用设置
基础app_settings_setappSettings/set参数:patch
基础app_close_to_tray_on_close_getdirect读取“关闭到托盘”状态
基础app_close_to_tray_on_close_setdirect参数:enabled
基础service_initializeinitialize初始化服务、返回版本和平台信息
基础service_startdirect参数:addr,桌面端拉起本地 service 进程
基础service_stopdirect停止本地 service 进程
基础service_rpc_tokendirect返回当前 RPC 鉴权 token
基础service_startup_snapshotstartup/snapshot参数:requestLogLimit
基础service_listen_config_getservice/listenConfig/get读取服务监听模式
基础service_listen_config_setservice/listenConfig/set参数:mode
账号service_account_listaccount/list参数:pagepageSizequeryfiltergroupFilter
账号service_account_deleteaccount/delete参数:accountId
账号service_account_delete_manyaccount/deleteMany参数:accountIds
账号service_account_delete_unavailable_freeaccount/deleteUnavailableFree删除不可用免费账号
Accountservice_account_updateaccount/updateParameters: accountId, sort, status, label, groupName, note, tags; only administrators may change groupName
账号service_account_importaccount/import参数:contents[]content
账号service_account_import_by_filedirect桌面端打开文件选择器,读取 .json/.txt,产出 contents 后再交给 service_account_import
账号service_account_import_by_directorydirect桌面端打开目录选择器,递归读取账号文件,产出 contents 后再交给 service_account_import
账号service_account_export_by_account_filesdirect -> account/export桌面端先选择目录,再调用 RPC account/export;Web 模式会改走 account/exportData 浏览器下载
账号local_account_deletedirect参数:accountId,直接操作本地 SQLite,不经过服务
用量service_usage_readaccount/usage/read参数:accountId
用量service_usage_listaccount/usage/list返回全部账号最新快照
用量service_usage_aggregateaccount/usage/aggregate返回全局聚合汇总
用量service_usage_refreshaccount/usage/refresh参数可选:accountId;不传则刷新全部
登录service_login_startaccount/login/start参数:loginTypeopenBrowsernotetagsgroupNameworkspaceId
登录service_login_statusaccount/login/status参数:loginId
Loginservice_login_cancelaccount/login/cancelParam: loginId; cancels an in-progress login flow
登录service_login_completeaccount/login/complete参数:statecoderedirectUri
登录service_login_chatgpt_auth_tokensaccount/login/start固定参数:type=chatgptAuthTokens;其余参数:accessTokenrefreshTokenidTokenchatgptAccountIdworkspaceIdchatgptPlanType
登录service_account_readaccount/read参数:refreshToken
登录service_account_logoutaccount/logout退出当前登录态
登录service_chatgpt_auth_tokens_refreshaccount/chatgptAuthTokens/refresh参数:reasonpreviousAccountId
聚合 APIservice_aggregate_api_listaggregateApi/list列表
聚合 APIservice_aggregate_api_createaggregateApi/create参数:providerTypesupplierNamesorturlkeyauthTypeauthCustomEnabledauthParamsactionCustomEnabledactionusernamepassword
聚合 APIservice_aggregate_api_updateaggregateApi/update参数:idproviderTypesupplierNamesorturlkeyauthTypeauthCustomEnabledauthParamsactionCustomEnabledactionusernamepassword
聚合 APIservice_aggregate_api_read_secretaggregateApi/readSecret参数:id
聚合 APIservice_aggregate_api_deleteaggregateApi/delete参数:id
聚合 APIservice_aggregate_api_test_connectionaggregateApi/testConnection参数:id
平台密钥service_apikey_listapikey/list列表
平台密钥service_apikey_read_secretapikey/readSecret参数:keyId,前端会映射成 RPC 参数 id
Platform API keyservice_apikey_createapikey/createParameters: name, modelSlug, reasoningEffort, serviceTier, protocolType, upstreamBaseUrl, staticHeadersJson, rotationStrategy, aggregateApiId, accountPlanFilter, accountGroupFilter, quotaLimitTokens, customKey
平台密钥service_apikey_modelsapikey/models参数可选:refreshRemote
平台密钥service_apikey_usage_statsapikey/usageStats用量统计
Platform API keyservice_apikey_update_modelapikey/updateModelParameters: keyId, name, modelSlug, reasoningEffort, serviceTier, protocolType, upstreamBaseUrl, staticHeadersJson, rotationStrategy, aggregateApiId, accountPlanFilter, accountGroupFilter, and quotaLimitTokens; customKey is create-only. Desktop-only hasName, hasModelConfig, hasRoutingConfig, hasAccountGroupFilter, and hasQuotaLimitTokens are presence markers that distinguish omission from explicit clearing and are not forwarded as domain fields; only administrators may change the account-group filter
平台密钥service_apikey_deleteapikey/delete参数:keyId
平台密钥service_apikey_disableapikey/disable参数:keyId
平台密钥service_apikey_enableapikey/enable参数:keyId
网关service_gateway_route_strategy_getgateway/routeStrategy/get读取路由策略与手动优选账号
网关service_gateway_route_strategy_setgateway/routeStrategy/set参数:strategy
网关service_gateway_manual_account_getgateway/manualAccount/get读取手动优选账号
网关service_gateway_manual_account_setgateway/manualAccount/set参数:accountId
网关service_gateway_manual_account_cleargateway/manualAccount/clear清空手动优选账号
网关service_gateway_background_tasks_getgateway/backgroundTasks/get读取后台任务配置
网关service_gateway_background_tasks_setgateway/backgroundTasks/set参数:usagePollingEnabledusagePollIntervalSecsgatewayKeepaliveEnabledgatewayKeepaliveIntervalSecstokenRefreshPollingEnabledtokenRefreshPollIntervalSecsusageRefreshWorkershttpWorkerFactorhttpWorkerMinhttpStreamWorkerFactorhttpStreamWorkerMin
网关service_gateway_concurrency_recommend_getgateway/concurrencyRecommendation/get读取系统推导的并发建议
网关service_gateway_upstream_proxy_getgateway/upstreamProxy/get读取上游代理
网关service_gateway_upstream_proxy_setgateway/upstreamProxy/set参数:proxyUrl
网关service_gateway_transport_getgateway/transport/get读取传输层配置
Gatewayservice_gateway_transport_setgateway/transport/setParams: sseKeepaliveEnabled, sseKeepaliveIntervalMs, upstreamTotalTimeoutMs, upstreamStreamTimeoutMs
请求日志service_requestlog_listrequestlog/list参数:querystatusFilterpagepageSize
请求日志service_requestlog_summaryrequestlog/summary参数:querystatusFilter
请求日志service_requestlog_clearrequestlog/clear清空请求日志
请求日志service_requestlog_today_summaryrequestlog/today_summary今日汇总
插件中心service_plugin_catalog_listplugin/catalog/list参数:marketModesourceUrl
插件中心service_plugin_catalog_refreshplugin/catalog/refresh刷新插件目录
插件中心service_plugin_installplugin/install参数:entry
插件中心service_plugin_updateplugin/update参数:entry
插件中心service_plugin_uninstallplugin/uninstall参数:pluginId
插件中心service_plugin_listplugin/list已安装插件列表
插件中心service_plugin_enableplugin/enable参数:pluginId
插件中心service_plugin_disableplugin/disable参数:pluginId
插件中心service_plugin_tasks_updateplugin/tasks/update参数:taskIdintervalSeconds
插件中心service_plugin_tasks_listplugin/tasks/list参数可选:pluginId
插件中心service_plugin_tasks_runplugin/tasks/run参数:taskIdinput
插件中心service_plugin_logs_listplugin/logs/list参数:pluginIdtaskIdlimit
Codex Skillsservice_codex_skills_listcodexSkills/listOptional param: codexHome; scans user and built-in Skills
Codex Skillsservice_codex_skills_install_zipcodexSkills/installZipParams: fileName, archiveBase64; optional: codexHome
Codex Skillsservice_codex_skills_import_directorycodexSkills/importDirectoryParam: sourcePath; optional: codexHome
Codex Skillsservice_codex_skills_deletecodexSkills/deleteParam: directoryName; optional: codexHome
Codex Skillsservice_codex_skills_marketplace_listcodexSkills/marketplaceListOptional param: codexHome; lists Marketplaces and available plugins
Codex Skillsservice_codex_skills_marketplace_addcodexSkills/marketplaceAddParam: source; optional: refName, codexHome
Codex Skillsservice_codex_skills_marketplace_refreshcodexSkills/marketplaceRefreshOptional params: marketplaceName, codexHome
Codex Skillsservice_codex_skills_marketplace_plugin_installcodexSkills/marketplacePluginInstallParam: pluginId; optional: codexHome; installs the complete Codex plugin
Codex Projectsapp_codex_projects_listdirect (desktop only)Lists project folders saved locally by the current desktop client
Codex Projectsapp_codex_project_adddirect (desktop only)Opens the system folder picker, canonicalizes, and saves the selected folder
Codex Projectsapp_codex_project_removedirect (desktop only)Param: path; removes only the saved entry and never project files
Codex Projectsapp_codex_project_launchdirect (desktop only)Params: path, `action=start
系统open_in_browserdirect参数:url,本地打开浏览器
系统open_in_file_managerdirect参数:path,本地打开目录
系统app_window_unsaved_draft_sections_setdirect参数:sections[],设置页未保存草稿标记
更新app_update_checkdirect检查更新
更新app_update_preparedirect下载 / 预备更新
更新app_update_apply_portabledirect便携版应用更新
更新app_update_launch_installerdirect安装包模式启动安装器
更新app_update_statusdirect读取更新状态
更新app_update_open_logs_dirdirect参数可选:assetPath,打开更新日志目录

3. 仅 RPC 暴露的方法

这些方法目前没有同名 Tauri 命令,但服务端已经实现,适合 Web 端、脚本端或后续接入方直接走 JSON-RPC。

模块RPC 方法关键参数 / 备注
账号导出account/export参数:outputDir;把账号逐个写入指定目录
账号导出account/exportData无参数;直接返回 { files: [{ fileName, content }], exported },主要给浏览器下载导出用
Web 鉴权webAuth/status读取 Web 管理页密码配置状态
Web 鉴权webAuth/password/set参数:password
Web 鉴权webAuth/password/clear清空 Web 管理页密码

4. Service / Web HTTP 路由

4.1 Service 进程 HTTP 路由

路由方法说明
/rpcPOSTJSON-RPC 统一入口
/auth/callbackGET登录回调入口,浏览器授权后回跳这里
/metricsGET指标输出
/healthGET健康检查,返回 ok
/v1/modelsGET网关模型列表;部分场景会本地直接响应
/v1/responsesPOSTOpenAI 兼容 Responses 入口
/v1/responses/compactPOST紧凑型 Responses 入口
/v1/chat/completionsPOSTOpenAI Chat Completions 入口,内部会适配到 /v1/responses
/v1/messages/count_tokensPOSTAnthropic 风格 token 估算,本地轻量响应
其他未命中内部路由的路径ANY统一落到网关 handler,继续按协议适配与上游转发

4.2 Web 管理页 HTTP 路由

路由方法说明
/api/runtimeGET返回当前运行时能力,如 rpcBaseUrl、是否可自更新、是否支持本地目录等
/api/rpcPOSTWeb -> Service 的 RPC 代理
/__auth_statusGETWeb 鉴权状态
/__loginGET / POSTWeb 登录页与提交入口
/__logoutGET / POSTWeb 登出
/__quitGET请求 Web 进程退出
//{*path}GET静态 UI、内嵌 UI 或缺省提示页

5. 导入 / 导出链路补充

这是当前最容易遗漏、也最容易接错的一组接口。

5.1 导入

场景实际链路说明
桌面端手动选文件导入service_account_import_by_file -> 本地文件选择器 -> service_account_import -> account/import先读取文件内容,再统一走 RPC 导入
桌面端手动选目录导入service_account_import_by_directory -> 本地目录选择器 -> service_account_import -> account/import目录会递归收集 .json/.txt
Web 端文件导入service_account_import_by_file / service_account_import_by_directory -> 浏览器文件选择 -> service_account_import -> account/importWeb 模式下 transport.ts 用浏览器 <input type=file> 模拟本地导入
直接脚本导入直接调 account/import最稳,传 contents[] 即可

5.2 导出

场景实际链路说明
桌面端导出到目录service_account_export_by_account_files -> 本地目录选择器 -> account/export服务端把每个账号写成单独文件到 outputDir
Web 端导出下载service_account_export_by_account_files -> account/exportData -> 浏览器逐个下载Web 端不会写本地目录,而是拿到文件内容后下载
直接脚本导出到目录直接调 account/exportoutputDir
直接脚本导出到内存直接调 account/exportData拿到 files[] 自己处理

6. 常用能力速查

常见叫法对应入口
用户列表 / 账号列表service_account_list / account/list
Update one account's notes / tags / status / custom groupservice_account_update / account/update
Restrict one API key's account candidate pool to a custom groupservice_apikey_create / service_apikey_update_model with accountGroupFilter
批量删除账号service_account_delete_many / account/deleteMany
删除不可用免费账号service_account_delete_unavailable_free / account/deleteUnavailableFree
导入账号文本 / JSONservice_account_import / account/import
桌面端导出账号文件service_account_export_by_account_files -> account/export
Web 端下载导出账号service_account_export_by_account_files -> account/exportData
刷新账号用量service_usage_refresh / account/usage/refresh
账号用量列表service_usage_list / account/usage/list
当前登录态账号service_account_read / account/read
刷新 ChatGPT Auth Tokensservice_chatgpt_auth_tokens_refresh / account/chatgptAuthTokens/refresh
平台 Key 列表service_apikey_list / apikey/list
聚合 API 连通性测试service_aggregate_api_test_connection / aggregateApi/testConnection
网关路由策略service_gateway_route_strategy_get / gateway/routeStrategy/get
系统推导并发建议service_gateway_concurrency_recommend_get / gateway/concurrencyRecommendation/get
请求日志列表service_requestlog_list / requestlog/list
插件任务执行service_plugin_tasks_run / plugin/tasks/run
Web 管理页密码状态webAuth/status

7. 插件运行内建函数

当前 Rhai 运行时按权限开放这些函数:

权限函数说明
settings:readget_setting(key)读取单个设置
settings:readlist_settings()获取全部设置
networkhttp_get(url)发起 GET 请求
networkhttp_post(url, body)发起 POST 请求
accounts:cleanupcleanup_banned_accounts()清理封禁账号
accounts:cleanupcleanup_unavailable_free_accounts()清理不可用免费账号

公共函数:

  • log(message):写入运行日志

8. 现有内置插件

  • cleanup-banned-accounts:封禁账号清理
  • cleanup-unavailable-free-accounts:不可用免费账号定时清理

9. 对接建议

  • 桌面端集成优先用 Tauri 命令,尤其是文件导入、目录导出、打开浏览器、打开文件夹、自更新。
  • Web / Docker / 远程脚本优先直接走 JSON-RPC,不要假设存在本地文件选择器。
  • 导出场景要先分清“写目录”还是“浏览器下载”:
    • 写目录:account/export
    • 浏览器下载:account/exportData
  • 如果你做 Service 级集成,除了 /rpc 外,还要注意 /health/metrics/auth/callback 和 OpenAI 兼容的网关路径。
  • 如果你要让 Rhai 脚本直接调用“用户列表”“平台 Key 列表”这类系统接口,需要先在服务端封装成受控函数;当前脚本默认只开放表中列出的内建函数。