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

# Get latency, cost and tokens per version for a product

> The average latency (ms), cost (USD), input tokens and output tokens per version, per test type and pooled over the test types, with the filters of `GET /analytics`, except that `metricIds` and `specificationIds` do not narrow this response. Needs `analytics.read`, `product.read` and `evaluation.readInference` on the product, else 403. A product that does not exist answers 404.



## OpenAPI

````yaml /openapi.json get /analytics/inference
openapi: 3.0.0
info:
  version: 1.0.0
  title: Product Management Service API
  description: API documentation for Product Management Service
  contact:
    name: Galtea AI
servers:
  - url: https://api.galtea.ai
security:
  - bearerAuth: []
tags: []
externalDocs:
  description: Galtea Platform Documentation
  url: https://docs.galtea.ai
paths:
  /analytics/inference:
    get:
      tags:
        - analytics
      summary: Get latency, cost and tokens per version for a product
      description: >-
        The average latency (ms), cost (USD), input tokens and output tokens per
        version, per test type and pooled over the test types, with the filters
        of `GET /analytics`, except that `metricIds` and `specificationIds` do
        not narrow this response. Needs `analytics.read`, `product.read` and
        `evaluation.readInference` on the product, else 403. A product that does
        not exist answers 404.
      operationId: getAnalyticsInference
      parameters:
        - schema:
            type: string
            minLength: 1
            description: The product to read
          required: true
          description: The product to read
          name: productId
          in: query
        - schema:
            type: array
            items:
              type: string
            description: Filter by version IDs
          required: false
          description: Filter by version IDs
          style: form
          explode: true
          name: versionIds
          in: query
        - schema:
            type: array
            items:
              type: string
            description: Filter by test IDs
          required: false
          description: Filter by test IDs
          style: form
          explode: true
          name: testIds
          in: query
        - schema:
            type: array
            items:
              type: string
            description: >-
              Accepted for parity with `GET /analytics`; does not narrow this
              response.
          required: false
          description: >-
            Accepted for parity with `GET /analytics`; does not narrow this
            response.
          style: form
          explode: true
          name: metricIds
          in: query
        - schema:
            type: array
            items:
              type: string
            description: >-
              Accepted for parity with `GET /analytics`; does not narrow this
              response.
          required: false
          description: >-
            Accepted for parity with `GET /analytics`; does not narrow this
            response.
          style: form
          explode: true
          name: specificationIds
          in: query
        - schema:
            type: array
            items:
              type: string
            description: Filter by language codes
          required: false
          description: Filter by language codes
          style: form
          explode: true
          name: languages
          in: query
        - schema:
            type: string
            description: >-
              Start date for filtering (epoch milliseconds). Ranges wider than
              1830 days (5 years) are rejected with 400.
          required: false
          description: >-
            Start date for filtering (epoch milliseconds). Ranges wider than
            1830 days (5 years) are rejected with 400.
          name: from
          in: query
        - schema:
            type: string
            description: End date for filtering (epoch milliseconds)
          required: false
          description: End date for filtering (epoch milliseconds)
          name: to
          in: query
        - schema:
            type: boolean
            description: >-
              When set, returns only production (true) or only development
              (false) data. Omit to include both.
          required: false
          description: >-
            When set, returns only production (true) or only development (false)
            data. Omit to include both.
          name: isProduction
          in: query
      responses:
        '200':
          description: The inference data of the product
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsInference'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    AnalyticsInference:
      type: object
      properties:
        groups:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              inferenceResults:
                type: array
                items:
                  $ref: '#/components/schemas/AnalyticsInferenceResultValues'
            required:
              - type
              - inferenceResults
          description: >-
            The measures per test type, as `groups[].inferenceResults` on `GET
            /analytics`
        averages:
          type: array
          items:
            $ref: '#/components/schemas/AnalyticsInferenceResultValues'
          description: >-
            The measures pooled over the test types, as
            `averages.inferenceResults` on `GET /analytics`: per version, the
            unweighted mean of the test-type values
      required:
        - groups
        - averages
    Error:
      type: object
      properties:
        error:
          type: string
          example: Error type
        message:
          type: string
          example: Error message description
    AnalyticsInferenceResultValues:
      type: object
      properties:
        name:
          type: string
          description: >-
            The measure: `averageCost`, `averageLatency`, `averageInputTokens`
            or `averageOutputTokens`
        unit:
          type: string
          description: 'The unit of `value`: `USD`, `ms` or `tokens`'
        values:
          type: array
          items:
            type: object
            properties:
              versionId:
                type: string
              versionName:
                type: string
              value:
                type: number
            required:
              - versionId
              - versionName
              - value
          description: One value per version that has one
      required:
        - name
        - unit
        - values
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authorization. Pass your API key in the Authorization header as
        a Bearer token. Both new (`gsk_*`) and legacy (`gsk-`) API keys are
        accepted, e.g. `Authorization: Bearer gsk_...` or `Authorization: Bearer
        gsk-...`.

````

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