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

# List Chat Completions

> List all chat completions with optional filtering



## OpenAPI

````yaml GET /chat/completions
openapi: 3.0.0
info:
  title: Cloudglue API
  description: API for Cloudglue
  license:
    name: Apache License 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 0.7.8
servers:
  - url: https://api.cloudglue.dev/v1
security:
  - bearerAuth: []
paths:
  /chat/completions:
    get:
      tags:
        - Chat
      summary: List all chat completions
      description: List all chat completions with optional filtering
      operationId: listChatCompletions
      parameters:
        - name: limit
          in: query
          description: Maximum number of chat completions to return
          required: false
          schema:
            type: integer
            maximum: 100
        - name: offset
          in: query
          description: Number of chat completions to skip
          required: false
          schema:
            type: integer
        - name: created_before
          in: query
          description: >-
            Filter chat completions created before a specific date (YYYY-MM-DD
            format), in UTC timezone
          required: false
          schema:
            type: string
            format: date
        - name: created_after
          in: query
          description: >-
            Filter chat completions created after a specific date (YYYY-MM-DD
            format), in UTC timezone
          required: false
          schema:
            type: string
            format: date
      responses:
        '200':
          description: A list of chat completions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionList'
components:
  schemas:
    ChatCompletionList:
      type: object
      required:
        - object
        - data
        - total
        - limit
        - offset
      properties:
        object:
          type: string
          enum:
            - list
          description: Object type, always 'list'
        data:
          type: array
          items:
            type: object
            required:
              - id
              - created_at
              - object
              - model
              - usage
              - choices
              - payload
            properties:
              id:
                type: string
                format: uuid
                description: The ID of the chat completion
              created_at:
                type: number
                description: The timestamp of the chat completion
              object:
                type: string
                enum:
                  - chat.completion
                description: Object type, always 'chat.completion'
              model:
                type: string
                description: The model used for the chat completion
              usage:
                type: object
                properties:
                  prompt_tokens:
                    type: integer
                    description: The number of tokens in the prompt
                  completion_tokens:
                    type: integer
                    description: The number of tokens in the completion
                  total_tokens:
                    type: integer
                    description: The total number of tokens in the request
                description: The usage of the chat completion
              choices:
                type: array
                items:
                  type: object
                  required:
                    - index
                    - message
                  properties:
                    index:
                      type: integer
                      description: The index of the choice
                    message:
                      $ref: '#/components/schemas/ChatMessage'
                description: The choices of the chat completion
              payload:
                $ref: '#/components/schemas/ChatCompletionPayload'
          description: The list of chat completions
        total:
          type: integer
          description: The total number of items
        limit:
          type: integer
          description: The number of items per page
        offset:
          type: integer
          description: The offset of the items
    ChatMessage:
      type: object
      properties:
        role:
          type: string
          description: The role of the message author
          enum:
            - system
            - user
            - assistant
        content:
          type: string
          description: The content of the message
        name:
          type: string
          description: The name of the author of this message
      required:
        - role
        - content
    ChatCompletionPayload:
      type: object
      properties:
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ChatMessage'
        temperature:
          type: number
          description: The temperature of the chat completion
        filter:
          $ref: '#/components/schemas/SearchFilter'
        collections:
          type: array
          items:
            type: string
            format: uuid
    SearchFilter:
      type: object
      properties:
        metadata:
          type: array
          description: Filter by file metadata using JSON path expressions
          items:
            allOf:
              - $ref: '#/components/schemas/SearchFilterCriteria'
              - type: object
                properties:
                  scope:
                    type: string
                    enum:
                      - file
                      - segment
                    description: >-
                      Specifies scope of eligible search items (file/segment) to
                      check metadata filtering conditions
        video_info:
          type: array
          description: >-
            Filter by video information. Use scope 'file' to filter by source
            video properties, or 'segment' to filter by individual segment
            properties (e.g. segment duration).
          items:
            allOf:
              - $ref: '#/components/schemas/SearchFilterCriteria'
              - type: object
                properties:
                  path:
                    type: string
                    enum:
                      - duration_seconds
                      - has_audio
                  scope:
                    type: string
                    enum:
                      - file
                      - segment
                    description: >-
                      Scope of the filter. 'file' filters by source video
                      properties, 'segment' filters by segment properties. Only
                      duration_seconds is supported with segment scope.
        file:
          type: array
          description: Filter by file properties
          items:
            allOf:
              - $ref: '#/components/schemas/SearchFilterCriteria'
              - type: object
                properties:
                  path:
                    type: string
                    enum:
                      - bytes
                      - filename
                      - uri
                      - created_at
                      - id
    SearchFilterCriteria:
      type: object
      required:
        - path
        - operator
      properties:
        path:
          type: string
          description: JSON path for the field to filter on
        operator:
          type: string
          enum:
            - NotEqual
            - Equal
            - LessThan
            - GreaterThan
            - ContainsAny
            - ContainsAll
            - In
            - Like
          description: Comparison operator to apply
        valueText:
          type: string
          description: >-
            Text value for scalar comparison (used with NotEqual, Equal,
            LessThan, GreaterThan, Like)
        valueTextArray:
          type: array
          items:
            type: string
          description: >-
            Array of values for array comparisons (used with ContainsAny,
            ContainsAll, In)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````