AlmondTill/G3N API

aiUsage

query · in the family Billing and the wallet

What it does

Your group’s AI usage by day — calls, tokens, and what your plan meters for it, with a per-surface breakdown.

Your group's AI usage by UTC day: composed off the daily rollup rows the meter grows with every metered call (calls · tokens · what your plan meters — billedKernels, and billedUsd at the standard rate — + the per-surface split), ≤ 92 bounded point-reads — never a scan. Self-group BY construction (no target arg exists — the tokenEntries stance); days defaults 30, clamps 1..92; only days with usage answer (an empty window is the honest answer). billedUsd values are decimal strings (the money-string law). Requires authentication.

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Billing and the wallet — Your platform bill, token purchases and the usage and cost reads.

Roles that may call it:

What happens

A read over the running usage counters the platform keeps for every AI call; your cost shows as what your plan meters for it — kernels, and the USD at the standard rate (volume tiers price lower). A day counted before that figure was kept shows no cost yet. Only days with usage appear.

Arguments

NameTypeRequiredNotes
daysIntno

Returns

AiUsageWindow AiUsageWindow! — Your group's AI-usage window: the days with usage, newest first, + the window totals.

Example request

graphql
query ExampleAiUsage($days: Int) {
  aiUsage(days: $days) {
    totalCalls
    totalTokensInput
    totalTokensOutput
    totalBilledKernels
    totalBilledUsd
  }
}

Variables:

json
{
  "days": 1
}

Example response

json
{
  "data": {
    "aiUsage": {
      "totalCalls": 1,
      "totalTokensInput": 1,
      "totalTokensOutput": 1,
      "totalBilledKernels": 1.5,
      "totalBilledUsd": "<total billed usd>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in