> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vyomflow.co.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Get the caller's real per-tool credit usage aggregation

> A `GROUP BY toolInvocation.name` aggregation over `CreditLedger` CAPTURE/USAGE rows — backs the /usage dashboard's stat cards and Overview tab. Optional `?period=` (7d/30d/90d/all, default all) scopes it to a rolling window off the current time.



## OpenAPI

````yaml /openapi.json get /api/v1/me/credits/usage-summary
openapi: 3.1.0
info:
  title: VyomFlow API
  version: 1.0.0
  description: >-
    The versioned public REST surface (`/api/public/v1/*`, bearer API-key auth)
    plus the app's own internal `/api/v1/*` surface (Clerk session-token auth),
    generated directly from the same Zod contracts the Route Handlers validate
    against — never a hand-maintained duplicate. The MCP endpoint (`/api/mcp`)
    is a separate streamable-HTTP JSON-RPC transport, not expressible here — see
    the MCP guide.
servers:
  - url: https://api.vyomflow.co.in
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/me/credits/usage-summary:
    get:
      tags:
        - Credits
      summary: Get the caller's real per-tool credit usage aggregation
      description: >-
        A `GROUP BY toolInvocation.name` aggregation over `CreditLedger`
        CAPTURE/USAGE rows — backs the /usage dashboard's stat cards and
        Overview tab. Optional `?period=` (7d/30d/90d/all, default all) scopes
        it to a rolling window off the current time.
      parameters:
        - schema:
            type: string
            enum:
              - 7d
              - 30d
              - 90d
              - all
            default: all
          required: false
          name: period
          in: query
      responses:
        '200':
          description: Per-tool usage groups plus overall totals.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditUsageSummary'
        '401':
          description: Missing or invalid credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - ClerkBearer: []
components:
  schemas:
    CreditUsageSummary:
      type: object
      properties:
        groups:
          type: array
          items:
            type: object
            properties:
              toolKey:
                type: string
              displayName:
                type: string
              totalDebited:
                type: string
              records:
                type: integer
                minimum: 0
              latestUsageAt:
                type:
                  - string
                  - 'null'
            required:
              - toolKey
              - displayName
              - totalDebited
              - records
              - latestUsageAt
        totalDebitedAll:
          type: string
        recordsAll:
          type: integer
          minimum: 0
        categoriesCount:
          type: integer
          minimum: 0
        periodStart:
          type:
            - string
            - 'null'
        periodEnd:
          type:
            - string
            - 'null'
      required:
        - groups
        - totalDebitedAll
        - recordsAll
        - categoriesCount
        - periodStart
        - periodEnd
    ApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    ClerkBearer:
      type: http
      scheme: bearer
      description: >-
        Clerk session token, `Authorization: Bearer <token>` — the first-party
        browser app's own auth. Used only by this internal `/api/v1/*` surface,
        never by `/api/public/v1/*`.

````