ArthurAI Usage API

Endpoints for retrieving token usage

OpenAPI Specification

arthurai-usage-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Arthur GenAI Engine Agent Discovery Usage API
  version: 2.1.688
  description: Endpoints for retrieving token usage
tags:
- name: Usage
  description: Endpoints for retrieving token usage
paths:
  /api/v2/usage/tokens:
    get:
      tags:
      - Usage
      summary: Get Token Usage
      description: Get token usage.
      operationId: get_token_usage_api_v2_usage_tokens_get
      security:
      - API Key: []
      parameters:
      - name: start_time
        in: query
        required: false
        schema:
          type: string
          format: date-time
          description: Inclusive start date in ISO8601 string format. Defaults to the beginning of the current day if not provided.
          title: Start Time
        description: Inclusive start date in ISO8601 string format. Defaults to the beginning of the current day if not provided.
      - name: end_time
        in: query
        required: false
        schema:
          type: string
          format: date-time
          description: Exclusive end date in ISO8601 string format. Defaults to the end of the current day if not provided.
          title: End Time
        description: Exclusive end date in ISO8601 string format. Defaults to the end of the current day if not provided.
      - name: group_by
        in: query
        required: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/TokenUsageScope'
          description: Entities to group token counts on.
          default:
          - rule_type
          title: Group By
        description: Entities to group token counts on.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TokenUsageResponse'
                title: Response Get Token Usage Api V2 Usage Tokens Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    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
    TokenUsageScope:
      type: string
      enum:
      - rule_type
      - task
      title: TokenUsageScope
    TokenUsageCount:
      properties:
        inference:
          type: integer
          title: Inference
          description: Number of inference tokens sent to Arthur.
        eval_prompt:
          type: integer
          title: Eval Prompt
          description: Number of Prompt tokens incurred by Arthur rules.
        eval_completion:
          type: integer
          title: Eval Completion
          description: Number of Completion tokens incurred by Arthur rules.
        user_input:
          type: integer
          title: User Input
          description: Number of user input tokens sent to Arthur. This field is deprecated and will be removed in the future. Use inference instead.
          deprecated: true
        prompt:
          type: integer
          title: Prompt
          description: Number of Prompt tokens incurred by Arthur rules. This field is deprecated and will be removed in the future. Use eval_prompt instead.
          deprecated: true
        completion:
          type: integer
          title: Completion
          description: Number of Completion tokens incurred by Arthur rules. This field is deprecated and will be removed in the future. Use eval_completion instead.
          deprecated: true
      type: object
      required:
      - inference
      - eval_prompt
      - eval_completion
      - user_input
      - prompt
      - completion
      title: TokenUsageCount
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TokenUsageResponse:
      properties:
        rule_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Rule Type
        task_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Task Id
        count:
          $ref: '#/components/schemas/TokenUsageCount'
      type: object
      required:
      - count
      title: TokenUsageResponse
  securitySchemes:
    API Key:
      type: http
      description: Bearer token authentication with an API key
      scheme: bearer