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

# Get account activity

> Return request counts, token usage, costs, top models, and per-key usage for a configurable lookback window.



## OpenAPI

````yaml /openapi/naga-api.json get /v1/account/activity
openapi: 3.1.0
info:
  title: NagaAI API
  summary: Unified AI API with OpenAI and Anthropic compatibility layers.
  version: '2026-03-31'
  contact:
    name: NagaAI
    url: https://naga.ac
  termsOfService: https://naga.ac/legal/terms
servers:
  - url: https://api.naga.ac
    description: Production
  - url: http://localhost:8500
    description: Local development
security: []
tags:
  - name: Chat Completions
    description: >-
      OpenAI-compatible chat completion requests, including streaming, tools,
      and multimodal input.
  - name: Messages
    description: >-
      Anthropic-compatible Messages API requests used by Claude-style clients
      and agents.
  - name: Responses
    description: >-
      OpenAI-compatible Responses API requests for structured input, tools, and
      streaming output items.
  - name: Embeddings
    description: >-
      Create vector embeddings for search, retrieval, clustering, and ranking
      use cases.
  - name: Images
    description: >-
      Generate or edit images with multimodal models and OpenAI-compatible
      payloads.
  - name: Audio
    description: >-
      Generate speech or convert uploaded audio into transcriptions and
      translations.
  - name: Moderations
    description: Classify text and image inputs for safety policy categories.
  - name: Models
    description: List available models, capabilities, and pricing metadata.
  - name: Startups
    description: >-
      Public metadata about AI startups and model providers surfaced by the
      gateway.
  - name: Account
    description: Provisioning-key protected account balance and usage endpoints.
  - name: API Keys
    description: Provisioning-key protected API key management endpoints.
paths:
  /v1/account/activity:
    get:
      tags:
        - Account
      summary: Get account activity
      description: >-
        Return request counts, token usage, costs, top models, and per-key usage
        for a configurable lookback window.
      operationId: getAccountActivity
      parameters:
        - name: days
          in: query
          required: false
          schema:
            type: integer
            maximum: 30
            minimum: 1
            description: Number of days to look back (1-30)
            default: 30
            title: Days
          description: Number of days to look back (1-30)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '410':
          description: Model deprecated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationErrorResponse'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '503':
          description: Upstream service error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - provisioningBearerAuth: []
components:
  schemas:
    ActivityResponse:
      properties:
        period_days:
          type: integer
          title: Period Days
          description: Lookback window used to aggregate the activity response.
          examples:
            - 30
        total_stats:
          $ref: '#/components/schemas/TotalStats'
        daily_stats:
          items:
            $ref: '#/components/schemas/DailyStats'
          type: array
          title: Daily Stats
        top_models:
          items:
            $ref: '#/components/schemas/ModelUsage'
          type: array
          title: Top Models
        api_key_usage:
          items:
            $ref: '#/components/schemas/ApiKeyUsage'
          type: array
          title: Api Key Usage
      type: object
      required:
        - period_days
        - total_stats
        - daily_stats
        - top_models
        - api_key_usage
      title: ActivityResponse
      description: Complete activity response
      examples:
        - api_key_usage:
            - api_key_id: 12
              api_key_name: Production
              request_count: 320
              total_cost: '9.11'
              total_input_tokens: 620441
              total_output_tokens: 201210
          daily_stats:
            - date: '2026-03-30'
              total_cost: '0.44'
              total_input_tokens: 41122
              total_output_tokens: 13201
              total_requests: 21
          period_days: 30
          top_models:
            - model_name: gpt-4o-mini
              request_count: 211
              total_cost: '4.81'
              total_input_tokens: 315201
              total_output_tokens: 99004
          total_stats:
            total_cost: '13.24'
            total_input_tokens: 914221
            total_output_tokens: 307554
            total_requests: 482
    ErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      additionalProperties: true
      type: object
      required:
        - error
      title: ErrorEnvelope
      examples:
        - error:
            message: The request body is invalid.
            type: invalid_request_error
    HTTPValidationErrorResponse:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
          type: array
          title: Detail
      additionalProperties: true
      type: object
      required:
        - detail
      title: HTTPValidationErrorResponse
    TotalStats:
      properties:
        total_requests:
          type: integer
          title: Total Requests
        total_cost:
          type: string
          title: Total Cost
        total_input_tokens:
          type: integer
          title: Total Input Tokens
        total_output_tokens:
          type: integer
          title: Total Output Tokens
      type: object
      required:
        - total_requests
        - total_cost
        - total_input_tokens
        - total_output_tokens
      title: TotalStats
      description: Total aggregated statistics model
    DailyStats:
      properties:
        date:
          type: string
          title: Date
        total_requests:
          type: integer
          title: Total Requests
        total_cost:
          type: string
          title: Total Cost
        total_input_tokens:
          type: integer
          title: Total Input Tokens
        total_output_tokens:
          type: integer
          title: Total Output Tokens
      type: object
      required:
        - date
        - total_requests
        - total_cost
        - total_input_tokens
        - total_output_tokens
      title: DailyStats
      description: Daily statistics model
    ModelUsage:
      properties:
        model_name:
          type: string
          title: Model Name
        request_count:
          type: integer
          title: Request Count
        total_cost:
          type: string
          title: Total Cost
        total_input_tokens:
          type: integer
          title: Total Input Tokens
        total_output_tokens:
          type: integer
          title: Total Output Tokens
      type: object
      required:
        - model_name
        - request_count
        - total_cost
        - total_input_tokens
        - total_output_tokens
      title: ModelUsage
      description: Model usage statistics
    ApiKeyUsage:
      properties:
        api_key_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Api Key Id
        api_key_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Api Key Name
        request_count:
          type: integer
          title: Request Count
        total_cost:
          type: string
          title: Total Cost
        total_input_tokens:
          type: integer
          title: Total Input Tokens
        total_output_tokens:
          type: integer
          title: Total Output Tokens
      type: object
      required:
        - api_key_id
        - api_key_name
        - request_count
        - total_cost
        - total_input_tokens
        - total_output_tokens
      title: ApiKeyUsage
      description: API key usage statistics
    ErrorBody:
      properties:
        type:
          type: string
          title: Type
          description: Stable machine-readable error type.
        message:
          type: string
          title: Message
          description: Human-readable error message.
        code:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Code
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
      additionalProperties: true
      type: object
      required:
        - type
        - message
      title: ErrorBody
    ValidationErrorItem:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Loc
        msg:
          type: string
          title: Msg
        type:
          type: string
          title: Type
      additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationErrorItem
  securitySchemes:
    provisioningBearerAuth:
      type: http
      description: >-
        Provisioning key required for account management endpoints under
        `/v1/account`.
      scheme: bearer

````