Explorium Credits API

Inspect the shared credit pool that meters all Explorium API usage, including the credit menu and consumption aggregation (v1).

OpenAPI Specification

explorium-credits-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Partner Service Credits API
  version: 0.3.19
servers:
- url: https://api.explorium.ai
  description: AgentSource Server
tags:
- name: Credits
paths:
  /v1/credits/menu/{partner_id}:
    get:
      tags:
      - Credits
      summary: Get Credits Menu Partner Id
      operationId: get_credits_menu_partner_id
      parameters:
      - required: true
        schema:
          type: string
          title: Partner Id
        name: partner_id
        in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomCreditMenu'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - APIKeyHeader: []
      - APIKeyHeader: []
  /v1/credits:
    get:
      tags:
      - Credits
      summary: Get Active Credits Summary
      operationId: get_active_credits_summary
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActiveCreditSummaryWithAccountTypeResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - APIKeyHeader: []
      - APIKeyHeader: []
  /v1/credits/aggregation:
    post:
      tags:
      - Credits
      summary: Get Credit Aggregation
      operationId: get_credit_aggregation
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreditAggregationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditAggregationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - APIKeyHeader: []
      - APIKeyHeader: []
components:
  schemas:
    CustomCreditMenu:
      properties:
        response_context:
          $ref: '#/components/schemas/ResponseContext'
        partner_id:
          type: string
          title: Partner Id
          description: Partner ID for this credit menu
        charging_menu:
          additionalProperties:
            $ref: '#/components/schemas/ChargingRule'
          type: object
          title: Charging Menu
          description: Dictionary of operation names to charging rules
      type: object
      required:
      - response_context
      - partner_id
      - charging_menu
      title: CustomCreditMenu
      description: This is base response model for all responses in partner service.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CreditAggregationResponse:
      properties:
        response_context:
          $ref: '#/components/schemas/ResponseContext'
        from_date:
          type: string
          title: From Date
          description: ISO 8601 datetime string for start date
        to_date:
          type: string
          title: To Date
          description: ISO 8601 datetime string for end date
        mode:
          type: string
          title: Mode
          description: Aggregation mode
        resolution:
          type: string
          enum:
          - hour
          - day
          - month
          title: Resolution
          description: Aggregation resolution (not applicable for endpoints mode)
        timezone:
          type: string
          title: Timezone
          description: Timezone used for aggregation
        total_credits:
          type: integer
          title: Total Credits
          description: Total credits consumed in the period
        aggregations:
          items:
            type: object
          type: array
          title: Aggregations
          description: Array of aggregation data points
      type: object
      required:
      - response_context
      - from_date
      - to_date
      - mode
      - timezone
      - total_credits
      - aggregations
      title: CreditAggregationResponse
      description: This is base response model for all responses in partner service.
    ChargingRule:
      properties:
        credit_cost:
          type: integer
          title: Credit Cost
      type: object
      required:
      - credit_cost
      title: ChargingRule
    RequestStatus:
      type: string
      enum:
      - success
      - miss
      - failure
      title: RequestStatus
      description: "The `RequestStatus` class is an enumeration that defines the possible statuses of a request.\n\nThis enum is used to indicate whether a request was successful, missed, or failed. It ensures\nconsistent handling of request statuses across the application.\n\nAttributes:\n    SUCCESS: Indicates that the request was successfully processed.\n    MISS: Indicates that the request did not find any matching data.\n    FAILURE: Indicates that the request encountered an error or failure."
    CreditAggregationRequest:
      properties:
        request_context:
          type: object
          title: Request Context
          marked_for_null_replacement: true
          nullable: true
        from_date:
          type: string
          title: From Date
          description: ISO 8601 datetime string for start date
        to_date:
          type: string
          title: To Date
          description: ISO 8601 datetime string for end date
        mode:
          type: string
          enum:
          - timely
          - endpoints
          title: Mode
          description: Aggregation mode
        resolution:
          type: string
          enum:
          - hour
          - day
          - month
          title: Resolution
          description: Aggregation resolution (required for timely mode, optional for endpoints mode)
        timezone:
          type: string
          title: Timezone
          description: Timezone for aggregation, defaults to UTC
          default: UTC
        key_name:
          type: string
          title: Key Name
          description: Optional API key name to scope aggregation results
      additionalProperties: false
      type: object
      required:
      - from_date
      - to_date
      - mode
      title: CreditAggregationRequest
    ActiveCreditSummaryWithAccountTypeResponse:
      properties:
        response_context:
          $ref: '#/components/schemas/ResponseContext'
        allocated_credits:
          type: integer
          title: Allocated Credits
          description: Number of allocated credits
        remaining_credits:
          type: integer
          title: Remaining Credits
          description: Number of remaining credits
        account_type:
          allOf:
          - $ref: '#/components/schemas/AccountType'
          description: Type of the last package assigned to the account. trial means no purchase was made; paid means the user purchased a package.
      type: object
      required:
      - response_context
      - allocated_credits
      - remaining_credits
      title: ActiveCreditSummaryWithAccountTypeResponse
      description: This is base response model for all responses in partner service.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    AccountType:
      type: string
      enum:
      - trial
      - paid
      title: AccountType
      description: An enumeration.
    ResponseContext:
      properties:
        correlation_id:
          type: string
          title: Correlation Id
        request_status:
          $ref: '#/components/schemas/RequestStatus'
        time_took_in_seconds:
          type: number
          title: Time Took In Seconds
      type: object
      required:
      - correlation_id
      - request_status
      - time_took_in_seconds
      title: ResponseContext
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: api_key