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

# Get AI Usage for One Item

> AI spend for one project, flow, agent, user, key or model.



## OpenAPI

````yaml GET /v1/ai-usage/items/{dimension}/{id}
openapi: 3.1.0
info:
  title: Activepieces Documentation
  version: 0.0.0
servers:
  - url: https://cloud.activepieces.com/api
    description: Production Server
security: []
externalDocs:
  url: https://www.activepieces.com/docs
  description: Find more info here
paths:
  /v1/ai-usage/items/{dimension}/{id}:
    get:
      tags:
        - ai-usage
      description: AI spend for one project, flow, agent, user, key or model.
      parameters:
        - schema:
            type: string
            enum:
              - 1h
              - 6h
              - 12h
              - 24h
              - 7d
              - 30d
              - 90d
              - this-month
              - last-month
          in: query
          name: period
          required: true
        - schema:
            type: string
            enum:
              - all
              - production
              - testing
          in: query
          name: scope
          required: true
        - schema:
            type: string
            enum:
              - project
              - flow
              - agent
              - user
              - key
              - model
          in: path
          name: dimension
          required: true
        - schema:
            type: string
            minLength: 1
            maxLength: 512
          in: path
          name: id
          required: true
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  history:
                    type: object
                    properties:
                      trackingSince:
                        anyOf:
                          - type: string
                          - type: 'null'
                      hasAnyUsage:
                        type: boolean
                      coveredDays:
                        type: number
                      periodDays:
                        type: number
                      currentCoverage:
                        type: number
                      comparable:
                        type: boolean
                    required:
                      - trackingSince
                      - hasAnyUsage
                      - coveredDays
                      - periodDays
                      - currentCoverage
                      - comparable
                    additionalProperties: false
                  ranges:
                    type: object
                    properties:
                      current:
                        type: object
                        properties:
                          start:
                            type: string
                          end:
                            type: string
                        required:
                          - start
                          - end
                        additionalProperties: false
                      previous:
                        type: object
                        properties:
                          start:
                            type: string
                          end:
                            type: string
                        required:
                          - start
                          - end
                        additionalProperties: false
                    required:
                      - current
                      - previous
                    additionalProperties: false
                  item:
                    type: object
                    properties:
                      dimension:
                        type: string
                        enum:
                          - project
                          - flow
                          - agent
                          - user
                          - key
                          - model
                      id:
                        type: string
                      name:
                        anyOf:
                          - type: string
                          - type: 'null'
                      parent:
                        type: string
                      provider:
                        type: string
                        enum:
                          - openai
                          - openrouter
                          - anthropic
                          - azure
                          - google
                          - activepieces
                          - cloudflare-gateway
                          - custom
                          - bedrock
                          - vertex
                          - mistral
                          - xai
                          - deepseek
                          - zai
                          - qwen
                          - minimax
                          - moonshot
                          - meta
                          - nvidia
                      flowCount:
                        type: number
                      agentCount:
                        type: number
                      spendUsd:
                        type: number
                      previousSpendUsd:
                        type: number
                      calls:
                        type: number
                      tokens:
                        type: number
                      comparable:
                        type: boolean
                      sharedUsd:
                        type: number
                      inputPrice:
                        type: number
                      outputPrice:
                        type: number
                    required:
                      - dimension
                      - id
                      - name
                      - spendUsd
                      - previousSpendUsd
                      - calls
                      - tokens
                      - comparable
                    additionalProperties: false
                  series:
                    type: array
                    items:
                      type: object
                      properties:
                        label:
                          type: string
                        spendUsd:
                          anyOf:
                            - type: number
                            - type: 'null'
                        calls:
                          anyOf:
                            - type: number
                            - type: 'null'
                        tokens:
                          anyOf:
                            - type: number
                            - type: 'null'
                        previousSpendUsd:
                          anyOf:
                            - type: number
                            - type: 'null'
                        previousCalls:
                          anyOf:
                            - type: number
                            - type: 'null'
                        previousTokens:
                          anyOf:
                            - type: number
                            - type: 'null'
                      required:
                        - label
                        - spendUsd
                        - calls
                        - tokens
                        - previousSpendUsd
                        - previousCalls
                        - previousTokens
                      additionalProperties: false
                  related:
                    type: object
                    propertyNames:
                      type: string
                      enum:
                        - project
                        - flow
                        - agent
                        - user
                        - key
                        - model
                    additionalProperties:
                      type: array
                      items:
                        type: object
                        properties:
                          dimension:
                            type: string
                            enum:
                              - project
                              - flow
                              - agent
                              - user
                              - key
                              - model
                          id:
                            type: string
                          name:
                            anyOf:
                              - type: string
                              - type: 'null'
                          parent:
                            type: string
                          provider:
                            type: string
                            enum:
                              - openai
                              - openrouter
                              - anthropic
                              - azure
                              - google
                              - activepieces
                              - cloudflare-gateway
                              - custom
                              - bedrock
                              - vertex
                              - mistral
                              - xai
                              - deepseek
                              - zai
                              - qwen
                              - minimax
                              - moonshot
                              - meta
                              - nvidia
                          flowCount:
                            type: number
                          agentCount:
                            type: number
                          spendUsd:
                            type: number
                          previousSpendUsd:
                            type: number
                          calls:
                            type: number
                          tokens:
                            type: number
                          comparable:
                            type: boolean
                          sharedUsd:
                            type: number
                          inputPrice:
                            type: number
                          outputPrice:
                            type: number
                        required:
                          - dimension
                          - id
                          - name
                          - spendUsd
                          - previousSpendUsd
                          - calls
                          - tokens
                          - comparable
                        additionalProperties: false
                  bySource:
                    type: array
                    items:
                      type: object
                      properties:
                        source:
                          type: string
                          enum:
                            - flow-steps
                            - agent-steps
                            - agents
                            - chat
                            - knowledge-base
                        spendUsd:
                          type: number
                      required:
                        - source
                        - spendUsd
                      additionalProperties: false
                  runs:
                    type: number
                  reportedUsd:
                    type: number
                  estimatedUsd:
                    type: number
                required:
                  - history
                  - ranges
                  - item
                  - series
                  - related
                additionalProperties: false
      security:
        - apiKey: []
components:
  securitySchemes:
    apiKey:
      type: http
      description: Use your api key generated from the admin console
      scheme: bearer

````

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