Skip to main content

Openai Usage

@dougschaefer/openai-usagev2026.05.27.1· 3d agoMODELS
01README

OpenAI platform usage and cost reporting via the Organization Usage API — daily and total completion token counts and USD spend, month-to-date by default. Vault-based Admin API key (the api.usage.read scope is required; a standard project key cannot read usage).

02Release Notes

Initial release. Query the OpenAI Organization Usage and Cost API for month-to-date completion token usage and USD spend, with daily breakdowns; vault-based Admin key (api.usage.read scope). Fills a gap no community extension covers: the OpenAI platform usage API (not Azure/Bedrock/Vertex).

03Models1
@dougschaefer/openai-usagev2026.05.27.1openai-usage/usage.ts

Global Arguments

ArgumentTypeDescription
apiKeystringOpenAI Admin API key (sk-admin-...) carrying the api.usage.read scope. Store it in a vault and pass via a CEL expression; a standard project key cannot read usage.
fn usage(startDate?: string, days?: number)
Fetch OpenAI completion token usage (input/output tokens and request counts) by day for the period. Defaults to month-to-date. Requires an Admin key with the api.usage.read scope.
ArgumentTypeDescription
startDate?stringInclusive start date YYYY-MM-DD (UTC). Defaults to the first of the current month.
days?numberAlternative to startDate: look back this many days from now.
fn costs(startDate?: string, days?: number)
Fetch OpenAI spend in USD by day for the period. Defaults to month-to-date. Requires an Admin key with the api.usage.read scope.
ArgumentTypeDescription
startDate?stringInclusive start date YYYY-MM-DD (UTC). Defaults to the first of the current month.
days?numberAlternative to startDate: look back this many days from now.

Resources

usage(infinite)— Completion token usage totals and daily breakdown
costs(infinite)— Spend totals and daily breakdown in USD
04Stats
B
78 / 100
Downloads
0
Archive size
6.0 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive0/1missing
  • Most symbols documented1/1earned
  • No slow types1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository0/2missing
05Platforms
06Labels