Documentation
API Reference
GET
Get Usage Statistics
/v1/usage
Retrieve detailed usage statistics for your A4F API key. This endpoint provides insights into your account information, subscription status, rate limits, token consumption, and model-specific usage.
Authentication Required
This endpoint requires authentication using your A4F API key. Include your API key in the
Authorization
header as a Bearer token.Headers
Authorization
stringRequired
Bearer token for authentication. Your A4F API key. Example:
Bearer ddc-a4f-xxxxxxxx
. See Authentication.Request Parameters
This is a GET request and does not require a request body or query parameters other than those handled by authentication.
Response Body (200 OK)
The response is a JSON object containing various statistics. The structure mirrors the PythonUsageData
interface used internally by A4F services. Some key fields include:
account_information
objectDetails about your account.
username
stringYour username or a display name.
plan
stringYour current subscription plan (e.g., 'free', 'basic', 'pro').
is_enabled
booleanWhether your API key is currently active.
api_key
stringYour API key prefix and last 4 characters (e.g., 'ddc-paid-xxxx...yyyy').
node_id
stringYour GitHub node ID or equivalent identifier used by the backend.
model_usage
objectDetailed usage per model (see 'Model Usage Object' below for structure).
subscription_details
objectInformation about your current subscription.
creation_date
string (ISO 8601)Date your API key or current subscription was created.
total_validity_days
integerTotal validity period of your current plan in days (-999999 for unlimited/free).
remaining_days
integerRemaining days in your current plan validity (-999999 for unlimited/free).
timeline_history
array of objectsHistory of plan activations.
plan
stringPlan name.
activated_at
string (ISO 8601)Activation date.
billing_information
objectSummary of billing.
total_paid
numberTotal amount paid in USD.
cumulative_token_cost
numberEstimated cumulative cost of token usage in USD.
rate_limits
objectYour current API rate limits.
rpm
integer | nullRequests Per Minute limit.
rpd
integer | nullRequests Per Day limit (often null for paid plans).
usage_statistics
objectAggregated usage statistics.
total_requests
objectRequest counts.
count
integerTotal requests made.
successful_requests
integerTotal successful requests.
token_consumption
objectToken counts.
combined
objectAggregated token usage.
input_tokens
integerTotal input tokens.
output_tokens
integerTotal output tokens.
total_tokens
integerTotal combined tokens.
Model Usage Object Structure (within account_information.model_usage
)
The model_usage
field is an object where each key is a model ID (e.g., "provider-1/chatgpt-4o-latest"
) and the value is an object with the following structure:
total_requests
integerTotal requests made to this specific model.
successful_requests
integerTotal successful requests for this model.
failed_requests
integerTotal failed requests for this model.
input_tokens
integerTotal input tokens consumed by this model.
output_tokens
integerTotal output tokens generated by this model.
token_cost_usd
numberEstimated cost of token usage for this model in USD.
last_used
integer (Unix timestamp)Timestamp of the last request made to this model.
Dashboard Integration
The data from this
/v1/usage
endpoint is what powers your A4F Dashboard. The /api/dashboard-stats
Next.js route on this site is a wrapper that fetches from /v1/usage
and transforms the data for frontend display.Interactive Example
Request & Response Example
Was this page helpful?