Skip to content

About

Spends your Claude/Codex weekly quotas before they reset · CLIProxyAPI scheduler plugin for account prioritization that sends each new session to the account whose weekly quota resets soonest and keeps it there.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CLIProxyAPI Expiring Quota First

Release Latest release Built for CLIProxyAPI License: MIT

Spend your Claude and Codex weekly quotas before they reset.

This plugin is the "account prioritization" feature Theo (t3.gg) mentions in his video "If you have a Claude sub, watch this", at 18:11. In the video he says he made it in his own fork. That fork isn't public, and I wanted it too, so I implemented it and I'm sharing it as a plugin for the upstream CLIProxyAPI.

Theo's video, If you have a Claude sub, watch this, opened at 18:11

A scheduler plugin for CLIProxyAPI, for anyone running two or more Claude or Codex subscriptions behind it. Without it, one account hits its weekly limit while another still has half its week unused, and on reset day that half is gone. With it, each new session, meaning each new Claude Code or Codex CLI conversation, goes to the account whose quota resets soonest, so the quota about to expire is the one you burn.

What you get

  • Sessions are sticky. A conversation stays on its account, across CLIProxyAPI restarts too, and moves only when that account is used up, its login is rejected, or CLIProxyAPI stops offering it.
  • New sessions avoid accounts that are used up, nearly used up, or whose login was rejected, as long as another account is ready.
  • Claude's separate weekly limit on its top model is tracked as well, so a session for that model avoids an account that is out of it. As of 2026-10 that model is Fable.
  • A Claude Code subagent gets the same account as the conversation that started it.
  • It starts in shadow mode: it records each pick it would have made, with the reason, in a state file, and routes nothing until you switch it to active. Until then CLIProxyAPI routes as before.
  • The plugin's data stays on your machine. It learns quota from the rate-limit headers CLIProxyAPI already receives, makes no network calls of its own, and writes no keys or raw session ids to disk.

How it picks an account

flowchart TD
    R([A conversation sends a request]) --> B{Does this conversation<br>already have an account?}
    B -- yes --> O{Is that account still<br>available, with quota left?}
    O -- yes --> K[Keep using it]
    O -- "no, or it has been<br>gone for a while" --> N
    B -- no --> N[Choose the best account]
    N --> RANK
    subgraph RANK[Ranked, best first]
        direction LR
        G1[1 Ready<br>has quota left, or<br>not checked yet] ~~~ G2[2 Unconfirmed<br>should have reset by now,<br>not seen working since] ~~~ G3[3 Low<br>almost out of quota] ~~~ G4[4 Unusable<br>out of quota, or<br>login just failed]
    end
    RANK --> P[Use it for the rest<br>of this conversation]
    RANK -. no usable account .-> C[CLIProxyAPI decides, as it<br>would without the plugin]

    classDef ready fill:#2e7d32,color:#fff,stroke:#1b5e20
    classDef waiting fill:#f9a825,color:#000,stroke:#f57f17
    classDef low fill:#ef6c00,color:#fff,stroke:#e65100
    classDef bad fill:#c62828,color:#fff,stroke:#b71c1c
    classDef neutral fill:#455a64,color:#fff,stroke:#263238
    class G1,K,P ready
    class G2 waiting
    class G3 low
    class G4 bad
    class C,R,N neutral
    style RANK fill:none,stroke:#78909c,stroke-dasharray:4,color:#b0bec5
Loading

Only the weekly quota counts; the five-hour limits are ignored. Among ready accounts the soonest weekly reset wins, except that an account whose reset time is still unknown is tried first, so the plugin learns it. A session keeps its account until it has been idle for a week, by default. Configure has the timing and threshold settings, and Known limits what the plugin cannot see.

Try it

Releases cover Linux, macOS and Windows, and each one's notes name the CLIProxyAPI version it was built for; the badge above shows the version pinned on main. Install has the details.

  1. Add this repository's registry.json as a plugin store source in CLIProxyAPI's config.yaml. Skip this step when the plugin store page of your management console already lists the plugin:

    plugins:
      store-sources:
        - "https://raw.githubusercontent.com/stavarengo/CLIProxyAPI-Expiring-Quota-First/main/registry.json"
  2. Install Expiring Quota First from the plugin store page of your management console.

  3. Turn plugins on and start in shadow mode. The plugin's own enabled is already there from the store install; the global plugins.enabled is off while missing, so add it. The block should read:

    plugins:
      enabled: true
      configs:
        expiring-quota-first:
          enabled: true
          mode: shadow
  4. After some traffic, read the picks in the state file. Once they are the accounts you would have chosen, set mode: active.

Read more

  • Install: which CLIProxyAPI versions and platforms a release fits, the management API call, and installing by hand.
  • Configure: every setting with its default, and where the state lives.
  • State file: what the plugin records, and how to read its picks.
  • Known limits: what the plugin does not see or decide.
  • Develop: tests, reproducing a release build, and releasing.

License

MIT

About

Spends your Claude/Codex weekly quotas before they reset · CLIProxyAPI scheduler plugin for account prioritization that sends each new session to the account whose weekly quota resets soonest and keeps it there.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages