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

# Get a crew's usage

> Runs, tokens and estimated model cost of a crew over a period, how
much of the cost went on runs that did not succeed, and the median and
90th-percentile run duration. Cost covers model calls only (not Spark
or Trino) and is null when no model in the period has a price set.



## OpenAPI

````yaml get /api/crew-templates/{template_id}/usage
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/crew-templates/{template_id}/usage:
    get:
      tags:
        - Crew templates
      summary: Get a crew's usage
      description: |-
        Runs, tokens and estimated model cost of a crew over a period, how
        much of the cost went on runs that did not succeed, and the median and
        90th-percentile run duration. Cost covers model calls only (not Spark
        or Trino) and is null when no model in the period has a price set.
      operationId: get_usage_api_crew_templates__template_id__usage_get
      parameters:
        - name: template_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: ID of the crew template.
            title: Template Id
          description: ID of the crew template.
        - name: days
          in: query
          required: false
          schema:
            type: integer
            maximum: 365
            minimum: 1
            description: How many days back to count.
            default: 30
            title: Days
          description: How many days back to count.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrewUsageResponse'
        '404':
          description: Template not found.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    CrewUsageResponse:
      properties:
        days:
          type: integer
          title: Days
        runs:
          type: integer
          title: Runs
          default: 0
        tokens:
          type: integer
          title: Tokens
          default: 0
        tokens_in:
          type: integer
          title: Tokens In
          default: 0
        tokens_out:
          type: integer
          title: Tokens Out
          default: 0
        est_cost:
          anyOf:
            - type: number
            - type: 'null'
          title: Est Cost
          description: Null when no run in the period had a price.
        cost_per_run:
          anyOf:
            - type: number
            - type: 'null'
          title: Cost Per Run
        cost_failed:
          anyOf:
            - type: number
            - type: 'null'
          title: Cost Failed
          description: The part of the cost spent on unsuccessful runs.
        duration_p50_s:
          anyOf:
            - type: number
            - type: 'null'
          title: Duration P50 S
        duration_p90_s:
          anyOf:
            - type: number
            - type: 'null'
          title: Duration P90 S
      type: object
      required:
        - days
      title: CrewUsageResponse
      description: What a crew's runs cost over a period (model calls only).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````

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