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

# Get LLM requests per day and per user

> Returns daily LLM completions and embeddings with their cost and
tokens, totals over the period, and a per-user breakdown.

Requires `ai-insights-v2:analytics` (`read`). Rate limit: 100
requests per minute.




## OpenAPI

````yaml /api-reference/ai-insights-v2/swagger.yml get /v1/analytics/llm-requests
openapi: 3.0.3
info:
  version: 1.0.0
  title: AI Insights API
  description: |
    Public REST API for the Prisme.ai AI Insights workspace - analyzed
    conversations, analysis triggering and status, evaluation criteria,
    message feedback, organization analytics, LLM consumption, memory
    analytics, and the agent relationship graph.

    **Organization scope.** Every endpoint reads and writes the data of the
    caller's organization, taken from the session (or from the org API key).
    No parameter lets a caller target another organization.

    **Permissions.** Each endpoint checks an organization IAM permission
    `ai-insights-v2:<resource>` with the action `read` or `write`
    (`manage` grants both). The resources are `conversations`, `feedback`,
    `analytics`, and `queue`; each operation states the one it requires.
    Platform admins and workspace admins are always allowed.

    **Rate limits.** Limits are counted per caller (user, or org API key)
    and per endpoint, over a sliding window. Depending on the endpoint, an
    exceeded limit returns one of two 429 bodies; both are documented on
    each operation.
  contact:
    name: Prisme.ai
    url: https://prisme.ai
servers:
  - url: https://{host}/v2/workspaces/slug:ai-insights-v2/webhooks
    description: Prisme.ai workspace webhooks
    variables:
      host:
        default: api.studio.prisme.ai
        description: API host (override for self-hosted or sandbox)
security:
  - BearerAuth: []
  - OrgApiKeyAuth: []
tags:
  - name: Insights
    description: Per-conversation analysis results and analysis status.
  - name: Agents
    description: >-
      Analysis triggering, evaluation criteria, conversations, and users of one
      agent.
  - name: Feedback
    description: Like / dislike feedback on agent messages.
  - name: Analytics
    description: Organization-wide usage, quality, latency, and adoption metrics.
  - name: Consumption
    description: LLM requests, tokens, cost, and carbon footprint, per user and over time.
  - name: Queue
    description: State of the conversation analysis queue.
  - name: Memories
    description: Analytics built from the memories users accumulate with agents.
  - name: Graph
    description: >-
      Agent relationship graph - tools, categories, delegations, similarity, and
      clusters.
paths:
  /v1/analytics/llm-requests:
    get:
      tags:
        - Consumption
      summary: Get LLM requests per day and per user
      description: |
        Returns daily LLM completions and embeddings with their cost and
        tokens, totals over the period, and a per-user breakdown.

        Requires `ai-insights-v2:analytics` (`read`). Rate limit: 100
        requests per minute.
      operationId: getLlmRequests
      parameters:
        - $ref: '#/components/parameters/Period'
        - $ref: '#/components/parameters/FromDate'
        - $ref: '#/components/parameters/ToDate'
        - in: query
          name: by_user
          schema:
            type: boolean
            default: true
          description: >-
            Set to `false` to skip the per-user breakdown (`by_user` is then
            empty).
      responses:
        '200':
          description: LLM requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  daily:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                          format: date
                        completions:
                          type: integer
                        embeddings:
                          type: integer
                        cost_completions:
                          type: number
                        cost_embeddings:
                          type: number
                        tokens_completions:
                          type: integer
                          description: Input and output tokens.
                        tokens_embeddings:
                          type: integer
                  totals:
                    type: object
                    properties:
                      completions:
                        type: integer
                      embeddings:
                        type: integer
                      cost_completions:
                        type: number
                      cost_embeddings:
                        type: number
                  by_user:
                    type: array
                    items:
                      allOf:
                        - $ref: '#/components/schemas/Contact'
                        - type: object
                          properties:
                            completions:
                              type: integer
                            embeddings:
                              type: integer
                            tokens:
                              type: integer
                              description: Input (including embedding) and output tokens.
                            cost:
                              type: number
                            carbon:
                              type: number
                              description: kgCO2e.
                            messages:
                              type: integer
                  meta:
                    allOf:
                      - $ref: '#/components/schemas/PeriodMeta'
                      - type: object
                        properties:
                          truncated:
                            type: boolean
                            description: '`true` when some users were left out of `by_user`.'
                          by_user:
                            type: boolean
        '400':
          $ref: '#/components/responses/InvalidArguments'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/AnalyticsSourceUnavailable'
components:
  parameters:
    Period:
      in: query
      name: period
      schema:
        type: string
        enum:
          - 7d
          - 30d
          - 90d
        default: 30d
      description: >-
        Sliding window ending now. Any other value uses `30d`. Ignored when both
        `from_date` and `to_date` are set.
    FromDate:
      in: query
      name: from_date
      schema:
        type: string
        format: date-time
        maxLength: 64
      description: >-
        Start of a custom range, ISO 8601. Used only together with `to_date`,
        and then takes precedence over `period` (`period` is returned as
        `custom`).
    ToDate:
      in: query
      name: to_date
      schema:
        type: string
        format: date-time
        maxLength: 64
      description: End of a custom range, ISO 8601. Used only together with `from_date`.
  schemas:
    Contact:
      type: object
      properties:
        user_id:
          type: string
        name:
          type: string
          description: First and last name. Absent when the user cannot be resolved.
        email:
          type: string
          description: Absent when the user cannot be resolved.
    PeriodMeta:
      type: object
      properties:
        period:
          type: string
          description: >-
            The `period` sent (or `30d`), or `custom` for a `from_date` /
            `to_date` range.
        period_start:
          type: string
          format: date-time
        period_end:
          type: string
          format: date-time
        generated_at:
          type: string
          format: date-time
        cache_ttl:
          type: integer
          description: Suggested client cache duration, in seconds.
    RuntimeError:
      type: object
      description: Error raised by the Prisme.ai runtime before the endpoint logic runs.
      required:
        - error
        - message
      properties:
        error:
          type: string
        message:
          type: string
        details:
          type: object
          additionalProperties: true
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: >-
            Error code (e.g. `FORBIDDEN`), or error message on some validation
            errors.
        message:
          type: string
          description: Human-readable message.
  responses:
    InvalidArguments:
      description: >-
        A parameter does not match its schema (length, pattern, type, or
        required field).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RuntimeError'
          example:
            error: InvalidArgumentsError
            message: Invalid arguments
            details:
              errors: []
    Unauthenticated:
      description: Missing or invalid credentials, or no organization context.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: UNAUTHORIZED
            message: Authentication required
    Forbidden:
      description: The caller lacks the permission required by the endpoint.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: FORBIDDEN
            message: 'Access denied: missing permission ''ai-insights-v2:analytics:read'''
    RateLimited:
      description: Rate limit exceeded. Retry later.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: RATE_LIMITED
            message: Rate limit exceeded
    AnalyticsSourceUnavailable:
      description: An analytics data source is temporarily unavailable. Retry in a minute.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: AnalyticsSourceUnavailable
            message: Analytics are temporarily unavailable, try again in a minute
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        User-bound credential carrying an identity: either a session JWT
        or a user access token (`at:*`) generated from the user settings UI.
        Send as `Authorization: Bearer <token>`. The organization and the
        permissions applied are those of this user.
    OrgApiKeyAuth:
      type: apiKey
      in: header
      name: x-prismeai-api-key
      description: |
        Organization API key (`iak_{orgSlug}_{uuid}`), managed from the
        AI Governance UI. It is not tied to a user: its access is defined by
        the permissions attached to it, and all keys of an organization share
        the same rate-limit counters. Endpoints that describe "your own"
        data, such as `GET /v1/users/{user_id}`, need a user credential.
        Send as `x-prismeai-api-key: iak_...`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.