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

# Preview Routing Decision

> Evaluate a saved or draft route against an example using local snapshots. Does not invoke providers, persist the example, consume admission or advance routing state. Local rotation and health can change before a real request. Budget/quota admission, latency and response quality are not predicted.



## OpenAPI

````yaml /openapi.json post /api/routing-models/preview
openapi: 3.1.0
info:
  title: Aixy Gateway API
  version: 0.1.0
  description: >-
    Route requests to configured AI providers through OpenAI- and
    Anthropic-compatible APIs. Aixy applies project access, model policies,
    guardrails, routing, budgets, and usage attribution before forwarding
    inference traffic.
servers:
  - url: https://api.aixy-gateway.com
    description: Aixy production gateway
security: []
tags:
  - name: operations
    description: Check process liveness and traffic readiness.
  - name: authentication
    description: Authenticate trusted server-side clients.
  - name: organizations
    description: Manage the organization and its lifecycle.
  - name: projects
    description: Create projects and manage project membership.
  - name: users
    description: Manage organization users, roles, and invitations.
  - name: teams
    description: Manage teams and team membership.
  - name: api-keys
    description: Manage project-scoped gateway API keys.
  - name: provider-credentials
    description: Manage organization and project provider credentials.
  - name: provider-catalog
    description: Discover providers supported by the gateway.
  - name: provider-models
    description: Discover and control models exposed by configured providers.
  - name: routing
    description: Configure stable model aliases, routing strategies, and fallbacks.
  - name: guardrails
    description: Configure prompt and sensitive-data protection policies.
  - name: identity connections
    description: Configure tenant-scoped enterprise identity federation.
  - name: playground
    description: Exercise configured models through the gateway.
  - name: cost-control
    description: Inspect spend and enforce budgets across tenant scopes.
  - name: metrics
    description: Inspect usage, token, latency, and error metrics.
  - name: activity
    description: Diagnose individual model requests and manage opt-in content capture.
  - name: monitors
    description: Configure operational monitors and notification channels.
  - name: audit
    description: Query, verify, and export the organization audit log.
  - name: telemetry exports
    description: Export telemetry to organization-owned destinations.
  - name: billing
    description: Inspect and manage the organization subscription.
  - name: models
    description: List models available to a project-scoped gateway API key.
  - name: inference
    description: Run model inference through the Aixy data plane.
  - name: pricing
    description: Manage versioned pricing attribution rules.
  - name: system
    description: Discover gateway capabilities and providers.
  - name: MCP beta
    description: Mcp beta operations exposed by the gateway.
  - name: cost-optimization
    description: Cost optimization operations exposed by the gateway.
  - name: custom domains
    description: Custom domains operations exposed by the gateway.
  - name: data processing
    description: Data processing operations exposed by the gateway.
  - name: feature flags
    description: Feature flags operations exposed by the gateway.
  - name: privacy
    description: Privacy operations exposed by the gateway.
  - name: roles
    description: Roles operations exposed by the gateway.
paths:
  /api/routing-models/preview:
    post:
      tags:
        - routing
      summary: Preview Routing Decision
      description: >-
        Evaluate a saved or draft route against an example using local
        snapshots. Does not invoke providers, persist the example, consume
        admission or advance routing state. Local rotation and health can change
        before a real request. Budget/quota admission, latency and response
        quality are not predicted.
      operationId: preview_routing_decision
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoutingPreviewRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutingPreviewResponse'
        '400':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayErrorResponse'
        '401':
          description: Authentication is required or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayErrorResponse'
        '403':
          description: The authenticated account cannot perform this operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayErrorResponse'
        '404':
          description: The requested resource does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayErrorResponse'
        '413':
          description: The request body exceeds the endpoint limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayErrorResponse'
        '422':
          description: The request is semantically invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayErrorResponse'
        '503':
          description: The control-plane capability is unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayErrorResponse'
        4XX:
          description: The request was rejected by validation or authorization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayErrorResponse'
      security:
        - BrowserSession: []
components:
  schemas:
    RoutingPreviewRequest:
      properties:
        routing_model_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Routing Model Id
        configuration:
          anyOf:
            - $ref: '#/components/schemas/RoutingModelCreateRequest'
            - type: 'null'
        endpoint:
          type: string
          enum:
            - chat/completions
            - responses
            - messages
          title: Endpoint
          default: chat/completions
        request:
          additionalProperties: true
          type: object
          title: Request
        session_id:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: Session Id
        api_key_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Api Key Id
        project_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Project Id
          description: Execution project, required for organization routes
      additionalProperties: false
      type: object
      required:
        - request
      title: RoutingPreviewRequest
    RoutingPreviewResponse:
      properties:
        model:
          type: string
          title: Model
        route_version:
          type: string
          title: Route Version
        configuration_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Configuration Version
        is_draft:
          type: boolean
          title: Is Draft
        enabled:
          type: boolean
          title: Enabled
        endpoint:
          type: string
          title: Endpoint
        selection_reason:
          type: string
          title: Selection Reason
        affinity_scope:
          type: string
          title: Affinity Scope
        required_capabilities:
          items:
            type: string
          type: array
          title: Required Capabilities
        capability_validation_enabled:
          type: boolean
          title: Capability Validation Enabled
        guardrail_outcome:
          type: string
          title: Guardrail Outcome
        candidates:
          items:
            $ref: '#/components/schemas/RoutingPreviewCandidateResponse'
          type: array
          title: Candidates
        attempts:
          items:
            $ref: '#/components/schemas/RoutingPreviewAttemptResponse'
          type: array
          title: Attempts
        retry_on:
          items:
            type: string
          type: array
          title: Retry On
      type: object
      required:
        - model
        - route_version
        - configuration_version
        - is_draft
        - enabled
        - endpoint
        - selection_reason
        - affinity_scope
        - required_capabilities
        - capability_validation_enabled
        - guardrail_outcome
        - candidates
        - attempts
        - retry_on
      title: RoutingPreviewResponse
    GatewayErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/GatewayErrorDetail'
      type: object
      required:
        - error
      title: GatewayErrorResponse
    RoutingModelCreateRequest:
      properties:
        name:
          type: string
          title: Name
        alias:
          type: string
          title: Alias
        aliases:
          items:
            type: string
          type: array
          maxItems: 20
          title: Aliases
          description: >-
            Additional exact, case-sensitive model IDs without a provider
            prefix. Unique within the route's organization or project scope.
            Project names override inherited names.
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
          description: Project UUID; null means organization scope
        strategy:
          type: string
          enum:
            - priority
            - round_robin
            - weighted
          title: Strategy
        targets:
          items:
            $ref: '#/components/schemas/RoutingTargetRequest'
          type: array
          maxItems: 10
          minItems: 1
          title: Targets
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        max_attempts:
          type: integer
          maximum: 5
          minimum: 1
          title: Max Attempts
          default: 2
        retry_on:
          items:
            type: string
            enum:
              - connection_error
              - rate_limit
              - server_error
          type: array
          title: Retry On
          default:
            - connection_error
            - rate_limit
            - server_error
        enabled:
          type: boolean
          title: Enabled
          default: true
        strict_capabilities:
          type: boolean
          title: Strict Capabilities
          default: false
        session_affinity:
          type: boolean
          title: Session Affinity
          default: false
        circuit_breaker_enabled:
          type: boolean
          title: Circuit Breaker Enabled
          default: false
        auto_routing:
          anyOf:
            - oneOf:
                - $ref: '#/components/schemas/AixyManagedRoutingRequest'
                - $ref: '#/components/schemas/ProviderRoutingRequest'
              discriminator:
                propertyName: backend
                mapping:
                  aixy_managed: '#/components/schemas/AixyManagedRoutingRequest'
                  chat_completions: '#/components/schemas/ProviderRoutingRequest'
            - type: 'null'
          title: Auto Routing
      additionalProperties: false
      type: object
      required:
        - name
        - alias
        - strategy
        - targets
      title: RoutingModelCreateRequest
    RoutingPreviewCandidateResponse:
      properties:
        provider:
          type: string
          title: Provider
        model:
          type: string
          title: Model
        connection_scope:
          type: string
          title: Connection Scope
        outcome:
          type: string
          title: Outcome
        reason:
          type: string
          title: Reason
      type: object
      required:
        - provider
        - model
        - connection_scope
        - outcome
        - reason
      title: RoutingPreviewCandidateResponse
    RoutingPreviewAttemptResponse:
      properties:
        provider:
          type: string
          title: Provider
        model:
          type: string
          title: Model
        connection_scope:
          type: string
          title: Connection Scope
        timeout_ms:
          type: integer
          title: Timeout Ms
      type: object
      required:
        - provider
        - model
        - connection_scope
        - timeout_ms
      title: RoutingPreviewAttemptResponse
    GatewayErrorDetail:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
      type: object
      required:
        - code
        - message
      title: GatewayErrorDetail
    RoutingTargetRequest:
      properties:
        provider:
          type: string
          title: Provider
        model:
          type: string
          title: Model
        weight:
          type: integer
          maximum: 100
          minimum: 1
          title: Weight
          default: 1
        timeout_ms:
          type: integer
          maximum: 120000
          minimum: 100
          title: Timeout Ms
          default: 30000
        connection_scope:
          type: string
          enum:
            - effective
            - organization
            - project
          title: Connection Scope
          default: effective
        capabilities:
          $ref: '#/components/schemas/RoutingCapabilitiesRequest'
        task_description:
          anyOf:
            - type: string
              maxLength: 1000
            - type: 'null'
          title: Task Description
      additionalProperties: false
      type: object
      required:
        - provider
        - model
      title: RoutingTargetRequest
    AixyManagedRoutingRequest:
      properties:
        backend:
          type: string
          const: aixy_managed
          title: Backend
        enabled:
          type: boolean
          title: Enabled
          default: true
      additionalProperties: false
      type: object
      required:
        - backend
      title: AixyManagedRoutingRequest
    ProviderRoutingRequest:
      properties:
        backend:
          type: string
          const: chat_completions
          title: Backend
        provider:
          type: string
          title: Provider
        model:
          type: string
          title: Model
        enabled:
          type: boolean
          title: Enabled
          default: true
        connection_scope:
          type: string
          enum:
            - effective
            - organization
            - project
          title: Connection Scope
          default: effective
        timeout_ms:
          type: integer
          maximum: 10000
          minimum: 50
          title: Timeout Ms
          default: 1000
        max_input_chars:
          type: integer
          maximum: 32000
          minimum: 100
          title: Max Input Chars
          default: 8000
      additionalProperties: false
      type: object
      required:
        - backend
        - provider
        - model
      title: ProviderRoutingRequest
    RoutingCapabilitiesRequest:
      properties:
        tools:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Tools
        structured_output:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Structured Output
        vision:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Vision
      additionalProperties: false
      type: object
      title: RoutingCapabilitiesRequest
  securitySchemes:
    BrowserSession:
      type: apiKey
      description: Secure same-origin browser session cookie.
      in: cookie
      name: gateway_session

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.