Not Diamond Feedback API

The Feedback API from Not Diamond — 2 operation(s) for feedback.

OpenAPI Specification

notdiamond-feedback-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Not Diamond Custom Routers Feedback API
  description: REST API for the Not Diamond AI model router. The modelSelect endpoint routes a prompt to the best LLM across providers based on quality, cost, and latency tradeoffs. Additional endpoints list supported models, report feedback and latency metrics to personalize routing in real time, and train custom routers from evaluation datasets.
  termsOfService: https://www.notdiamond.ai/terms
  contact:
    name: Not Diamond
    url: https://www.notdiamond.ai
  version: '2.0'
servers:
- url: https://api.notdiamond.ai/v2
security:
- bearerAuth: []
tags:
- name: Feedback
paths:
  /report/metrics/feedback:
    post:
      operationId: reportFeedback
      tags:
      - Feedback
      summary: Report outcome feedback for a routing session.
      description: Submits binary outcome feedback (0 or 1) for the provider selected in a routing session so Not Diamond can personalize future routing.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FeedbackRequest'
      responses:
        '200':
          description: Feedback accepted.
        '401':
          description: Missing or invalid API key.
        '422':
          description: Validation error.
  /report/metrics/latency:
    post:
      operationId: reportLatency
      tags:
      - Feedback
      summary: Report latency metrics for a routing session.
      description: Reports observed latency (for example tokens per second) for the provider selected in a routing session.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LatencyRequest'
      responses:
        '200':
          description: Latency metrics accepted.
        '401':
          description: Missing or invalid API key.
        '422':
          description: Validation error.
components:
  schemas:
    LatencyRequest:
      type: object
      properties:
        session_id:
          type: string
        provider:
          $ref: '#/components/schemas/LLMProvider'
        feedback:
          type: object
          properties:
            tokens_per_second:
              type: number
      required:
      - session_id
      - provider
      - feedback
    LLMProvider:
      type: object
      description: A candidate provider/model that the router may select.
      properties:
        provider:
          type: string
          description: Provider identifier (e.g. openai, anthropic). Omit when using an OpenRouter slug.
          example: openai
        model:
          type: string
          description: Model identifier, or an OpenRouter slug (e.g. openai/gpt-4o).
          example: gpt-4o
        is_custom:
          type: boolean
          description: Set to true to describe a custom model.
        context_length:
          type: integer
          description: Maximum context length (required for custom models).
        input_price:
          type: number
          description: Cost per million input tokens in USD (required for custom models).
        output_price:
          type: number
          description: Cost per million output tokens in USD (required for custom models).
        latency:
          type: number
          description: Expected latency for the custom model.
      required:
      - model
    FeedbackRequest:
      type: object
      properties:
        session_id:
          type: string
          description: The session ID returned by modelSelect.
        provider:
          $ref: '#/components/schemas/LLMProvider'
        feedback:
          type: object
          description: Feedback payload. The outcome value must be 0 or 1.
          properties:
            value:
              type: integer
              enum:
              - 0
              - 1
      required:
      - session_id
      - provider
      - feedback
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Not Diamond API key passed as a Bearer token.