Framing: a solo developer's workflow (2026-11). Claude / Codex / Grok are one example combination; Kimi / GLM / Qwen / DeepSeek work the same way. Claude: Anthropic has not supported mainland China, Hong Kong or Macau since 2026-11-12, including use while there (checked 2026-11-23). Codex: mainland China is not on OpenAI's supported-countries list (2026-11-23, carried over from the PR #14 draft). Grok: check xAI's terms for your region.
Situation
- Audience: people paying for two or three AI coding services who hit "5-hour limit reached" mid-task and watch the whole pipeline stall.
- When to use: a coordinator (you or an agent) dispatches work to several agents.
- When not to use: you have only one provider — nothing to route to; wait.
This is step 3 (pick a pattern) of the method applied to routing: choose by role plus quota fallback, not by "which model is smartest".
Steps
- List the quota signals you can actually see (for Kimi / GLM plans, read each console's window rules): Claude Code
/usage(5-hour and weekly windows, shared with claude.ai); Codex/statusor the usage dashboard; otherwise treat errors mentioningusage limit/rate limitas "unavailable". If your orchestrator has one usage page covering several providers (we use Orca's), trust that. - Rank by role. One solo developer's table (changes with quota): plan/code → Claude, then Codex only if Claude is unavailable; independent review → Codex (read-only), then a separate Claude session, then Grok; chores (research, tests, logs, docs) → Grok, then Codex, then Claude. Hard rules: writer ≠ reviewer session; payments/IAP/permission changes are not reviewed by your least-trusted model.
- Save quota: one workstream at a time; the coordinator dispatches and accepts but does not read code (
coordinator-agent-specs); use completion notifications, not polling (hooks-not-polling-notifications). - Put the table into the coordinator's instructions (template above).
- Log every switch with time zones for both the event and the expected reset; switch back when quota returns.
- Reminders and scheduled wake-ups use the same time zone as the reset time; record both local time and UTC.
Templates
AGENTS.md snippet and status line are in the code blocks above. In pipeline.yaml, routing lives in each model step's fallback; steps that must not degrade say fallback.models: [] and "wait for quota". Re-estimate tokens after any fallback (ROI input table).
Cost (order of magnitude, estimate)
- Routing itself is nearly free; what it saves is stalled time. Quota windows are measured in hours; fallback turns "wait hours" into "swap a role".
- Different models tokenize and write differently: re-measure, don't reuse A's usage numbers for B.
Failure cases and guards
The first four items are dated records; the rest are guards.
- Date and time zone misread (nearly 24 hours late; caught in time, no actual delay): on 2026-11-23 a waiting worker reported "6:15 AM reset" with no date or zone; the machine runs PST and the owner is on Beijing time (UTC+8). The coordinator read it as "tomorrow morning" and set a one-shot wake-up for 2026-11-24 06:20 PST, but the Codex log's
rate_limits.primary.resets_atconverts to 2026-11-23 06:15 PST — the same day — so it would have fired a full 24 hours late. At 02:47 PST the same day, converting withdate -d @<resets_at>exposed it and the reminder was deleted and recreated for 2026-11-23 06:20 PST. Lesson: trust the log's epoch for reset times, and write date plus zone when converting (date -d @<epoch>); one-shot reminders built as cron repeat yearly, so delete them after they run. (Record: the coordinator's own account, the automation's delete/recreate record on the machine, and the dated quota update in the dev-workflow doc.) - Reading the wrong number: on 2026-11-23 Codex's local session log showed
credits.balance = 0, but that was separately purchased credit; the number to read is the 5-hour windowused_percent(about 5% that evening after the reset). Local log formats are undocumented; prefer/statusor the official dashboard. - Two providers near their limits at once: one early-morning observation on 2026-11-23 had Claude's 5-hour window ≈91% and Codex ≈100%; all workers were parked at safe points and woken together after the reset.
- Fallback to the same session is not a review.
- Downgrading review to avoid waiting: for risky changes, wait. On 2026-11-24 a second review round was deliberately postponed until Codex recovered instead of swapping reviewers.
- Time-limited allowances treated as permanent: write the expiry date (e.g. a trial ending on a given day) into the table.
- Reachable ≠ permitted in unsupported regions.
China alternatives
china_availability: partial. The method is vendor-neutral: build the same table from Kimi Code / GLM Coding Plan / Qwen Code / DeepSeek API. Their window rules differ — confirm in each console (we only link a comparison article; not tested here).- Local models (Ollama etc.) can fill the "chores" tier (see
local-airecipes); not tested here. - No circumvention advice.
Safety notes
- The coordinator only needs usage percentages, never credentials; don't paste tokens or cookies to see quota.
- When reading local session logs, extract only the quota fields; don't paste whole logs (they may contain code or secrets) into chats or repos.
Test notes
- 2026-11-23/24: the table and switches were used in a solo developer's multi-agent setup with dated switch entries (Codex exhausted → review reassigned; recovered → defaults restored; exhausted again early 2026-11-24 → waited).
- The templates here are cleaned-up rewrites that were not re-run verbatim;
/usageand/statusbehavior follows the official docs (consulted 2026-11-23). Local versions: Claude Code 2.1.330, Codex CLI 0.171.0 (2026-11-23).
Verification
- Make the first choice unavailable on purpose; the coordinator should route to the next and log a zone-qualified switch.
- After a week: did any quota gap stall the pipeline for more than half a day?