> ## 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 the estimated cost per session of a product per day, week or month

> The average, the 10th and 90th percentiles, the lowest and the highest estimated cost of the sessions with a cost, per UTC bucket of the period, over the sessions `GET /analytics/cost-overview` counts. Every bucket of the period is returned, and none when the product belongs to another organization than the caller's. Needs `analytics.read`, `product.read` and `evaluation.readInference` on the product, else 403. A product that does not exist answers 404.



## OpenAPI

````yaml https://api.galtea.ai/openapi.json get /analytics/session-cost-over-time
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/session-cost-over-time:
    get:
      tags:
        - analytics
      summary: Get the estimated cost per session of a product per day, week or month
      description: >-
        The average, the 10th and 90th percentiles, the lowest and the highest
        estimated cost of the sessions with a cost, per UTC bucket of the
        period, over the sessions `GET /analytics/cost-overview` counts. Every
        bucket of the period is returned, and none when the product belongs to
        another organization than the caller's. Needs `analytics.read`,
        `product.read` and `evaluation.readInference` on the product, else 403.
        A product that does not exist answers 404.
      operationId: getSessionCostOverTime
      parameters:
        - schema:
            type: string
            description: The product to read
          required: true
          description: The product to read
          name: productId
          in: query
        - schema:
            type: string
            format: date-time
            description: Start of the period, inclusive (ISO 8601)
          required: true
          description: Start of the period, inclusive (ISO 8601)
          name: from
          in: query
        - schema:
            type: string
            format: date-time
            description: >-
              End of the period, exclusive (ISO 8601). A period that does not
              end after `from`, or is longer than 1830 days (5 years), is
              rejected with 400.
          required: true
          description: >-
            End of the period, exclusive (ISO 8601). A period that does not end
            after `from`, or is longer than 1830 days (5 years), is rejected
            with 400.
          name: to
          in: query
        - schema:
            type: boolean
            description: >-
              Count production sessions when true, development sessions when
              false.
          required: true
          description: >-
            Count production sessions when true, development sessions when
            false.
          name: isProduction
          in: query
        - schema:
            type: string
            description: >-
              The organization whose products to read. Defaults to the caller's
              own organization. Another organization reads products only for a
              caller that may read across organizations.
          required: false
          description: >-
            The organization whose products to read. Defaults to the caller's
            own organization. Another organization reads products only for a
            caller that may read across organizations.
          name: organizationId
          in: query
        - schema:
            type: string
            enum:
              - day
              - week
              - month
            description: >-
              The bucket size: a UTC calendar day, an ISO week (from Monday) or
              a calendar month
            example: week
          required: true
          description: >-
            The bucket size: a UTC calendar day, an ISO week (from Monday) or a
            calendar month
          name: interval
          in: query
      responses:
        '200':
          description: The session cost of the product per bucket
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionCostOverTime'
        '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: Product not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    SessionCostOverTime:
      type: object
      properties:
        interval:
          type: string
          enum:
            - day
            - week
            - month
          description: >-
            The bucket size: a UTC calendar day, an ISO week (from Monday) or a
            calendar month
          example: week
        buckets:
          type: array
          items:
            type: object
            properties:
              start:
                type: string
                format: date-time
                description: >-
                  Start of the bucket, inclusive. The first bucket starts at
                  `from`.
              end:
                type: string
                format: date-time
                description: End of the bucket, exclusive. The last bucket ends at `to`.
              sessionCount:
                type: integer
                description: The sessions of the bucket that have a cost
              avgCost:
                type: number
                nullable: true
                description: >-
                  The average session cost, in USD. Null when no session of the
                  bucket has a cost.
              p10Cost:
                type: number
                nullable: true
                description: >-
                  The 10th percentile of the session costs, interpolated, in
                  USD. Null when no session of the bucket has a cost.
              p90Cost:
                type: number
                nullable: true
                description: >-
                  The 90th percentile of the session costs, interpolated, in
                  USD. Null when no session of the bucket has a cost.
              minCost:
                type: number
                nullable: true
                description: >-
                  The lowest session cost, in USD. Null when no session of the
                  bucket has a cost.
              maxCost:
                type: number
                nullable: true
                description: >-
                  The highest session cost, in USD. Null when no session of the
                  bucket has a cost.
            required:
              - start
              - end
              - sessionCount
              - avgCost
              - p10Cost
              - p90Cost
              - minCost
              - maxCost
          description: >-
            Every bucket of the period in order. Empty when the product belongs
            to another organization. A session cost is the estimated cost summed
            over its turns; a session with no cost on any turn is left out.
      required:
        - interval
        - buckets
    Error:
      type: object
      properties:
        error:
          type: string
          example: Error type
        message:
          type: string
          example: Error message description
  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.