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.

Headers

Authorization

string
Required
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

object
Details about your account.

username

string
Your username or a display name.

plan

string
Your current subscription plan (e.g., 'free', 'basic', 'pro').

is_enabled

boolean
Whether your API key is currently active.

api_key

string
Your API key prefix and last 4 characters (e.g., 'ddc-paid-xxxx...yyyy').

node_id

string
Your GitHub node ID or equivalent identifier used by the backend.

model_usage

object
Detailed usage per model (see 'Model Usage Object' below for structure).

subscription_details

object
Information about your current subscription.

creation_date

string (ISO 8601)
Date your API key or current subscription was created.

total_validity_days

integer
Total validity period of your current plan in days (-999999 for unlimited/free).

remaining_days

integer
Remaining days in your current plan validity (-999999 for unlimited/free).

timeline_history

array of objects
History of plan activations.

plan

string
Plan name.

activated_at

string (ISO 8601)
Activation date.

billing_information

object
Summary of billing.

total_paid

number
Total amount paid in USD.

cumulative_token_cost

number
Estimated cumulative cost of token usage in USD.

rate_limits

object
Your current API rate limits.

rpm

integer | null
Requests Per Minute limit.

rpd

integer | null
Requests Per Day limit (often null for paid plans).

usage_statistics

object
Aggregated usage statistics.

total_requests

object
Request counts.

count

integer
Total requests made.

successful_requests

integer
Total successful requests.

token_consumption

object
Token counts.

combined

object
Aggregated token usage.

input_tokens

integer
Total input tokens.

output_tokens

integer
Total output tokens.

total_tokens

integer
Total 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

integer
Total requests made to this specific model.

successful_requests

integer
Total successful requests for this model.

failed_requests

integer
Total failed requests for this model.

input_tokens

integer
Total input tokens consumed by this model.

output_tokens

integer
Total output tokens generated by this model.

token_cost_usd

number
Estimated cost of token usage for this model in USD.

last_used

integer (Unix timestamp)
Timestamp of the last request made to this model.

Interactive Example

Request & Response Example

curl https://api.a4f.co/v1/usage \
-H "Authorization: Bearer YOUR_A4F_API_KEY"

Was this page helpful?