> ## 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 my usage details

> Returns the calling user's LiteLLM spend and token usage for the requested date window — totals, per-day breakdown, and per-model breakdown. The window defaults to the last 30 days ending today (UTC) and is capped at 92 days. **Gated by the admin `show_user_budget_in_chat` setting**: when the setting is off, `usage` is `null` and no spend data is surfaced. Requires authentication; returns 401 for unauthenticated callers. Returns 502 when LiteLLM is unreachable.



## OpenAPI

````yaml /openapi/openapi.json get /me/usage
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.
  - name: Credentials
    description: >-
      Tool-credential management — submit, list, and revoke per-user credentials
      for oauth and user_credentials-enabled tools. Values are stored encrypted
      and never returned through these endpoints.
  - name: Public Agents
    description: >-
      Unauthenticated endpoints for guest-published agent discovery. Only
      whitelisted metadata fields are ever returned; no instructions, tools, or
      model details are exposed.
paths:
  /me/usage:
    get:
      tags:
        - Budgets
      summary: Get my usage details
      description: >-
        Returns the calling user's LiteLLM spend and token usage for the
        requested date window — totals, per-day breakdown, and per-model
        breakdown. The window defaults to the last 30 days ending today (UTC)
        and is capped at 92 days. **Gated by the admin
        `show_user_budget_in_chat` setting**: when the setting is off, `usage`
        is `null` and no spend data is surfaced. Requires authentication;
        returns 401 for unauthenticated callers. Returns 502 when LiteLLM is
        unreachable.
      operationId: getMyUsage
      parameters:
        - name: start_date
          in: query
          required: false
          description: >-
            Start of the window. Accepts `YYYY-MM-DD` or an ISO datetime string.
            Defaults to 30 days before `end_date`.
          schema:
            type: string
        - name: end_date
          in: query
          required: false
          description: >-
            End of the window. Accepts `YYYY-MM-DD` or an ISO datetime string.
            Defaults to today (UTC).
          schema:
            type: string
      responses:
        '200':
          description: >-
            Usage view for the requested window, or `null` when spend data is
            hidden by the admin.
          content:
            application/json:
              schema:
                type: object
                required:
                  - usage
                properties:
                  usage:
                    nullable: true
                    description: >-
                      `null` when `show_user_budget_in_chat` is disabled or the
                      user has no LiteLLM budget tag.
                    type: object
                    properties:
                      window:
                        type: object
                        properties:
                          start_date:
                            type: string
                            format: date
                          end_date:
                            type: string
                            format: date
                        required:
                          - start_date
                          - end_date
                      display:
                        type: string
                        enum:
                          - percent
                          - amount
                        description: >-
                          UI display preference set by the admin — callers
                          decide what to render.
                      totals:
                        type: object
                        properties:
                          spend:
                            type: number
                          prompt_tokens:
                            type: integer
                          completion_tokens:
                            type: integer
                          total_tokens:
                            type: integer
                          successful_requests:
                            type: integer
                          failed_requests:
                            type: integer
                          api_requests:
                            type: integer
                      daily:
                        type: array
                        description: Per-day metrics, sorted ascending by date.
                        items:
                          type: object
                          properties:
                            date:
                              type: string
                              format: date
                            spend:
                              type: number
                            prompt_tokens:
                              type: integer
                            completion_tokens:
                              type: integer
                            total_tokens:
                              type: integer
                            successful_requests:
                              type: integer
                            failed_requests:
                              type: integer
                            api_requests:
                              type: integer
                      byModel:
                        type: array
                        description: Per-model aggregates, sorted by spend descending.
                        items:
                          type: object
                          properties:
                            model:
                              type: string
                            spend:
                              type: number
                            prompt_tokens:
                              type: integer
                            completion_tokens:
                              type: integer
                            total_tokens:
                              type: integer
                            successful_requests:
                              type: integer
                            failed_requests:
                              type: integer
              examples:
                visible:
                  summary: Usage visible
                  value:
                    usage:
                      window:
                        start_date: '2026-06-24'
                        end_date: '2026-07-23'
                      display: amount
                      totals:
                        spend: 0.42
                        prompt_tokens: 18000
                        completion_tokens: 3200
                        total_tokens: 21200
                        successful_requests: 14
                        failed_requests: 0
                        api_requests: 14
                      daily:
                        - date: '2026-07-22'
                          spend: 0.42
                          prompt_tokens: 18000
                          completion_tokens: 3200
                          total_tokens: 21200
                          successful_requests: 14
                          failed_requests: 0
                          api_requests: 14
                      byModel:
                        - model: gpt-4o
                          spend: 0.42
                          prompt_tokens: 18000
                          completion_tokens: 3200
                          total_tokens: 21200
                          successful_requests: 14
                          failed_requests: 0
                hidden:
                  summary: Usage hidden by admin
                  value:
                    usage: null
        '400':
          description: >-
            Invalid `start_date` or `end_date` format, or `start_date` is after
            `end_date`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Not authenticated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Unexpected server error.
          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.

````