---
title: "LLMQuery"
url: "https://nov18-dev.movespot.fyi/apis/konnect-analytics-dashboards-2/versions/62158128-8b73-4a90-ae97-da37b5a2ea32/schemas/LLMQuery"
---

> Full API specification: https://nov18-dev.movespot.fyi/apis/konnect-analytics-dashboards-2/versions/62158128-8b73-4a90-ae97-da37b5a2ea32.md

# LLMQuery

A query targeting the LLM usage analytics datasource.

## OpenAPI definition

```yaml
openapi: 3.0.2
info:
  title: Konnect Analytics Dashboards
  version: 2.0.0
servers:
  - url: https://us.api.konghq.com/v2
    description: United-States Production region
  - url: https://eu.api.konghq.com/v2
    description: Europe Production region
  - url: https://au.api.konghq.com/v2
    description: Australia Production region
  - url: https://me.api.konghq.com/v2
    description: Middle-East Production region
  - url: https://in.api.konghq.com/v2
    description: India Production region
  - url: https://sg.api.konghq.com/v2
    description: Singapore Production region
components:
  schemas:
    LLMMetrics:
      description: List of aggregated metrics to collect across the requested time span.
      type: array
      items:
        type: string
        enum:
          - total_tokens
          - prompt_tokens
          - completion_tokens
          - ai_request_count
          - cost
          - llm_cache_embeddings_latency_average
          - llm_cache_fetch_latency_average
          - llm_latency_average
          - llm_embeddings_tokens
          - llm_embeddings_cost
      default:
        - ai_request_count
    LLMFilters:
      description: A list of filters to apply to the query.
      type: array
      items:
        discriminator:
          propertyName: field
          mapping:
            ai_plugin: "#/components/schemas/MetricsAiPluginFilterByField"
            ai_provider: "#/components/schemas/MetricsAiProviderFilterByField"
            ai_request_model: "#/components/schemas/MetricsAiRequestModelFilterByField"
            ai_response_model: "#/components/schemas/MetricsAiResponseModelFilterByField"
            application: "#/components/schemas/MetricsApplicationFilterByField"
            consumer: "#/components/schemas/MetricsConsumerFilterByField"
            control_plane: "#/components/schemas/MetricsControlPlaneFilterByField"
            control_plane_group: "#/components/schemas/MetricsControlPlaneGroupFilterByField"
            gateway_service: "#/components/schemas/MetricsGatewayServiceFilterByField"
            llm_cache_status: "#/components/schemas/MetricsLlmCacheStatusFilterByField"
            llm_embeddings_model: "#/components/schemas/MetricsLlmEmbeddingsModelFilterByField"
            llm_embeddings_provider: "#/components/schemas/MetricsLlmEmbeddingsProviderFilterByField"
            realm: "#/components/schemas/MetricsRealmFilterByField"
            route: "#/components/schemas/MetricsRouteFilterByField"
            status_code: "#/components/schemas/MetricsStatusCodeFilterByField"
            status_code_grouped: "#/components/schemas/MetricsStatusCodeGroupedFilterByField"
        oneOf:
          - $ref: "#/components/schemas/MetricsAiPluginFilterByField"
          - $ref: "#/components/schemas/MetricsAiProviderFilterByField"
          - $ref: "#/components/schemas/MetricsAiRequestModelFilterByField"
          - $ref: "#/components/schemas/MetricsAiResponseModelFilterByField"
          - $ref: "#/components/schemas/MetricsApplicationFilterByField"
          - $ref: "#/components/schemas/MetricsConsumerFilterByField"
          - $ref: "#/components/schemas/MetricsControlPlaneFilterByField"
          - $ref: "#/components/schemas/MetricsControlPlaneGroupFilterByField"
          - $ref: "#/components/schemas/MetricsGatewayServiceFilterByField"
          - $ref: "#/components/schemas/MetricsLlmCacheStatusFilterByField"
          - $ref: "#/components/schemas/MetricsLlmEmbeddingsModelFilterByField"
          - $ref: "#/components/schemas/MetricsLlmEmbeddingsProviderFilterByField"
          - $ref: "#/components/schemas/MetricsRealmFilterByField"
          - $ref: "#/components/schemas/MetricsRouteFilterByField"
          - $ref: "#/components/schemas/MetricsStatusCodeFilterByField"
          - $ref: "#/components/schemas/MetricsStatusCodeGroupedFilterByField"
    Granularity:
      description: >
        Force time grouping into buckets of the specified duration.  Only has an
        effect if "time" is in the "dimensions" list.


        The granularity of the result may be coarser than requested.  The finest
        allowed granularity depends on the query's time range: data farther in
        the past may have coarser granularity.  The exact result granularity
        will be reported in the response `meta.granularity_ms` field.


        If granularity is not specified and "time" is in the dimensions list, a
        default will be chosen based on the time range requested.


        Different relative times support different granularities:
          - 15m => tenSecondly, thirtySecondly, minutely
          - 1h  => tenSecondly, thirtySecondly, minutely, fiveMinutely, tenMinutely
          - 6h  => thirtySecondly, minutely, fiveMinutely, tenMinutely, thirtyMinutely, hourly
          - 12h => minutely, fiveMinutely, tenMinutely, thirtyMinutely, hourly
          - 24h => fiveMinutely, tenMinutely, thirtyMinutely, hourly
          - 7d  => thirtyMinutely, hourly, twoHourly, twelveHourly, daily
          - 30d => hourly, twoHourly, twelveHourly, daily, weekly

        For special time ranges:
          - current_week, previous_week   => thirtyMinutely, hourly, twoHourly, twelveHourly, daily
          - current_month, previous_month => hourly, twoHourly, twelveHourly, daily, weekly

        For absolute time ranges, daily will be used.
      type: string
      enum:
        - tenSecondly
        - thirtySecondly
        - minutely
        - fiveMinutely
        - tenMinutely
        - thirtyMinutely
        - hourly
        - twoHourly
        - twelveHourly
        - daily
        - weekly
    TimeRange:
      description: The time range to query.
      default:
        type: relative
        time_range: 1h
      discriminator:
        propertyName: type
        mapping:
          relative: "#/components/schemas/MetricsRelativeTimeRangeDtoV2"
          absolute: "#/components/schemas/MetricsAbsoluteTimeRangeDtoV2"
      oneOf:
        - $ref: "#/components/schemas/MetricsRelativeTimeRangeDtoV2"
        - $ref: "#/components/schemas/MetricsAbsoluteTimeRangeDtoV2"
    MetricsAiPluginFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The values to include in the results.
              type: array
              items:
                type: string
            field:
              description: The field to filter.
              type: string
              enum:
                - ai_plugin
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - ai_plugin
          required:
            - operator
            - field
      title: Filter by ai_plugin
    MetricsAiProviderFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The values to include in the results.
              type: array
              items:
                type: string
            field:
              description: The field to filter.
              type: string
              enum:
                - ai_provider
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - ai_provider
          required:
            - operator
            - field
      title: Filter by ai_provider
    MetricsAiRequestModelFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The values to include in the results.
              type: array
              items:
                type: string
            field:
              description: The field to filter.
              type: string
              enum:
                - ai_request_model
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - ai_request_model
          required:
            - operator
            - field
      title: Filter by ai_request_model
    MetricsAiResponseModelFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The values to include in the results.
              type: array
              items:
                type: string
            field:
              description: The field to filter.
              type: string
              enum:
                - ai_response_model
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - ai_response_model
          required:
            - operator
            - field
      title: Filter by ai_response_model
    MetricsApplicationFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The IDs to include in the results.
              type: array
              items:
                $ref: "#/components/schemas/UnscopedUuid"
            field:
              description: The field to filter.
              type: string
              enum:
                - application
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - application
          required:
            - operator
            - field
      title: Filter by application
    MetricsConsumerFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: >
                The IDs to include in the results. Because gateway IDs are only
                unique within a given control plane, the filter values must be
                of the form `control_plane_id:field_id` or
                `control_plane_group_id:field_id` for data plane nodes within a
                control plane group.
              type: array
              items:
                $ref: "#/components/schemas/ScopedUuid"
            field:
              description: The field to filter.
              type: string
              enum:
                - consumer
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - consumer
          required:
            - operator
            - field
      title: Filter by consumer
    MetricsControlPlaneFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The IDs to include in the results.
              type: array
              items:
                $ref: "#/components/schemas/UnscopedUuid"
            field:
              description: The field to filter.
              type: string
              enum:
                - control_plane
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - control_plane
          required:
            - operator
            - field
      title: Filter by control_plane
    MetricsControlPlaneGroupFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The IDs to include in the results.
              type: array
              items:
                $ref: "#/components/schemas/UnscopedUuid"
            field:
              description: The field to filter.
              type: string
              enum:
                - control_plane_group
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - control_plane_group
          required:
            - operator
            - field
      title: Filter by control_plane_group
    MetricsGatewayServiceFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: >
                The IDs to include in the results. Because gateway IDs are only
                unique within a given control plane, the filter values must be
                of the form `control_plane_id:field_id` or
                `control_plane_group_id:field_id` for data plane nodes within a
                control plane group.
              type: array
              items:
                $ref: "#/components/schemas/ScopedUuid"
            field:
              description: The field to filter.
              type: string
              enum:
                - gateway_service
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - gateway_service
          required:
            - operator
            - field
      title: Filter by gateway_service
    MetricsLlmCacheStatusFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The values to include in the results.
              type: array
              items:
                type: string
            field:
              description: The field to filter.
              type: string
              enum:
                - llm_cache_status
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - llm_cache_status
          required:
            - operator
            - field
      title: Filter by llm_cache_status
    MetricsLlmEmbeddingsModelFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The values to include in the results.
              type: array
              items:
                type: string
            field:
              description: The field to filter.
              type: string
              enum:
                - llm_embeddings_model
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - llm_embeddings_model
          required:
            - operator
            - field
      title: Filter by llm_embeddings_model
    MetricsLlmEmbeddingsProviderFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The values to include in the results.
              type: array
              items:
                type: string
            field:
              description: The field to filter.
              type: string
              enum:
                - llm_embeddings_provider
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - llm_embeddings_provider
          required:
            - operator
            - field
      title: Filter by llm_embeddings_provider
    MetricsRealmFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The IDs to include in the results.
              type: array
              items:
                $ref: "#/components/schemas/UnscopedUuid"
            field:
              description: The field to filter.
              type: string
              enum:
                - realm
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - realm
          required:
            - operator
            - field
      title: Filter by realm
    MetricsRouteFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: >
                The IDs to include in the results. Because gateway IDs are only
                unique within a given control plane, the filter values must be
                of the form `control_plane_id:field_id` or
                `control_plane_group_id:field_id` for data plane nodes within a
                control plane group.
              type: array
              items:
                $ref: "#/components/schemas/ScopedUuid"
            field:
              description: The field to filter.
              type: string
              enum:
                - route
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - route
          required:
            - operator
            - field
      title: Filter by route
    MetricsStatusCodeFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The codes to include in the results.
              type: array
              items:
                type: integer
                minimum: 0
                maximum: 999
            field:
              description: The field to filter.
              type: string
              enum:
                - status_code
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - status_code
          required:
            - operator
            - field
      title: Filter by status_code
    MetricsStatusCodeGroupedFilterByField:
      oneOf:
        - title: Multiselect filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterType"
            value:
              description: |
                The code groups to include in the results.
              type: array
              items:
                type: string
                pattern: ^\d[xX][xX]$
            field:
              description: The field to filter.
              type: string
              enum:
                - status_code_grouped
          required:
            - operator
            - value
            - field
        - title: Empty filters
          type: object
          properties:
            operator:
              $ref: "#/components/schemas/RequestsFilterTypeEmpty"
            field:
              description: The field to filter.
              type: string
              enum:
                - status_code_grouped
          required:
            - operator
            - field
      title: Filter by status_code_grouped
    MetricsRelativeTimeRangeDtoV2:
      description: A duration representing a relative-to-now span of time. Generally
        the start time is floored to the requested granularity. Eg 7d from now,
        with 1day granularity initiated at 2024-01-08T17:11:00+05:00 will query
        for the time range from 2024-01-01T00:00:00+05:00 to
        2024-01-08T17:11:00+05:00. The exact start and end timestamps are
        returned in the result query in the meta.start and meta.end fields. If
        the granularity for the previous query was 1hour, it would query a time
        range from 2024-01-01T17:00:00+05:00 to 2024-01-08T17:11:00+05:00.
      type: object
      properties:
        tz:
          type: string
          default: Etc/UTC
        type:
          type: string
          enum:
            - relative
        time_range:
          type: string
          default: 1h
          enum:
            - 15m
            - 1h
            - 6h
            - 12h
            - 24h
            - 7d
            - 30d
            - current_week
            - current_month
            - previous_week
            - previous_month
      required:
        - type
        - time_range
      title: Relative time range
    MetricsAbsoluteTimeRangeDtoV2:
      description: A duration representing an exact start and end time.
      type: object
      properties:
        tz:
          type: string
          default: Etc/UTC
        type:
          type: string
          enum:
            - absolute
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
      required:
        - type
      title: Absolute time range
    RequestsFilterType:
      description: The type of filter to apply.  `in` filters will limit results to
        only the specified values, while `not_in` filters will exclude the
        specified values.
      type: string
      enum:
        - in
        - not_in
    RequestsFilterTypeEmpty:
      description: The type of filter to apply.
      type: string
      enum:
        - empty
        - not_empty
    UnscopedUuid:
      type: string
      pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
    ScopedUuid:
      type: string
      pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
    LLMQuery:
      description: A query targeting the LLM usage analytics datasource.
      type: object
      properties:
        datasource:
          type: string
          enum:
            - llm_usage
        metrics:
          $ref: "#/components/schemas/LLMMetrics"
        dimensions:
          description: List of attributes or entity types to group by.
          type: array
          items:
            type: string
            enum:
              - control_plane
              - control_plane_group
              - gateway_service
              - consumer
              - application
              - route
              - ai_provider
              - ai_response_model
              - ai_request_model
              - llm_cache_status
              - llm_embeddings_provider
              - llm_embeddings_model
              - time
              - realm
              - status_code
              - status_code_grouped
              - ai_plugin
          maxItems: 2
        filters:
          $ref: "#/components/schemas/LLMFilters"
        granularity:
          $ref: "#/components/schemas/Granularity"
        time_range:
          $ref: "#/components/schemas/TimeRange"
      example:
        datasource: llm_usage
        time_range:
          type: relative
          time_range: 24h
          tz: EST
        dimensions:
          - time
          - ai_plugin
        filters:
          - operator: in
            field: control_plane
            value:
              - d5ac5d88-efed-4e10-9dfe-0b0a6646c219
        granularity: hourly
        metrics:
          - total_tokens
      additionalProperties: false
      required:
        - datasource
```
