usage-stats

Get Api Key Usage Stats

Changed on

Get usage statistics for a specific API key.

Args: api_key_id: The local API key ID

Returns: Usage statistics for the specified API key

get/api/v1/usage-stats/api-key/{api_key_id}

Request

  • Base URL: https://qcode.cc (the document declares no server; this is the origin it was published from)
  • URL: https://qcode.cc/api/v1/usage-stats/api-key/{api_key_id}
  • Auth: none declared

Path parameters

api_key_idinteger required

Response

Successful Response

api_key_idinteger required

Local API key ID

api_key_namestring required

API key name

external_idstring nullable required

External API key ID

is_activeboolean required

Whether API key is active

expires_atstring nullable

Expiration timestamp from API

expires_at_displaystring

Formatted expiration time for display

current_tokensinteger

Current window tokens used

current_requestsinteger

Current window requests made

current_daily_costnumber

Current daily cost

formatted_current_coststring

Formatted current daily cost

current_window_tokensinteger

Current rate limit window tokens

current_window_requestsinteger

Current rate limit window requests

current_window_costnumber

Current rate limit window cost

total_tokensinteger

Total tokens used

total_requestsinteger

Total requests made

total_costnumber

Total cost

formatted_coststring

Formatted total cost

daily_cost_limitnumber

Daily cost limit

token_limitinteger

Token limit

has_daily_limitboolean

Whether this key has daily limits

rate_limit_windowinteger

Rate limit window in minutes

rate_limit_requestsinteger

Rate limit requests per window

rate_limit_costnumber

Rate limit cost per window

opus_weekly_costnumber

Opus model cost this week

opus_weekly_limitnumber

Opus model weekly limit

opus_weekly_percentagenumber

Opus weekly usage percentage

has_monthly_quotaboolean

Whether this key has a monthly/lifetime cost cap

monthly_cost_limitnumber

Monthly cost limit in USD (CRS totalCostLimit)

monthly_cost_usednumber

Amount of monthly cost used

monthly_cost_percentagenumber

Percentage of monthly cost limit used

monthly_quota_modestring nullable

Ultimate quota card mode: period (current cycle) / cumulative (all-time)

monthly_cost_remainingnumber nullable

Ultimate: max(0, monthly_cost_limit − monthly_cost_used), what CRS still lets through

monthly_quota_exhaustedboolean

Ultimate: quota used up (remaining < $0.01) ⇒ CRS answers 402 until it is restored

monthly_cycle_startstring nullable

Ultimate period keys: current 30-day cycle start, Beijing date YYYY-MM-DD

monthly_cycle_endstring nullable

Ultimate period keys: current cycle end (next reset day, or expiry day if that comes first), Beijing date

monthly_restore_kindstring nullable

Ultimate period keys: 'anchor' (next 30-day reset) or 'expiry' (plan ends before the next reset)

monthly_restore_atstring nullable

Ultimate period keys: when the quota comes back, Beijing 'YYYY-MM-DD HH:MM' (reset time or expiry)

monthly_next_resetstring nullable

Ultimate period keys: the reset task's next 30-day anchor day, Beijing date; for 'expiry' this is when a renewed plan gets its quota back

plan_typestring

Key plan type: plan (personal plan) / payg (pay-as-you-go pack)

payg_remaining_usdnumber nullable

PAYG: max(0, totalCostLimit − all-time rated cost); 0 once expired; None if unreadable

payg_available_usdnumber nullable

PAYG: quota available right after the last purchase (limit_after − spent then); the current limit if unknown

payg_expiredboolean nullable

PAYG: key expired (remaining quota forfeited; buying a pack revives the same key)

payg_expires_atstring nullable

PAYG: expiry in Beijing time, 'YYYY-MM-DD HH:MM'

window_remaining_secondsinteger

Seconds until window reset

window_remaining_textstring

Human readable time until reset

daily_cost_percentagenumber

Percentage of daily cost limit used

token_percentagenumber

Percentage of token limit used

window_requests_percentagenumber

Percentage of window requests used

window_cost_percentagenumber

Percentage of window cost used

is_near_cost_limitboolean

Whether near daily cost limit

is_near_token_limitboolean

Whether near token limit

is_near_window_limitboolean

Whether near window limit

is_near_opus_limitboolean

Whether near Opus weekly limit

has_errorboolean

Whether there was an error fetching stats

error_messagestring nullable

Error message if any

error_typestring nullable

Error type for better handling

Changes

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status