GoClaw v2.34.0

Codex OAuth Pools

Gộp nhiều tài khoản OpenAI Codex thành một pool thống nhất. Route request tự động. Theo dõi quota real-time.

scroll

Rate limit theo từng account

OpenAI giới hạn rate limit theo từng tài khoản subscription. Với 3–5 tài khoản Codex, bạn phải xoay xở thủ công.

1

Chuyển đổi thủ công khi hết quota

2

Không biết account nào còn dư

3

Không aggregate được throughput

Với team 5–10 người dùng chung gateway, vấn đề nhân lên gấp bội.

Bốn bước thiết lập

01

Đăng ký OAuth

Mỗi tài khoản Codex/ChatGPT thành một named provider riêng biệt. GoClaw lưu refresh token, tự xử lý token refresh.

02

Tạo Pool

Chọn provider owner, thêm members vào codex_pool.extra_provider_names.

03

Chọn Strategy

Cấu hình cách phân bổ request: primary first, round robin, hoặc priority order.

04

Agent Inherit

Set override_mode: "inherit" — agent tự nhận pool config từ provider.

Pool Validation

No self-reference One pool per member Owner ≠ member All chatgpt_oauth type

Request pipeline

GoClaw Gateway — Request Flow
User Message
Agent Loop
Resolver
Routing Engine
Codex OAuth Pool
codex-pro-1
35%
healthy
codex-pro-2
85%
healthy
codex-team
10%
degraded

Ba chiến lược phân bổ

StrategyHành vi
primary_firstLuôn dùng owner trước, failover sang member khi lỗi
round_robinXoay vòng đều giữa tất cả accounts trong pool
priority_orderDùng theo thứ tự ưu tiên, tự chuyển khi account gặp lỗi

Inherited Routing Defaults

Agent inherit routing config từ provider — cấu hình một lần, tất cả agents tự hưởng.

Provider

"codex-main"
Pool owner
codex-backup
codex-team
round_robin
inherit

Agent

"assistant"
Provider: codex-main
Override: inherit
(no pool config)

Quota real-time

GoClaw gọi OpenAI Usage API để lấy quota cho mỗi account trong pool.

Pool Dashboard

Codex OAuth Pool

Live
codex-pro-1
65%healthy
5h: 35% remainweekly: 80% used
codex-pro-2
15%healthy
5h: 92% remainweekly: 25% used
codex-team
90%degraded
5h: resets in 2h 15mweekly: resets in 3d 4h
● 2 healthy   ⚠ 1 degradedStrategy: round_robinLast → codex-pro-2 (2m ago)

Auto-failover tracking

Gateway track health mỗi account qua tracing data. Khi một account liên tục lỗi, routing engine tự chuyển sang account khác.

Success Rate
94%
Request thành công
Health Score
87
Điểm tổng hợp
Consec. Failures
0
Lỗi liên tiếp
State
OK
healthy

Access control

🔒

Chỉ admin/operator quản lý pool

👁

Viewer: dashboard read-only

🏢

Tenant isolation — no cross-tenant leak

🔑

Badge needs_reauth khi token expired

Thực tế triển khai

Team 8 người, 3 Codex Pro accounts

Trước v2.34.0
  • Admin rotate key thủ công khi hết quota
  • Tạo 3 agents riêng, user tự chọn → UX kém
Sau v2.34.0
  1. 3 accounts OAuth → 3 named providers
  2. Pool round_robin
  3. Agent set inherit
  4. 8 users, 1 agent, tự phân bổ đều
  5. Dashboard quota real-time

Tách biệt workload

Priority Order
  • codex-heavy (Pro) → agent xử lý task nặng
  • codex-light (Plus) → agent chat thường
  • Heavy trước, fallback sang light khi hết quota

Tóm tắt kỹ thuật

ComponentFileVai trò
Pool Validationchatgpt_oauth_pool_validation.goValidate graph: no cycles, no dual-ownership
Pool HTTP APIagents_codex_pool.goCRUD pool config, activity, health
Quota Fetcheroauth/openai_quota.goOpenAI Usage API, parse quota windows
Quota Transportoauth/openai_quota_transport.goHTTP transport + auth injection
Token Mgmtoauth/token.goRefresh token, metadata backfill
Routingagent/resolver.goResolve provider theo strategy
Store Typesstore/agent_store.goConstants, routing config structs
Dashboardagent-codex-pool-page.tsxPool management UI
Quota UIchatgpt-oauth-quota-*.tsxBars, badges, readiness