Skip to content

Commit c4e3496

Browse files
committed
Generalize explicit account model selection
1 parent 0dda15e commit c4e3496

40 files changed

Lines changed: 911 additions & 269 deletions

‎docs-site/src/content/docs/guides/codex-app-models.md‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,32 @@ gpt-5.6-sol # openai (Pool or Direct option)
2424
openai-apikey/gpt-5.6-sol # API key
2525
```
2626

27-
For intentional per-thread account selection, turn on **Account-specific models** under
28-
**Codex Auth**, or configure `codexAccountNamespaces` and run `ocx sync`. The picker then also shows
29-
entries such as:
27+
When multiple Codex accounts are logged in, turn on **Show each Codex account separately in the
28+
model picker** under **Codex Auth** to target one account for a conversation without logging out.
29+
You can also configure `codexAccountNamespaces` and run `ocx sync`. The picker then shows a separate
30+
copy of every GPT model for every configured account:
3031

3132
```text
32-
personal/gpt-5.6-sol # exact main/Desktop account
33-
work/gpt-5.6-sol # exact added work account
33+
main/gpt-5.6-sol # exact main/Desktop account
34+
side/gpt-5.6-sol # exact added account
3435
```
3536

36-
The opt-in replaces plain native picker rows with readable `Personal / 5.6 Sol` and
37-
`Work / 5.6 Sol` rows. The equivalent config is:
37+
`main` identifies the built-in Codex login. Every added account derives its selector prefix from its
38+
user-chosen local OpenCodex ID; a numeric suffix avoids existing provider or combo prefixes. Those
39+
IDs do not represent built-in account types. The equivalent config is:
3840

3941
```json
4042
{
41-
"codexAccountNamespaces": { "personal": "main", "work": "work-account-id" }
43+
"codexAccountNamespaces": { "main": "main", "side": "added-account-id" }
4244
}
4345
```
4446

4547
Plain `gpt-*` ids remain valid for saved threads and config, and continue to use the provider's
46-
Pool/Direct behavior. Omitting the map keeps the existing picker unchanged. The **Codex Auth**
47-
dashboard refreshes the catalog automatically after changing the toggle.
48+
Pool/Direct behavior. Omitting the map keeps the existing picker unchanged. Turning the dashboard
49+
setting off hides account-specific rows but preserves their bindings and explicit selectors. The
50+
**Codex Auth** dashboard refreshes the catalog automatically after changing the toggle.
51+
Deleting an added account removes its picker rows but retains the selector binding so saved
52+
conversations fail closed instead of falling through. Re-adding the same local ID restores those rows.
4853

4954
An account-qualified model never switches accounts. Missing credentials, cooldown, or
5055
reauthentication fail the request. Bare models retain normal Pool/Direct behavior, and future native

‎docs-site/src/content/docs/guides/model-routing.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Pool(default, main plus added accounts) or Direct(current caller/main bearer) wi
1111
model id. `openai-apikey/<model>` explicitly selects API-key transport. The two credential routes
1212
do not fall through to one another.
1313

14-
Configured `codexAccountNamespaces` are checked first. A selector such as `work/gpt-5.6-sol`
14+
Configured `codexAccountNamespaces` are checked first. A selector such as `side/gpt-5.6-sol`
1515
resolves to the canonical `openai` provider plus one immutable account id. It bypasses pool
1616
selection and fails closed instead of changing accounts. Account namespace keys cannot collide with
1717
configured provider names.

‎docs-site/src/content/docs/ja/guides/codex-app-models.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@ OpenAI ID は 2 種類に固定されます。bare native ID は `codexAccountMo
1212
ID は変わりません。API GPT-5.6 は context 1,050,000 / max input 922,000 で、
1313
`*-pro` ピッカー ID は公開状態を維持しつつ wire でベースモデル + `reasoning.mode: "pro"` になります。
1414

15+
複数の Codex アカウントにログインしている場合は、**Codex Auth** の **各 Codex アカウントを
16+
モデル選択に個別表示**を有効にすると、ログアウトせずに会話で使うアカウントを明示できます。
17+
各 GPT モデルはアカウントごとに別の項目として表示されます。
18+
19+
```text
20+
main/gpt-5.6-sol # 組み込みの Codex ログインに固定
21+
side/gpt-5.6-sol # ローカル ID が side の追加アカウントに固定
22+
```
23+
24+
`main` は組み込みログインを表します。追加アカウントのプレフィックスはユーザーが指定した
25+
ローカル ID から生成され、既存のルーティング名と重なる場合は数字が付きます。この ID は
26+
アカウント種別ではありません。アカウント指定モデルは Pool 選択や
27+
フォールバックを行わず、選択したアカウントが利用できない場合は失敗します。プレフィックスなしの
28+
`gpt-*` は従来の Pool/Direct 動作を維持します。設定を無効にしても項目が非表示になるだけで、
29+
保存済みのバインドは削除されません。追加アカウントを削除するとその項目は消えますが、保存済みの
30+
選択が別アカウントへ流れないようバインドは残ります。同じローカル ID を再追加すると項目が戻ります。
31+
手動設定と `ocx sync` については
32+
[設定リファレンス](/ja/reference/configuration/)を参照してください。
33+
1534
## 統合経路
1635

1736
`ocx init`、`ocx start`、`ocx sync` は解決された `CODEX_HOME` の下のファイルを合わせます。

‎docs-site/src/content/docs/ko/guides/codex-app-models.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ OpenAI id는 두 가지로 고정됩니다. bare native id는 `codexAccountMode`
1212
id는 변하지 않습니다. API GPT-5.6은 context 1,050,000 / max input 922,000이고,
1313
`*-pro` picker id는 공개 상태를 유지하면서 wire에서 base 모델 + `reasoning.mode: "pro"`가 됩니다.
1414

15+
여러 Codex 계정에 로그인한 경우 **Codex Auth**에서 **각 Codex 계정을 모델 선택기에 별도로 표시**를
16+
켜면 로그아웃하지 않고도 대화에 사용할 계정을 명시적으로 고를 수 있습니다. 각 GPT 모델은 계정마다
17+
별도 항목으로 표시됩니다.
18+
19+
```text
20+
main/gpt-5.6-sol # 내장 Codex 로그인에 고정
21+
side/gpt-5.6-sol # 로컬 ID가 side인 추가 계정에 고정
22+
```
23+
24+
`main`은 내장 로그인을 뜻합니다. 추가 계정의 접두사는 사용자가 정한 로컬 ID에서 만들어지고 기존
25+
라우팅 이름과 겹치면 숫자 접미사가 붙습니다. 이 ID는 계정 유형이 아닙니다.
26+
계정 지정 모델은 Pool 선택과 폴백을 건너뛰며, 선택한 계정을 사용할 수 없으면 요청이 실패합니다.
27+
접두사 없는 `gpt-*`는 기존 Pool/Direct 동작을 유지합니다. 설정을 꺼도 항목만 숨겨지고 저장된 바인딩은
28+
삭제되지 않습니다. 추가 계정을 삭제하면 선택기 항목은 사라지지만 저장된 선택이 다른 계정으로 넘어가지
29+
않도록 바인딩은 남습니다. 같은 로컬 ID를 다시 추가하면 항목이 복원됩니다. 수동 설정과 `ocx sync`는
30+
[설정 레퍼런스](/ko/reference/configuration/)를 참고하세요.
31+
1532
## 통합 경로
1633

1734
`ocx init`, `ocx start`, `ocx sync`는 해석된 `CODEX_HOME` 아래의 파일을 맞춥니다.

‎docs-site/src/content/docs/reference/configuration.md‎

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ differing backup and rewrites known legacy namespaced selected ids to bare ids.
5353
| `syncResumeHistory?` | `boolean` | `true` | Reversible Codex App history compatibility mode. opencodex backs up original Codex thread metadata, remaps old OpenAI interactive rows to `opencodex`, and temporarily promotes opencodex-created `exec` rows to an app-visible source. `ocx stop` / `ocx restore` restore backed-up OpenAI rows and eject remaining opencodex user threads to OpenAI so native Codex can resume them after the proxy is removed from `config.toml`. Set `false` to opt out. |
5454
| `codexAccounts?` | `CodexAccount[]` | `[]` | ChatGPT/Codex pool account metadata managed by the Codex Auth dashboard. Secrets live separately in `codex-accounts.json`. |
5555
| `codexAccountNamespaces?` | `Record<string,string>` | `{}` | Optional picker namespace to exact Codex account id map. Use `"main"` for the current Codex Desktop/main login. When present, account-qualified native rows replace plain GPT rows in the picker and fail closed instead of switching accounts. Plain model ids remain routable. Namespace keys cannot collide with provider ids. |
56+
| `codexAccountPickerEnabled?` | `boolean` | inferred | Picker-visibility override. A non-empty namespace map is visible when this is omitted. The dashboard writes `false` to hide account-specific rows without deleting their bindings. |
5657
| `activeCodexAccountId?` | `string` | — | Pool account used for the next new Codex thread. Existing thread affinities keep their original account. |
5758
| `autoSwitchThreshold?` | `number` | `80` | Usage percent threshold for new-session auto-switching. The score uses the hottest known 5h, weekly, or 30d quota window. Set `0` to disable quota auto-switching. |
5859
| `upstreamFailoverThreshold?` | `number` | `3` | Consecutive transient upstream failures before future new sessions fail over to another eligible pool account. Set `0` to disable failure failover. |
@@ -85,34 +86,45 @@ Use `codexAccountNamespaces` when account choice must be visible and intentional
8586
```json
8687
{
8788
"codexAccountNamespaces": {
88-
"personal": "main",
89-
"work": "work-account-id"
89+
"main": "main",
90+
"side": "added-account-id"
9091
}
9192
}
9293
```
9394

94-
The added account id is the `ID` shown by `ocx account list openai`; the namespace is a user-owned
95-
label. After `ocx sync`, Codex exposes `personal/gpt-*` and `work/gpt-*` copies of every available
95+
The added account id is the local `ID` shown by `ocx account list openai`; the namespace is a
96+
user-owned picker prefix. After `ocx sync`, Codex exposes `main/gpt-*` and `side/gpt-*` copies of every available
9697
supported native model. When a later opencodex update adds support for another native model, the next
9798
catalog sync gives it the same prefixes without adding the model separately to this map.
9899

99-
The dashboard's **Codex Auth** page exposes **Choose account in model picker** as the single opt-in.
100-
Turning it on creates `personal` for the main/Desktop login and uses each currently added account's
101-
alias (or id) for the other prefixes. Turning it off removes the account-qualified catalog rows.
102-
Account ids stay server-side. Prefixes stay stable if an account alias is renamed; accounts added
103-
later receive a new prefix automatically while the feature remains enabled.
104-
105-
When enabled, plain native rows are hidden from the picker and replaced by readable entries such as
106-
`Personal / 5.6 Sol` and `Work / 5.6 Sol`. Plain model ids are not removed or rerouted: saved threads
107-
and configuration that use `gpt-*` continue to follow Pool/Direct behavior. Because Codex exposes a
108-
flat picker rather than section metadata, the account-specific pairs stay together ahead of ordinary
109-
routed rows; explicitly featured subagent models retain their higher priority.
100+
The dashboard's **Codex Auth** page exposes **Show each Codex account separately in the model
101+
picker** as the single opt-in. Turning it on creates a prefix based on `main` for the main/Desktop
102+
login and derives every other prefix from the added account's local ID. A numeric suffix resolves
103+
provider or combo-prefix collisions. These names identify accounts; they do not represent built-in
104+
account types. Turning the setting off hides the account-qualified rows while
105+
preserving their configured bindings, so turning it back on restores the same picker identifiers.
106+
Upstream ChatGPT account IDs and credentials stay server-side. Local picker prefixes stay stable if
107+
an account's display alias is renamed; accounts added later receive a new prefix automatically while
108+
the feature remains enabled.
109+
110+
Deleting an added account hides its rows but keeps its namespace binding as a fail-closed marker for
111+
saved selectors. Re-adding the same local account ID restores the existing prefix instead of creating
112+
a new one.
113+
114+
When enabled, plain native rows are hidden from the picker and replaced by readable account-labeled
115+
entries such as `Main / 5.6 Sol` and `Side / 5.6 Sol`. Plain model ids are not removed or rerouted:
116+
saved threads and configuration that use `gpt-*` continue to follow Pool/Direct behavior. Because
117+
Codex exposes a flat picker rather than section metadata, the account-specific pairs stay together
118+
ahead of ordinary routed rows; explicitly featured subagent models retain their higher priority.
110119

111120
These selectors do not change `activeCodexAccountId`. They bypass quota auto-switch, transient-
112121
failure failover, affinity rebinding, and unsupported-model retry. If the exact account is missing,
113122
cooling down, or needs reauthentication, the request fails instead of using another account. Bare
114123
`gpt-*` models keep the configured Pool/Direct behavior.
115124

125+
Account-qualified ids remain explicitly routable while their picker rows are hidden. This preserves
126+
saved selections; the visibility toggle controls discovery, not the fail-closed account binding.
127+
116128
Account binding follows the model selector. A bare `subagentModels` entry is projected onto its
117129
visible account-specific rows so Codex can advertise those choices; the
118130
client's five-model subagent limit still applies. Use qualified values in `subagentModels`,

‎docs-site/src/content/docs/ru/guides/codex-app-models.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ gpt-5.6-sol # openai (Pool or Direct option)
2424
openai-apikey/gpt-5.6-sol # API key
2525
```
2626

27+
Если выполнен вход в несколько аккаунтов Codex, включите **Показывать каждый аккаунт Codex
28+
отдельно в списке моделей** на странице **Codex Auth**. Тогда аккаунт для диалога можно выбрать
29+
явно, не выходя из остальных аккаунтов, а каждая GPT-модель показывается отдельно для каждого из них:
30+
31+
```text
32+
main/gpt-5.6-sol # только встроенный вход Codex
33+
side/gpt-5.6-sol # только добавленный аккаунт с локальным ID side
34+
```
35+
36+
`main` обозначает встроенный вход. Префикс добавленного аккаунта создаётся из выбранного
37+
пользователем локального ID; при конфликте с существующим маршрутом добавляется числовой суффикс.
38+
Этот ID не является типом аккаунта. Такая модель не использует выбор или резервирование Pool: если
39+
указанный аккаунт недоступен, запрос завершается ошибкой. ID `gpt-*` без префикса сохраняют обычное
40+
поведение Pool/Direct. При отключении настройки строки только скрываются, а сохранённые привязки не
41+
удаляются. При удалении добавленного аккаунта его строки исчезают, но привязка остаётся, чтобы
42+
сохранённый выбор не перешёл на другой аккаунт. Повторное добавление того же локального ID
43+
восстанавливает строки. Ручная настройка и `ocx sync` описаны в
44+
[справочнике конфигурации](/ru/reference/configuration/).
45+
2746
Свежие установки и конфигурации без сохранённого режима по умолчанию используют Pool. Текущие
2847
конфигурации используют маркер 2 и сохраняют поставлявшийся v1-вариант в
2948
`~/.opencodex/config.json.pre-openai-tiers-v2.bak`; восстановить его можно так:

‎docs-site/src/content/docs/zh-cn/guides/codex-app-models.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ OpenAI 身份固定为两种:bare native id 是由 `codexAccountMode` 控制 P
1212
context / 922,000 max input;`*-pro` picker id 保持公开身份,线上使用 base 模型加
1313
`reasoning.mode: "pro"`。
1414

15+
如果已登录多个 Codex 账户,可在 **Codex Auth** 中启用 **在模型选择器中分别显示每个 Codex 账户**。
16+
这样无需退出任何账户,就能明确选择对话使用的账户;每个 GPT 模型都会为每个账户显示单独条目:
17+
18+
```text
19+
main/gpt-5.6-sol # 仅使用内置 Codex 登录
20+
side/gpt-5.6-sol # 仅使用本地 ID 为 side 的已添加账户
21+
```
22+
23+
`main` 表示内置登录。已添加账户的前缀由用户指定的本地 ID 生成;如果与现有路由名称冲突,则添加
24+
数字后缀。这个 ID 并不代表账户类型。账户专属模型会绕过
25+
Pool 选择与回退;如果指定账户不可用,请求会直接失败。不带前缀的 `gpt-*` 会保留原有 Pool/Direct
26+
行为。关闭设置只会隐藏这些条目,不会删除已保存的绑定。手动配置与 `ocx sync` 详见
27+
删除已添加账户后,其选择器条目会消失,但绑定会保留,确保已保存的选择不会转到其他账户。使用相同
28+
本地 ID 重新添加账户会恢复这些条目。手动配置与 `ocx sync` 详见[配置参考](/zh-cn/reference/configuration/)。
29+
1530
## 集成路径
1631

1732
`ocx init`、`ocx start` 和 `ocx sync` 会保持解析后的 `CODEX_HOME` 目录下这些文件一致:

‎gui/src/i18n/de.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,12 @@ export const de = {
580580
"codexAuth.openaiMissing": "Der integrierte OpenAI-Anbieter ist nicht konfiguriert.",
581581
"codexAuth.openaiDisabled": "Der integrierte OpenAI-Anbieter ist deaktiviert.",
582582
"codexAuth.openProviders": "Anbieter öffnen",
583-
"codexAuth.namespacesTitle": "Codex-Konten in der Modellauswahl anzeigen",
584-
"codexAuth.namespacesOnDesc": "Die Auswahl zeigt jedes GPT-Modell einmal pro hinzugefügtem Codex-Konto. Ein kontobeschriftetes Modell verwendet für den gesamten Thread das Kontingent dieses Kontos und wechselt nie das Konto.",
585-
"codexAuth.namespacesOffDesc": "GPT-Modelle folgen dem Pool- oder Direktverhalten oben. Aktiviere dies, um das genaue Konto für einen Thread zu wählen.",
586-
"codexAuth.namespacesCompatibilityNote": "Dies ändert nur die Anzeige neuer Modelloptionen. Das aktive Pool-Konto, bestehende Threads und gespeicherte Einstellungen bleiben unverändert.",
587-
"codexAuth.namespacesSaved": "Kontoauswahl aktualisiert. Öffne Codex erneut, falls die Liste veraltet ist.",
588-
"codexAuth.namespacesSaveFailed": "Die Kontoauswahl konnte nicht aktualisiert werden. Die vorherige Einstellung bleibt erhalten.",
583+
"codexAuth.namespacesTitle": "Jedes Codex-Konto separat in der Modellauswahl anzeigen",
584+
"codexAuth.namespacesOnDesc": "Für jedes verfügbare Codex-Konto erscheint jedes GPT-Modell als eigener Eintrag. Die Bezeichnung hinzugefügter Konten wird aus der lokalen ID auf ihrer Karte abgeleitet; der integrierte Login beginnt mit Main. Bei Namenskonflikten wird eine Zahl angehängt. Die Auswahl bindet die Unterhaltung genau an dieses Konto; OpenCodex wechselt nicht und fällt nicht auf ein anderes Konto zurück.",
585+
"codexAuth.namespacesOffDesc": "Aktiviere dies, wenn du mehrere Codex-Konten hast und ohne Abmeldung genau auswählen möchtest, welches Konto eine Unterhaltung verwendet. Beim Ausschalten werden nur diese Einträge ausgeblendet; Konten werden nicht entfernt.",
586+
"codexAuth.namespacesCompatibilityNote": "Dies ersetzt die normalen GPT-Einträge in der Modellauswahl durch kontospezifische Optionen. Bestehende Unterhaltungen und gespeicherte Modellauswahlen behalten ihr aktuelles Routing; reine GPT-Modell-IDs behalten ihr Pool- oder Direktverhalten.",
587+
"codexAuth.namespacesSaved": "Kontospezifische Einträge aktualisiert. Öffne Codex erneut, falls die Liste veraltet ist.",
588+
"codexAuth.namespacesSaveFailed": "Die Modellauswahl konnte nicht aktualisiert werden. Die vorherige Einstellung bleibt erhalten.",
589589
"codexAuth.add": "Hinzufügen",
590590
"codexAuth.refreshQuota": "Kontingente aktualisieren",
591591
"codexAuth.refreshingQuota": "Aktualisiere…",

0 commit comments

Comments
 (0)