Subscription usage limits
Created: 2026-10-30. Last updated: 2026-10-31.
/usage, pi usage, and the native extension method usage.get show the limits of pi’s subscription logins.
The code is in:
crates/pi-ai/src/usage/crates/pi-ai/src/providers/antigravity_acp/usage.rs
The tests use local mock servers and an in-process ACP agent. No test calls a live service.
Sources
Read on 2026-10-30:
- oh-my-pi at commit
5d30c790b883ad0ae05dac2a4d2ccc8ecd103611:packages/ai/src/usage/{claude,openai-codex,cursor,google-antigravity,xai-oauth}.tspackages/ai/src/registry/oauth/xai-oauth.ts(getXAICliBillingHeadersandbuildXAICliBillingUrl)
- paseo at commit
a4f696620b5d248598a882b1a78d82ec5038c74b:plugins/{claude,codex,cursor,grok}-usage-source/server/usage.ts
extensions/subscription-router/src/usage/inyannelli/pi-rust-extensions.- The Antigravity ACP server 1.4.3 (
agy_acp_server.par): its_handle_usage_commandandusage_lib.format_usage_message.
Endpoints
| Provider ID | Request | Auth | Fields that pi reads |
|---|---|---|---|
anthropic |
GET https://api.anthropic.com/api/oauth/usage |
Authorization: Bearer <OAuth token>, anthropic-beta: oauth-2025-04-20, user-agent: claude-cli/<version>, x-app: cli |
five_hour and seven_day: utilization (0 to 100) and resets_at (ISO 8601). seven_day_<model> keys and limits[] entries with kind: "weekly_scoped" (percent, resets_at, scope.model.display_name) are weekly limits of one model. |
openai-codex |
GET https://chatgpt.com/backend-api/wham/usage |
Authorization: Bearer <OAuth token>, chatgpt-account-id (stored accountId, or the claim of the token), originator: pi |
plan_type. rate_limit.primary_window and secondary_window: used_percent, limit_window_seconds (18000 is 5 hours, 604800 is a week), reset_at (Unix seconds). additional_rate_limits[] has the same shape under limit_name. A body that starts with < is an HTML error page. |
cursor |
POST https://api2.cursor.sh/aiserver.v1.DashboardService/GetCurrentPeriodUsage with body {} |
Authorization: Bearer <Cursor login token>, connect-protocol-version: 1, x-cursor-client-version |
planUsage.totalPercentUsed, autoPercentUsed, apiPercentUsed. billingCycleStart and billingCycleEnd are Unix milliseconds, as numbers or strings. |
xai |
GET https://cli-chat-proxy.grok.com/v1/billing?format=credits. For unified billing, also GET .../v1/billing without format. |
Authorization: Bearer <xai OAuth token>, X-XAI-Token-Auth: xai-grok-cli |
config.currentPeriod (start, end, a type with WEEK), creditUsagePercent (missing in an active period means 0), and productUsage[] (product, usagePercent). Unified billing (isUnifiedBillingUser, or no weekly data): billingPeriodStart, billingPeriodEnd, monthlyLimit.val, and used.val. |
google-antigravity |
ACP session/prompt with the text /usage to the Antigravity ACP server |
The server uses its own Google credential. pi holds no Google token. | The Markdown report of the server. pi reads the lines under ### Quota Limits, shown below the table. |
The lines under ### Quota Limits in the Antigravity report have this format:
- **<group>**
- **<bucket>:** 91% remaining (resets Oct 02, 2026, 08:22 UTC)
The Antigravity ACP server answers /usage itself and does not start a model turn. For a personal Google login it calls cloudcode-pa v1internal:retrieveUserQuotaSummary. For a business login it calls Vertex AI FetchQuotaStatus. oh-my-pi calls retrieveUserQuotaSummary and fetchAvailableModels directly, because it keeps the Google token itself.
oh-my-pi reads Cursor usage from https://cursor.com/api/usage-summary with a session cookie, and from GetPlanInfo for the weekly reset. pi uses the paseo request, because it uses the bearer token of the Cursor login on the provider host.
What pi shows
| Provider ID | Windows |
|---|---|
anthropic |
5h (300 minutes), Weekly (10080 minutes), and Weekly <model> for each model limit, for example Weekly Opus |
openai-codex |
5h and Weekly from the window length, or Primary and Secondary when the response has no length. Extra limits are <limit name> 5h. The plan type is the plan. |
cursor |
Total, Auto, and API for the billing cycle. The reset is the end of the cycle. |
xai |
Weekly (the SuperGrok credits) and Weekly <product>, for example Weekly Grok Build and Weekly API. Unified billing shows Monthly as used of monthlyLimit. |
google-antigravity |
<group>: <bucket>, for example Gemini Models: Weekly. The used percentage is 100 minus the remaining percentage. |
- Each window has
label,usedPercent(0 to 100),resetsAt(ISO 8601 UTC ornull), andwindowMinutes(ornull). It also has:scope:provider, ormodelfor a limit of some models only, withfamilies(for example["opus"]fromseven_day_opus). Every window hasscope, so a missingscopemeans an older pi.id: the name the provider gives the window, for examplefive_hour,seven_day_opus,primary_window, orSpark/primary_windowfor an extra Codex limit.resetsAtMs: the reset in Unix milliseconds, as exact as the provider reports it. Codexreset_after_secondscounts from the fetch.windowSeconds: the exact window length when the provider reports a whole number of seconds (windowMinutesis rounded).
- An entry can also have
credits({ available, unlimited, balance }, Codex). - A failed entry has
errorKindandretryAfterMs:errorKindislogin,unsupported,rejected,rateLimited,http,network, orresponse.retryAfterMsis theretry-afterheader in milliseconds, from a delay or an HTTP date.
planis the Codexplan_type(ortier) and the Anthropicplan_type.- An extension provider that logs in with
oauth: { builtin: "anthropic" | "openai-codex" | "cursor" | "xai" }reads its usage with that provider’s endpoint and its own login. For example,usage.get { provider: "anthropic-2" }sends the token ofanthropic-2. pi caches the result under the id of the extension provider, and unregistering the provider removes it. Agoogle-antigravityslot has no usage: its fetcher starts the one ACP session of pi, which cannot use a second login. - pi keeps each result for 60 seconds. For
google-antigravityit keeps a result for 5 minutes, because each fetch starts the ACP server./usageandpi usagefetch again.usage.getfetches again withrefresh: true. - These cases give an entry with
errorand no windows:- a provider without a login
- a rejected token (HTTP 401 or 403)
- HTTP 429
- an HTML page
- an Antigravity report without quota data
- pi refreshes an expiring OAuth token under the store lock before it sends the request, as for a model request.
Not supported
- A separate
grok-buildprovider. Pull request 126 removed it because thexailogin is the same SuperGrok device login. TheWeekly Grok Buildwindow ofxaishows Grok Build use. - Usage of API keys. The endpoints above report subscription limits only.
- The
openailogin (Sign in with ChatGPT for the OpenAI API). Its token is forapi.openai.com, and no source readswham/usagewith it.