Skip to main content

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:
  1. An Authorization header with a valid ChatGPT access token
  2. A chatgpt-account-id header with your workspace/account ID
These credentials can be obtained from your ChatGPT web session.

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 be null.

Usage Monitoring

Interpreting Usage Percentages

  • 0-50% - Normal usage, plenty of capacity
  • 51-80% - Moderate usage, monitor if making many requests
  • 81-99% - High usage, consider throttling requests
  • 100% - 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 requests
  • has_credits: false - Account is out of credits
  • unlimited: 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 invalid chatgpt-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_window will be null and secondary_window contains the weekly limit
  • Usage percentages are calculated based on the upstream provider’s limits
  • This endpoint does not count against your rate limit