Overview
The usage endpoint provides real-time information about your current rate limit status, quota usage, and credit balance. This endpoint uses ChatGPT session authentication instead of API keys.Endpoint
GET /api/codex/usage
Retrieves usage statistics and rate limit information for the authenticated account. Base URL:https://your-codex-lb-instance.com
Query Parameters
None.Headers
string
required
Bearer token from ChatGPT session (e.g.,
Bearer chatgpt-access-token)string
required
ChatGPT workspace/account ID
Response
string
Account plan type (e.g.,
plus, team, enterprise)object
Rate limit status information
object
Credit balance information (if applicable)
Example Response
Example Request
Authentication
This endpoint uses ChatGPT session authentication, not API keys. You must provide:- An
Authorizationheader with a valid ChatGPT access token - A
chatgpt-account-idheader with your workspace/account ID
Rate Limit Windows
Primary Window
Typically a 5-hour rolling window (18000 seconds). This is the main rate limit that applies to most API usage.Secondary Window
Typically a 7-day rolling window (604800 seconds). This provides additional capacity for burst usage while maintaining weekly limits.Window Selection
The API returns both windows when available. If only one window is active (e.g., weekly-only limits), the other will benull.
Usage Monitoring
Interpreting Usage Percentages
0-50%- Normal usage, plenty of capacity51-80%- Moderate usage, monitor if making many requests81-99%- High usage, consider throttling requests100%- Limit reached, requests will be rejected until reset
Planning Based on Reset Times
Credits
For accounts with credit-based billing:has_credits: true- Account can make requestshas_credits: false- Account is out of creditsunlimited: true- Account has unlimited credits (enterprise plans)balance- Current credit balance in USD
Error Handling
401 Unauthorized
Invalid or expired access token:403 Forbidden
Missing or invalidchatgpt-account-id header:
Use Cases
Pre-Request Validation
Check usage before making requests to avoid hitting rate limits:Dashboard Display
Display usage information in your application:Notes
- Usage data is aggregated across all accounts in your Codex-LB pool
- The endpoint returns the most recent usage data from the last refresh cycle
- Both primary and secondary windows may not always be present
- For weekly-only plans,
primary_windowwill benullandsecondary_windowcontains the weekly limit - Usage percentages are calculated based on the upstream provider’s limits
- This endpoint does not count against your rate limit