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

# Create a criterion

> One binary question about quality. A criterion's verdicts are meaningless until you ALIGN it against your labels — create, then POST /v1/criteria/{id}/align.



## OpenAPI

````yaml /openapi.json post /v1/criteria
openapi: 3.1.0
info:
  title: Omnia Management API
  description: >-
    The management API behind the improvement loop: capture and setup, request
    logs and datasets, grades (labels), judges (criteria), evals and deploy
    gates, fine-tuning and reinforcement learning, dedicated GPU endpoints, and
    model aliases and versions. Authenticated with a workspace API key
    (sk_sovereign_...). The inference API (chat, embeddings, rerank, responses)
    is OpenAI-compatible and documented separately.


    Responses are snake_case, list endpoints on the loop products use the
    {"object": "list", "data": [...]} envelope, and refusals use the same nested
    error shape the gateway emits: {"error": {"message", "type", "code"}}.
    Request bodies on the loop products (logs, labels, criteria, evals,
    datasets, aliases) are snake_case; the training and infrastructure products
    (fine-tuning, GRPO, environment tools, dedicated, model-version adoption)
    validate camelCase bodies, and each schema below says which it is. Endpoints
    that spend money require a key minted by a workspace owner or admin and
    return 403 otherwise.
  version: 1.0.0
servers:
  - url: https://gateway.omnia-voice.com
    description: Production
  - url: https://platform.omnia-voice.com/api
    description: Production (legacy alias — same API, older base URL)
security:
  - bearerAuth: []
paths:
  /v1/criteria:
    post:
      tags:
        - Criteria
      summary: Create a criterion
      description: >-
        One binary question about quality. A criterion's verdicts are
        meaningless until you ALIGN it against your labels — create, then POST
        /v1/criteria/{id}/align.
      operationId: createCriterion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCriterion'
      responses:
        '201':
          description: The draft criterion.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Criterion'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    CreateCriterion:
      type: object
      required:
        - name
        - judge_prompt
        - judge_model
      properties:
        name:
          type: string
          maxLength: 80
        description:
          type:
            - string
            - 'null'
          maxLength: 500
        judge_prompt:
          type: string
          minLength: 10
          maxLength: 4000
          example: >-
            FAIL any response that never delivers a final answer — e.g. it
            consists only of reasoning, stops mid-sentence, or is cut off before
            answering.
        judge_model:
          type: string
          example: Qwen/Qwen3-235B-A22B-Instruct-2507
        unit:
          type: string
          enum:
            - request
            - trace
          description: >-
            Create-only. Trace-unit judges read whole runs and align against
            whole-run labels.
        population:
          type: string
          description: >-
            Tag scoping what the judge scores online and which labels it aligns
            against.
        population_family:
          type: string
          description: >-
            Auto-detected traffic segment scoping what the judge scores online
            and which grades it calibrates against — a `segment` value from GET
            /v1/logs; '' = no segment scope. Composes with population (tag).
    Criterion:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
          example: Complete final answer
        description:
          type:
            - string
            - 'null'
        judge_prompt:
          type: string
          description: >-
            The binary instruction the judge applies. State precisely what makes
            a response FAIL.
        judge_model:
          type: string
        status:
          type: string
          enum:
            - draft
            - retired
          description: >-
            Lifecycle only: draft (in use) or retired (excluded from online
            scoring and pickers; set via PATCH). Alignment QUALITY is never
            stored here — read tier, tpr, tnr, and aligned_at. A criterion can
            be fully aligned and still say status=draft; that is by design, not
            a missing promotion.
        source:
          type: string
          enum:
            - human
            - assist_suggested
        tier:
          type: string
          enum:
            - aligned
            - weak
            - misaligned
            - unmeasured
          description: >-
            LEGACY point-estimate badge, kept for continuity. Computed by
            comparing the raw TPR/TNR to fixed thresholds, so it cannot
            distinguish 9-of-10 from 90-of-100. Read `trust` instead — that is
            what every gate uses.
        trust:
          type: string
          enum:
            - trustworthy
            - under-measured
            - borderline
            - misaligned
            - unmeasured
          description: >-
            What this judge's evidence PROVES, derived from the 95% Wilson
            interval rather than the point estimate. `trustworthy` = both lower
            bounds clear the 90% bar. `under-measured` = straddles it, and more
            grading would settle it (see fail_grades_needed /
            pass_grades_needed). `borderline` = straddles it with the rate
            hugging the bar, so more grading will NOT settle it — narrow what
            the judge asks instead. `misaligned` = an upper bound sits below the
            bar, i.e. proven wrong rather than merely unproven. `unmeasured` =
            no interval at all (never calibrated, or one-class grades).
            Auto-routing and RL rewards require `trustworthy`; dataset curation
            also accepts `under-measured`.
        tpr_ci:
          type:
            - array
            - 'null'
          items:
            type: number
          minItems: 2
          maxItems: 2
          nullable: true
          description: >-
            95% Wilson interval [low, high] for `tpr` — the evidence `trust` was
            derived from. Null when no human-failed grades exist. A tpr of 1.0
            with tpr_ci [0.646, 1.0] means the judge caught every failure it was
            shown, and was shown seven.
        tnr_ci:
          type:
            - array
            - 'null'
          items:
            type: number
          minItems: 2
          maxItems: 2
          nullable: true
          description: >-
            95% Wilson interval [low, high] for `tnr`. Null when no human-passed
            grades exist.
        fail_grades_needed:
          type:
            - integer
            - 'null'
          nullable: true
          description: >-
            Additional grades OF FAILING TRACES needed for TPR's lower bound to
            clear the bar, assuming the judge keeps its observed rate. TPR is
            measured only on human-failed rows, so grading more passes does not
            move it. Null when already proven, already below the bar, or too
            close to it for grading to help.
        pass_grades_needed:
          type:
            - integer
            - 'null'
          description: The same for TNR, measured only on human-passed rows.
        tpr:
          type:
            - number
            - 'null'
          description: >-
            P(judge says fail | you said fail) — how often it catches real
            failures.
        tnr:
          type:
            - number
            - 'null'
          description: P(judge says pass | you said pass).
        kappa:
          type:
            - number
            - 'null'
          description: >-
            Cohen's κ — chance-corrected agreement (raw agreement is inflated by
            class imbalance).
        alignment_n:
          type:
            - integer
            - 'null'
        aligned_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
        unit:
          type: string
          enum:
            - request
            - trace
          description: >-
            What this judge grades: one exchange, or a whole agent run /
            trace-grouped conversation. Fixed at creation.
        population:
          type: string
          description: >-
            The tag this criterion judges online AND aligns against ('' = all
            logged traffic). Changing it voids alignment.
        population_family:
          type: string
          description: >-
            The auto-detected traffic segment this judge is scoped to ('' =
            none): a `segment` value from GET /v1/logs. Scopes what it judges
            online AND which grades it calibrates against, together with
            population (tag) and unit. Changing it voids calibration.
        online_enabled:
          type: boolean
          description: >-
            Whether the online monitor is scoring a sample of fresh logged
            traffic with this judge.
        online_percent:
          type: integer
          description: >-
            Percent of eligible fresh traffic the online monitor samples —
            deterministic, never double-judging a request.
        drift_status:
          type: string
          enum:
            - ok
            - flagged
          description: >-
            flagged = the judge may have drifted on live traffic (stale
            calibration or an anomalous corrected-quality drop); re-calibrate on
            fresh grades.
        online_cap_usd:
          type: number
          description: >-
            Weekly online-judging spend ceiling in USD (0 = uncapped). Reaching
            it pauses this criterion's online scoring until the week rolls over.
        online_spent_usd:
          type: number
          description: Online judging spend in the current weekly window.
        drift_signal:
          type:
            - string
            - 'null'
          description: >-
            Which signal raised the flag: "stale" (calibration aged out) or
            "quality_drop" (live corrected rate fell below what the judge
            validated at). Null when drift_status is ok.
          enum:
            - stale
            - quality_drop
            - null
        drift_reason:
          type:
            - string
            - 'null'
          description: Human-readable receipt behind a flagged drift_status.
        drift_checked_at:
          type:
            - string
            - 'null'
          description: >-
            When the drift sweep last examined this judge; null for a judge it
            has never reached.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              description: >-
                invalid_request_error, insufficient_quota, rate_limit_error, or
                api_error.
            code:
              type: string
              description: >-
                Machine-stable cause, e.g. invalid_api_key, not_found,
                insufficient_permissions, precondition_failed.
          required:
            - message
            - type
            - code
      description: >-
        Every refusal — gateway and management API alike — uses this one
        envelope.
  responses:
    BadRequest:
      description: Malformed request or invalid field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, malformed, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Invalid API key
              type: invalid_request_error
              code: invalid_api_key
    Forbidden:
      description: The key lacks the required owner/admin permission.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your workspace API key, e.g. `sk_sovereign_...`, sent as `Authorization:
        Bearer <key>`.

````