Skip to main content

Account pools and failover

See how memtrunk pools Claude, ChatGPT and Codex, and Antigravity accounts. Learn how to add accounts, how share modes work, and what happens at a limit.

Last updated

An account pool is a group of provider accounts that the gateway draws from. A provider account is a subscription account that a user signs in to. memtrunk has three pools.

The three pools#

PoolTab on the Accounts pageSwitch in Allowed sourcesNote
ClaudeClaudeClaudeMain path: /v1/messages.
ChatGPT and CodexChatGPTOpenAI / CodexMain paths: /v1/chat/completions and /v1/responses.
AntigravityAntigravityAntigravityA model name that starts with antigravity/ stays on this pool.

A /v1/messages request can also draw the ChatGPT and Antigravity pools. Allowed sources is a field of a memtrunk key. Read Credentials.

Add an account#

  1. Open Accounts in the console.
  2. Select the tab of the pool.
  3. Select Add account. The dialog is named Add Claude account, Add ChatGPT account or Add Antigravity account.
  4. Choose a sign-in method and follow the steps in the dialog.

The dialog offers up to three sign-in methods.

MethodWhat it doesWhen it works
Sign in hereOpens a sign-in window for the provider.Your browser and the memtrunk backend run on the same machine. Otherwise the console shows the reason.
Paste codeYou sign in in a new tab and paste the code back.The Claude pool offers it on any setup. The ChatGPT and Antigravity pools need the browser and the backend on the same machine.
Another machineThe console makes a one-time script. You run it on the machine where you sign in.The console runs on a different machine than your browser.

The Antigravity dialog also has an Import from JSON instead link.

The user who adds an account becomes its owner.

Share modes#

A share mode controls who can draw an account. The Share mode control in the account details changes it. An administrator can set all four modes. In the console, an org admin can set all four modes on own accounts. An owner who is not an administrator can set Pool or Private. Auditors cannot change a mode. An account with no owner cannot use Owner-only or Private.

ModeMeaning
PoolThe account is on. Other users in the organization can draw it. On the Claude pool, they can draw it only when the In pool setting of its owner is on.
Owner-onlyThe owner draws the account. Other users cannot, unless a grant names their scope. The owner requests can still use other pool accounts.
PrivateThe owner draws the account.
OffThe account is off.

A user who owns a usable Private account draws only their own accounts. Their requests never use the quota of another user.

Grants#

A grant lets a scope draw an account that it would not draw otherwise. The scope is an organization, a team or a member. To add a grant, open Profile and select the Usage tab. Find the account in Your accounts. Select Manage sharing. Choose a scope in Grant access to, then select Add grant. Select Revoke to remove a grant.

On the Claude pool, a grant overrides the Source of the key. A Private account stays with its owner even when a grant names it.

How the gateway chooses an account#

The Claude pool and the ChatGPT and Codex pool use the Account strategy setting. The strategy is Least used unless the instance settings change it. The other values are Sequential and Random. The Antigravity pool does not use this setting.

With Least used, the Claude pool scores each account. The score uses the usage and the reset time of the five-hour and seven-day windows. It also uses the requests in flight, the plan tier and the active sessions. The time since last use breaks a tie.

With Least used, the ChatGPT and Codex pool first orders accounts by usage in the primary window.

Key source on the Claude pool#

A key with the Own provider key source draws only the accounts that its owner owns. A key with the Shared pool source draws the shared accounts of the organization and the accounts of its owner. A shared account counts only when the In pool setting of its owner is on. The other two pools do not apply the Own provider key restriction.

Session pinning on the Claude pool#

The Claude pool keeps a session on one account. This is the Session stickiness setting. It is on unless the instance settings turn it off. The gateway moves the session when the pinned account is not usable. It also moves the session when the busier of the five-hour and seven-day windows reaches the Sticky soft threshold. The threshold is 85 percent by default. The other two pools do not pin sessions.

Limits and cooldown#

A cooldown is a period in which the gateway skips an account for one model.

  • Claude pool: on a rate limit or a quota error, the gateway sets a cooldown and tries the next account.
  • ChatGPT and Codex pool: on a rate limit, the gateway marks the account as limited for that model and rotates. It waits for a short limit. It gives up when every account stays limited for too long.
  • Antigravity pool: on a quota error, the gateway sets a cooldown on that account for that model.

When no account is available#

The response depends on the pool and the request path.

Pool and pathResponse
Claude pool, /v1/messages429 with a rate_limit_error body and a Retry-After header. This applies when every candidate account is on cooldown or fully used.
Claude pool, /v1/messages529 with an overloaded_error body and a Retry-After header. This applies when every candidate account is overloaded. A non-streaming request that takes over 110 seconds gets the same 529.
Claude pool, /v1/messages400 with an invalid_request_error body when the provider rejects the request itself. Other failures give a 500 api_error or the upstream status.
Antigravity pool, /v1/messages, model antigravity/*429 with a Retry-After header when the pool hit a quota. 529 when the model has no capacity. 500 otherwise. A non-streaming request that takes over 110 seconds gets a 529 with no Retry-After header.
ChatGPT and Codex pool, /v1/chat/completions503 with the body type service_unavailable. The status is 429 when every provider key is rate limited.
ChatGPT and Codex pool, /v1/responses503 with an error.message body. The status is 429 with retry_after in the body when every provider key is rate limited.

A streaming /v1/messages request commits its response when the gateway has no answer after about 10 seconds. The status is then already 200. A later error arrives as an event: error stream event with no Retry-After header.

Next steps#