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

# Get LiteLLM tag-activity analytics

> Queries LiteLLM's `/tag/daily/activity` endpoint, projects the response into a stable shape, and returns daily spend/token breakdowns with per-tag and per-model aggregates. The `tag_prefix` parameter is an IMP convenience: it resolves all tags matching the prefix via `/tag/list` before forwarding to LiteLLM, ensuring the full window is covered regardless of page size. Restricted to `super_admin`.



## OpenAPI

````yaml /openapi/openapi.json get /admin/litellm/tag-activity
openapi: 3.1.0
info:
  title: IMP REST API
  version: 1.0.0
  description: >-
    REST endpoints of the IMP backend. GraphQL covers entity CRUD; REST covers
    agent runs, media, files, and system utilities. All requests require
    authentication unless the agent is public.
servers:
  - url: '{baseUrl}'
    variables:
      baseUrl:
        default: http://localhost:9001
        description: >-
          Base URL of your IMP backend. Self-hosted deployments typically run on
          port 9001.
security:
  - apiKey: []
  - bearer: []
tags:
  - name: Agents
    description: Endpoints for running, compacting, and querying agent instances.
  - name: Sessions
    description: Endpoints for managing files attached to agent sessions.
  - name: Media
    description: Transcription, speech synthesis, and image generation.
  - name: System
    description: Platform health and configuration utilities.
  - name: Budgets
    description: >-
      LiteLLM tag-budget management for users, roles, teams, projects, agents,
      and routines. Access requires `super_admin` or a role with
      `budget_management` write scope.
  - name: Skills
    description: >-
      Skills are versioned bundles of files (markdown, scripts, assets) mounted
      into the agent sandbox. These endpoints manage the skill registry and
      individual skill files.
  - name: Uploads
    description: >-
      Uppy-compatible S3 companion routes for single-part and multipart file
      uploads. Accept the standard API key. The `internal-key` header (set to
      `INTERNAL_SECRET`) is accepted only on `/s3/delete`, `/s3/download`,
      `/s3/list`, and `/s3/object` — it does **not** work on `/s3/sign` or the
      `/s3/multipart` routes.
  - name: Compliance
    description: >-
      GDPR / DSGVO operator endpoints for data-subject access (export) and
      erasure. Both require `super_admin`.
  - name: Artifacts
    description: >-
      Shareable artifact links — create, list, and revoke share links for files
      stored in S3.
paths:
  /admin/litellm/tag-activity:
    get:
      tags:
        - Budgets
      summary: Get LiteLLM tag-activity analytics
      description: >-
        Queries LiteLLM's `/tag/daily/activity` endpoint, projects the response
        into a stable shape, and returns daily spend/token breakdowns with
        per-tag and per-model aggregates. The `tag_prefix` parameter is an IMP
        convenience: it resolves all tags matching the prefix via `/tag/list`
        before forwarding to LiteLLM, ensuring the full window is covered
        regardless of page size. Restricted to `super_admin`.
      operationId: getTagActivity
      parameters:
        - name: start_date
          in: query
          required: true
          description: Start date (`YYYY-MM-DD` or ISO datetime).
          schema:
            type: string
        - name: end_date
          in: query
          required: true
          description: End date (`YYYY-MM-DD` or ISO datetime).
          schema:
            type: string
        - name: tag_prefix
          in: query
          required: false
          description: >-
            Resolves all LiteLLM tags matching this prefix (e.g. `user_id_`,
            `agent_id_`) and passes them to the query.
          schema:
            type: string
        - name: tags
          in: query
          required: false
          description: >-
            Comma-separated explicit tag list. When combined with `tag_prefix`,
            returns the intersection.
          schema:
            type: string
        - name: model
          in: query
          required: false
          description: Filter to a specific LiteLLM model name.
          schema:
            type: string
        - name: page
          in: query
          required: false
          description: Page number (default `1`).
          schema:
            type: integer
            minimum: 1
        - name: exclude_team_tags
          in: query
          required: false
          description: Set `true` to exclude `team_*` tags from the breakdown.
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
      responses:
        '200':
          description: Projected analytics payload.
          content:
            application/json:
              schema:
                type: object
                properties:
                  window:
                    type: object
                    properties:
                      start_date:
                        type: string
                      end_date:
                        type: string
                  totals:
                    type: object
                    additionalProperties: true
                  daily:
                    type: array
                    items:
                      type: object
                      additionalProperties: true
                  byTag:
                    type: array
                    items:
                      type: object
                      additionalProperties: true
                  byTagByDay:
                    type: array
                    items:
                      type: object
                      additionalProperties: true
                  byModel:
                    type: array
                    items:
                      type: object
                      additionalProperties: true
                  pagination:
                    type: object
                    additionalProperties: true
                  tagPrefix:
                    type:
                      - string
                      - 'null'
                  dedupePrefix:
                    type: string
                  truncated:
                    type: boolean
        '400':
          description: Missing or invalid `start_date`/`end_date` or invalid `page`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Not authenticated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Super admin access required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: LiteLLM upstream error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message.
        message:
          type: string
          description: Human-readable error message (alternate key used on some endpoints).
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Organisation API key. Format: `sk_<secret>/<keyname>` — the secret
        portion, a literal slash, and the human-readable key name. The header
        `exulu-api-key` is accepted as an alias. A `Bearer ` prefix is tolerated
        and stripped. Keys with an agent scope are only valid for the scoped
        agent instance.
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        NextAuth session JWT (HS256, signed with `NEXTAUTH_SECRET`). This is the
        token the IMP frontend uses automatically.

````