GET/api/orgs/{org_id}/usage/by-key

Roll up usage per API key

Provisioning key only: an inference key gets 403, because the rollup reveals every key's spend. Nano-USD fields are decimal strings.

認証: AuthorizationヘッダーにBearer形式のAPIキー

パスパラメータ

  • org_idstring必須

    Your organization id (uuid). GET /api/whoami returns it.

クエリパラメータ

  • windowenum

    Lookback window ending now. 24h buckets hourly, 7d and 30d daily.

    "24h""7d""30d"
    デフォルト: "7d"

レスポンス

  • 200

    Per-key rollup.

    レスポンス
    • report_kindstring必須
    • windowenum必須
      "24h""7d""30d"
    • keysarray<object>必須

      Highest all-in spend first.

      keys
      • api_key_idstring | null必須

        Null only when the key was hard-deleted before the request settled.

      • key_labelstring | null必須

        Null when the key has since been deleted; history is kept.

      • modelsarray<object>必須
        models
        • modelstring必須
        • request_countinteger必須

          Every finished request, errors and pre-dispatch refusals included.

        • error_countinteger必須

          Subset whose terminal state was not completed.

        • input_tokensinteger必須
        • output_tokensinteger必須
        • cost_usdnumber必須

          Charged platform credits, dollars.

        • estimated_cost_usdnumber必須

          Never-charged BYOK estimate at list price, dollars.

        • free_usdnumber必須

          List-price value of promotion-funded usage, dollars (never charged).

        • paid_nano_usdstring必須

          Charged part, nano-USD as a decimal string.

        • byok_nano_usdstring必須

          BYOK list-price estimate, nano-USD as a decimal string.

        • free_nano_usdstring必須

          Free list value, nano-USD as a decimal string.

        • spend_nano_usdstring必須

          All-in: paid + BYOK + free, nano-USD as a decimal string.

      • totalsobject必須
        totals
        • request_countinteger必須

          Every finished request, errors and pre-dispatch refusals included.

        • error_countinteger必須

          Subset whose terminal state was not completed.

        • input_tokensinteger必須
        • output_tokensinteger必須
        • cost_usdnumber必須

          Charged platform credits, dollars.

        • estimated_cost_usdnumber必須

          Never-charged BYOK estimate at list price, dollars.

        • free_usdnumber必須

          List-price value of promotion-funded usage, dollars (never charged).

        • paid_nano_usdstring必須

          Charged part, nano-USD as a decimal string.

        • byok_nano_usdstring必須

          BYOK list-price estimate, nano-USD as a decimal string.

        • free_nano_usdstring必須

          Free list value, nano-USD as a decimal string.

        • spend_nano_usdstring必須

          All-in: paid + BYOK + free, nano-USD as a decimal string.

      • last_used_atstring必須
  • 400

    Unknown window.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 401

    Missing, unknown or revoked API key.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 403

    The key is not a provisioning key (inference keys are refused, reads included), or it is a customer-plan key.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 404

    Unknown organization, or not the key's own organization.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 422

    The window holds too many rows to summarize live; use a shorter window or the usage export.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 429

    The shared analytics read slots are busy. Retry after Retry-After.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 503

    Usage analytics are temporarily unavailable. Retry shortly.

    レスポンス
    • errorstring必須

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

リクエスト

curl https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/usage/by-key?window=24h \
  -H "Authorization: Bearer YOUR_API_KEY"

レスポンス

{
  "report_kind": "live_usage_summary",
  "window": "7d",
  "keys": [
    {
      "api_key_id": "6b1d2f4e-3c8a-4f0e-9a21-7e5c0d9b4a33",
      "key_label": "support-bot",
      "models": [
        {
          "model": "gpt-6-luna",
          "request_count": 912,
          "error_count": 7,
          "input_tokens": 3804410,
          "output_tokens": 290112,
          "cost_usd": 4.812,
          "estimated_cost_usd": 0,
          "free_usd": 0.31,
          "paid_nano_usd": "4812000000",
          "byok_nano_usd": "0",
          "free_nano_usd": "310000000",
          "spend_nano_usd": "5122000000"
        }
      ],
      "totals": {
        "request_count": 912,
        "error_count": 7,
        "input_tokens": 3804410,
        "output_tokens": 290112,
        "cost_usd": 4.812,
        "estimated_cost_usd": 0,
        "free_usd": 0.31,
        "paid_nano_usd": "4812000000",
        "byok_nano_usd": "0",
        "free_nano_usd": "310000000",
        "spend_nano_usd": "5122000000"
      },
      "last_used_at": "2026-11-18T14:32:07.481Z"
    }
  ]
}

https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/usage/by-key?window=24h