Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/architecture/subscription-account-routing-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
|---|---|
| 多服务商 | 已接入的 OpenAI Chat/Responses、Anthropic、Gemini 及订阅渠道可被用户明确选为主备;不同模型名称也可显式选入,不推测模型等价 |
| 多渠道、多 key | 引用现有模型配置 ID,每个连接使用自己的端点、协议、模型及凭据;同一服务商的多把 API key 可配置为多个独立连接 |
| 多账号 | Codex、Antigravity、OpenCode Zen、Grok、Hermes 和 ZCode 均使用独立账号槽位、固定账号和顺序账号池;登录、可信路由与额度查询分别按 adapter 能力处理 |
| 多账号 | Codex、OpenCode Zen、Grok、Hermes 和 ZCode 使用独立账号槽位、固定账号和顺序账号池;登录、可信路由与额度查询分别按 adapter 能力处理;历史 Antigravity 槽位保留读取但已失效 |

首版仅支持明确的顺序主备和手动固定选择。复用现有 Rust 模型链路、认证存储、客户端工厂与 Agent 回合,不引入网关、sidecar、daemon 或另一套工具执行循环。

Expand All @@ -23,7 +23,7 @@
| 订阅渠道 | 授权与身份 | 多账号请求路由 | 额度查询 |
|---|---|---|---|
| Codex | 浏览器 / 设备码;ChatGPT 席位身份 | 每槽位凭据与刷新租约,沿用账号绑定的 Responses 路由 | 现有服务商快照 |
| Antigravity | 执行主机浏览器回调;Google 用户 ID / ID token subject | 每槽位 Code Assist 凭据,沿用可信项目发现与请求链路 | 暂不支持,显示未知,由请求验证 |
| Antigravity(已下线) | 历史执行主机浏览器回调凭据仅保留读取 | 不支持,所有历史订阅配置拒绝请求 | 不支持,显示下线状态 |
| OpenCode Zen | 设备码;Console 用户身份与各账号目录 | 按所选账号解析协议、模型、组织请求头及可信 Console 端点;不向公开 Zen/Go key 路由发送 OAuth token | 暂不支持,显示未知,由请求验证 |
| Grok | 设备码;服务商 JWT subject | 每槽位刷新,使用 Grok Build 的可信 Responses 与模型目录端点 | 暂不支持,显示未知,由请求验证 |
| Hermes | 设备码;推理 scope 与 JWT subject | 每槽位轮换刷新,沿用可信 Nous 推理端点及 Chat 协议 | 暂不支持,显示未知,由请求验证 |
Expand Down
10 changes: 5 additions & 5 deletions docs/interactive-capabilities/capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "OpenBitFun Playbook",
"origin": "https://playbook.openbitfun.com",
"source": "src/shared/interactive-capabilities/catalog.json",
"digest": "3d50d21ee69fe9a54f064e9364529f0effb58315ba85093d302cb7f6d395cfd9",
"digest": "3f6c6936d3a543526f6a768b31c8058041ab3704f44be401086eb9174440d5cc",
"ownerDigest": "6f0746578f3c56479f7c289bb05395dfe6917042f4d419de8c9a2f719d31f815",
"searchAcceptance": [
{
Expand Down Expand Up @@ -32993,8 +32993,8 @@
},
{
"id": "subscription-auth",
"titleZh": "登录 Codex、ZCode、OpenCode、Grok、Antigravity、Hermes 等订阅账号与多号订阅池",
"titleEn": "Sign in to Codex, ZCode, OpenCode, Grok, Antigravity, Hermes, and multi-account subscription pools",
"titleZh": "登录 Codex、ZCode、OpenCode、Grok、Hermes 等订阅账号与多号订阅池",
"titleEn": "Sign in to Codex, ZCode, OpenCode, Grok, Hermes, and multi-account subscription pools",
"descriptionZh": "支持浏览器或设备码授权登录(含智谱国内版与 Z.ai 国际版 ZCode),可在卡片上直观查看 OpenCode 与 Grok 实时额度面板,并将多个账号编成订阅池在限流时自动故障轮换。",
"descriptionEn": "Sign in via browser or device code (including ZCode CN and Z.ai Intl), view live OpenCode and Grok quota panels, and group multiple accounts into a subscription pool that rotates automatically on rate limits.",
"control": {
Expand Down Expand Up @@ -33270,8 +33270,8 @@
"Add built-in or custom providers, probe Magpie gateways, and set up standalone image services",
"配置 API Key、Base URL、请求格式(含实时派生 URL 预览)与备用通道",
"Configure API keys, base URLs, API formats with live derived URL preview, and fallback channels",
"登录 Codex、ZCode、OpenCode、Grok、Antigravity、Hermes 等订阅账号与多号订阅池",
"Sign in to Codex, ZCode, OpenCode, Grok, Antigravity, Hermes, and multi-account subscription pools",
"登录 Codex、ZCode、OpenCode、Grok、Hermes 等订阅账号与多号订阅池",
"Sign in to Codex, ZCode, OpenCode, Grok, Hermes, and multi-account subscription pools",
"选择主模型、快速模型、经济模型以及图像理解、图像生成和语音识别默认模型",
"Choose Primary, Fast, Economy, image-understanding, image-generation, and speech-recognition defaults",
"按模型能力选择推理预设或自定义思考预算",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Manage AI providers and subscription accounts in one place, assign Primary, Fast
- Configure API keys, base URLs, API formats with live derived URL preview, and fallback channels
- 说明:切换 chat/completions、responses、Anthropic messages、Gemini generateContent 或 Gemini Code Assist 时可实时查看最终请求路径,一键拉取远端模型清单,并为单模型绑定备用通道路由。
- Why & how: See the exact derived request URL update live as you switch between chat/completions, responses, Anthropic messages, Gemini generateContent, or Gemini Code Assist, fetch remote model lists, and bind fallback channel routing.
- **智能体可定位入口,需交互完成 / Agent opens; interaction required** · 登录 Codex、ZCode、OpenCode、Grok、Antigravity、Hermes 等订阅账号与多号订阅池
- Sign in to Codex, ZCode, OpenCode, Grok, Antigravity, Hermes, and multi-account subscription pools
- **智能体可定位入口,需交互完成 / Agent opens; interaction required** · 登录 Codex、ZCode、OpenCode、Grok、Hermes 等订阅账号与多号订阅池
- Sign in to Codex, ZCode, OpenCode, Grok, Hermes, and multi-account subscription pools
- 说明:支持浏览器或设备码授权登录(含智谱国内版与 Z.ai 国际版 ZCode),可在卡片上直观查看 OpenCode 与 Grok 实时额度面板,并将多个账号编成订阅池在限流时自动故障轮换。
- Why & how: Sign in via browser or device code (including ZCode CN and Z.ai Intl), view live OpenCode and Grok quota panels, and group multiple accounts into a subscription pool that rotates automatically on rate limits.
- **智能体可定位入口,需交互完成 / Agent opens; interaction required** · 选择主模型、快速模型、经济模型以及图像理解、图像生成和语音识别默认模型
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"generatedFrom": "src/shared/interactive-capabilities/catalog.json",
"catalogDigest": "3d50d21ee69fe9a54f064e9364529f0effb58315ba85093d302cb7f6d395cfd9",
"catalogDigest": "3f6c6936d3a543526f6a768b31c8058041ab3704f44be401086eb9174440d5cc",
"count": 231,
"reasonCounts": {
"externalAuth": 4,
Expand Down Expand Up @@ -2845,8 +2845,8 @@
{
"capabilityId": "setting.ai.models",
"itemId": "subscription-auth",
"titleZh": "登录 Codex、ZCode、OpenCode、Grok、Antigravity、Hermes 等订阅账号与多号订阅池",
"titleEn": "Sign in to Codex, ZCode, OpenCode, Grok, Antigravity, Hermes, and multi-account subscription pools",
"titleZh": "登录 Codex、ZCode、OpenCode、Grok、Hermes 等订阅账号与多号订阅池",
"titleEn": "Sign in to Codex, ZCode, OpenCode, Grok, Hermes, and multi-account subscription pools",
"reasonCode": "externalAuth",
"reasonZh": "订阅账户登录需要在供应商网页或设备授权流程中确认;智能体可以打开入口,但不能代替用户完成外部认证。",
"reasonEn": "Subscription sign-in requires confirmation in a provider web or device-authorization flow; the Agent can open the entry but cannot complete external authentication for the user.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 2,
"generatedFrom": "src/shared/interactive-capabilities/catalog.json",
"catalogDigest": "3d50d21ee69fe9a54f064e9364529f0effb58315ba85093d302cb7f6d395cfd9",
"catalogDigest": "3f6c6936d3a543526f6a768b31c8058041ab3704f44be401086eb9174440d5cc",
"commandCount": 701,
"coverage": {
"commandCount": 701,
Expand Down
14 changes: 7 additions & 7 deletions src/crates/adapters/ai-adapters/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ provider-neutral contracts owned by `openbitfun-agent-stream`.
separate from the configured request model. Never infer an observation from
URLs, model selection or error text. Inline-think buffering must not hide it,
and metadata alone must not satisfy TTFT or become effective output.
- Subscription auth (Codex/Antigravity codex CLI user-agent probing) may reuse
- Subscription auth (Codex and legacy Antigravity codex CLI user-agent probing) may reuse
lower-layer service command helpers for PATH and process-platform behavior; do
not introduce host framework calls.
- Keep `subscription-auth` optional so standalone protocol adapters do not pull
Expand Down Expand Up @@ -77,7 +77,7 @@ Compared on 2026-09-08 against [OpenCode v1.18.29](https://github.com/anomalyco/
- Subscription credentials own authentication and account headers regardless
of saved replace mode or header casing. Use OpenBitFun attribution for Codex;
retain provider-required compatibility headers for xAI and
Antigravity. Public API-key configurations retain their authentication policy.
legacy Antigravity. Public API-key configurations retain their authentication policy.
- `prepare_account_request_route` exposes credential-free provider protocol/model facts
without credential IO or subscription identity. It shares the route definition
with real credential resolution for static routes; OpenCode's final route
Expand Down Expand Up @@ -126,7 +126,7 @@ Compared on 2026-09-08 against [OpenCode v1.18.29](https://github.com/anomalyco/

- Explicit account slots use `<provider>-account-<canonical UUID v4>` in the
existing v2 credential store; each provider key remains its legacy default.
Codex, Antigravity, OpenCode Zen, Grok and Hermes share slot validation,
Codex, legacy Antigravity, OpenCode Zen, Grok and Hermes share slot validation,
conditional identity commits and resolved-client binding through `accounts`;
each provider owns authorization, refresh and trusted routing. Named-slot
reauthentication must preserve its upstream account identity. Resolve,
Expand Down Expand Up @@ -215,9 +215,9 @@ business-session token for inference or silently switch Coding Plan requests ont
Start/gift plans. Region and project endpoints are adapter-owned. Catalog
failures remain errors.

WorkBuddy (`workbuddy`, `workbuddy_ai`) is retired. The vendor stopped allowing
subscription-token access, so its sign-in, refresh, catalog, request-dialect and
billing protocols were deleted. `SubscriptionProvider::{Workbuddy, WorkbuddyAi}`
Antigravity and WorkBuddy (`workbuddy`, `workbuddy_ai`) are retired. Their
subscription import and access paths were removed. `SubscriptionProvider::{Antigravity,
Workbuddy, WorkbuddyAi}`
stay deserializable, keep their store keys, and are absent from
`SubscriptionProvider::ALL` so nothing offers them; every login, resolve,
catalog, quota and route path returns `SubscriptionProvider::retired_error()`.
Expand Down Expand Up @@ -301,7 +301,7 @@ cargo test --locked -p openbitfun-ai-adapters --features local-tokenizer --lib l
```

Subscription model discovery must use the authenticated account catalog.
Antigravity uses `v1internal:fetchAvailableModels`; preserve returned wire IDs
Legacy Antigravity uses `v1internal:fetchAvailableModels`; preserve returned wire IDs
and restrict alias translation to known legacy names. Codex's `supported_in_api`
flag describes the public API, not subscription availability. OpenCode public catalog
models must stay grouped by plan and wire format. Never mask a failed account
Expand Down
20 changes: 8 additions & 12 deletions src/crates/adapters/ai-adapters/src/subscription_auth/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Existing v2 readers/writers preserve those entries without a schema change.

use super::{
antigravity, build_account, codex, grok, hermes, opencode, store, zcode, LoginStartResult,
build_account, codex, grok, hermes, opencode, store, zcode, LoginStartResult,
SubscriptionAccount, SubscriptionHttpOptions, SubscriptionLoginMethod,
SubscriptionLogoutResult, SubscriptionProvider,
};
Expand Down Expand Up @@ -49,7 +49,7 @@ fn build_instance(
account_id: id.into(),
is_default: id == provider.key(),
supports_multiple_accounts: true,
enabled: metadata.is_none_or(|metadata| metadata.enabled),
enabled: !provider.is_retired() && metadata.is_none_or(|metadata| metadata.enabled),
upstream_account_id: metadata.and_then(|metadata| metadata.upstream_account_id.clone()),
account,
}
Expand Down Expand Up @@ -166,13 +166,12 @@ pub async fn resolve_account_with_options(
validate_account_id(provider, id)?;
match provider {
SubscriptionProvider::Codex => codex::resolve_account(id, options).await,
SubscriptionProvider::Workbuddy | SubscriptionProvider::WorkbuddyAi => {
Err(provider.retired_error())
}
SubscriptionProvider::Antigravity
| SubscriptionProvider::Workbuddy
| SubscriptionProvider::WorkbuddyAi => Err(provider.retired_error()),
SubscriptionProvider::Zcode | SubscriptionProvider::ZcodeCn => {
zcode::resolve(provider, id, options).await
}
SubscriptionProvider::Antigravity => antigravity::resolve_account(id, options).await,
SubscriptionProvider::Grok => {
grok::resolve_for_account(id, provider.suggested().2, options).await
}
Expand Down Expand Up @@ -207,18 +206,15 @@ pub async fn recover_rejected_account_with_options(
));
}
match provider {
SubscriptionProvider::Workbuddy | SubscriptionProvider::WorkbuddyAi => {
Err(provider.retired_error())
}
SubscriptionProvider::Antigravity
| SubscriptionProvider::Workbuddy
| SubscriptionProvider::WorkbuddyAi => Err(provider.retired_error()),
SubscriptionProvider::Zcode | SubscriptionProvider::ZcodeCn => {
zcode::recover(provider, id, rejected_access, options).await
}
SubscriptionProvider::Codex => {
codex::recover_rejected_account(id, rejected_access, upstream_account_id, options).await
}
SubscriptionProvider::Antigravity => {
antigravity::recover_rejected_account(id, rejected_access, options).await
}
SubscriptionProvider::Grok => {
grok::recover_rejected_account(id, rejected_access, options).await
}
Expand Down
Loading
Loading