> ## 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.

# Evaluate classification and scoring questions

> Evaluate one input against predicate, choice and score questions. Answers follow question order and may include per-question refusals. Use a provider-qualified decision model or a compatible routing alias with a project-scoped Aixy API key. Native decision requests preserve provider extensions. Aixy translates compatible decision formats; an image or extension that cannot be represented returns an explicit compatibility error. Conversation-only models are not converted to decision models. Streaming and output-token caps are unsupported. Hard budgets reject public decisions with hard_budget_decision_unbounded because no enforced completion bound is available. Decision content is processed transiently and is excluded from Activity content capture.



## OpenAPI

````yaml /openapi.json post /v1/decisions
openapi: 3.1.0
info:
  title: Aixy Inference 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. Create connections, API keys and policies in the Aixy
    dashboard. The management API is a dashboard service and is not a public
    integration contract. Native provider features depend on the selected model
    and connection; translated requests support the documented conversation and
    function-tool subset. Unsupported combinations return explicit errors.
    Examples use illustrative model IDs; select an ID available to your project.
servers:
  - url: https://api.aixy-gateway.com
    description: Aixy production gateway
security: []
tags:
  - name: OpenAI
    description: OpenAI-compatible conversations, function tools and incremental streams.
  - name: Anthropic
    description: Anthropic-compatible messages and provider-native input token counting.
  - name: Decisions
    description: Typed, non-streaming classification and scoring inference.
  - name: Models
    description: Discover the models available to your project API key.
paths:
  /v1/decisions:
    post:
      tags:
        - Decisions
      summary: Evaluate classification and scoring questions
      description: >-
        Evaluate one input against predicate, choice and score questions.
        Answers follow question order and may include per-question refusals. Use
        a provider-qualified decision model or a compatible routing alias with a
        project-scoped Aixy API key. Native decision requests preserve provider
        extensions. Aixy translates compatible decision formats; an image or
        extension that cannot be represented returns an explicit compatibility
        error. Conversation-only models are not converted to decision models.
        Streaming and output-token caps are unsupported. Hard budgets reject
        public decisions with hard_budget_decision_unbounded because no enforced
        completion bound is available. Decision content is processed transiently
        and is excluded from Activity content capture.
      operationId: create_decision
      parameters:
        - $ref: '#/components/parameters/XRequestId'
        - $ref: '#/components/parameters/XAixyClient'
        - $ref: '#/components/parameters/XAixySession'
        - $ref: '#/components/parameters/XAixySessionId'
        - $ref: '#/components/parameters/XProvider'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DecisionRequest'
            examples:
              basic:
                summary: Basic request
                value:
                  model: openai/gpt-6-luna
                  input: The package arrived with a broken screen.
                  questions:
                    - type: predicate
                      name: damaged
                      instructions: Does the customer report a damaged item?
      responses:
        '200':
          description: Structured decision answers.
          headers:
            x-request-id:
              description: >-
                Aixy request identifier for correlation with Activity and
                support.
              schema:
                type: string
              example: req_example_01
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DecisionResponse'
              example:
                answers:
                  - type: predicate
                    name: damaged
                    probability: 0.98
        '400':
          $ref: '#/components/responses/GatewayError'
        '401':
          $ref: '#/components/responses/GatewayError'
        '403':
          $ref: '#/components/responses/GatewayError'
        '404':
          $ref: '#/components/responses/GatewayError'
        '408':
          $ref: '#/components/responses/GatewayError'
        '413':
          $ref: '#/components/responses/GatewayError'
        '422':
          $ref: '#/components/responses/GatewayError'
        '424':
          $ref: '#/components/responses/GatewayError'
        '429':
          $ref: '#/components/responses/OpenAIRateLimitError'
        '500':
          $ref: '#/components/responses/InferenceInternalError'
        '502':
          $ref: '#/components/responses/GatewayError'
        '503':
          $ref: '#/components/responses/GatewayError'
        '504':
          $ref: '#/components/responses/GatewayError'
        default:
          $ref: '#/components/responses/NativeProviderError'
      security:
        - GatewayApiKey: []
components:
  parameters:
    XRequestId:
      name: X-Request-ID
      in: header
      required: false
      description: Optional caller-generated request identifier for end-to-end tracing.
      schema:
        type: string
        maxLength: 255
    XAixyClient:
      name: X-Aixy-Client
      in: header
      required: false
      description: >-
        Optional application[/version] for Activity attribution. Overrides
        User-Agent detection. Use a product name, not personal data or
        credentials. Names are 1-64 ASCII letters, digits, spaces, dots,
        underscores or hyphens, starting with a letter or digit. Optional
        versions start with a digit and use up to 32 letters, digits, dots,
        underscores, plus signs or hyphens. Invalid values are ignored. This
        self-declared label grants no permissions and is not forwarded.
      schema:
        type: string
        maxLength: 97
        example: Acme Support/1.2.3
    XAixySession:
      name: X-Aixy-Session
      in: header
      required: false
      description: >-
        Optional opaque session identifier for virtual routes with session
        affinity. Scoped to the authenticated caller and alias; never forwarded
        or recorded. Send full conversation history. Invalid values return 400
        when affinity is enabled. Omission retains the route's normal strategy.
      schema:
        type: string
        minLength: 1
        maxLength: 128
        pattern: ^[A-Za-z0-9._:-]+$
        example: conversation-82
    XAixySessionId:
      name: X-Aixy-Session-ID
      in: header
      required: false
      description: >-
        Optional opaque conversation identifier recorded in Activity metadata.
        Reuse it for every call in a conversation. Sessions are isolated by
        organization, project, user and API key. Use no personal data or
        secrets. Invalid values are ignored. The header is not forwarded, grants
        no permissions and does not change routing affinity.
      schema:
        type: string
        minLength: 1
        maxLength: 128
        pattern: ^[A-Za-z0-9._:-]+$
        example: conversation-82
    XProvider:
      name: X-Provider
      in: header
      required: false
      description: >-
        Select a configured provider without changing an unqualified model
        identifier. A provider-qualified model is preferred for new
        integrations.
      schema:
        type: string
  schemas:
    DecisionRequest:
      type: object
      required:
        - model
        - input
        - questions
      not:
        anyOf:
          - required:
              - max_tokens
          - required:
              - max_output_tokens
          - required:
              - max_completion_tokens
      properties:
        model:
          type: string
          minLength: 1
          maxLength: 1048576
          description: Provider-qualified decision model or compatible Aixy routing alias.
        input:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/DecisionInputMessage'
          description: >-
            Evidence evaluated for every question. Only user messages containing
            text and images are accepted. At most 128 images per request; image
            input requires a matching native Decisions provider.
        questions:
          type: array
          minItems: 1
          maxItems: 200
          items:
            oneOf:
              - $ref: '#/components/schemas/DecisionPredicateQuestion'
              - $ref: '#/components/schemas/DecisionChoiceQuestion'
              - $ref: '#/components/schemas/DecisionScoreQuestion'
        safety_identifier:
          type:
            - string
            - 'null'
          maxLength: 128
        stream:
          type: boolean
          const: false
          default: false
      additionalProperties: true
    DecisionResponse:
      type: object
      required:
        - answers
      properties:
        model:
          type: string
        answers:
          type: array
          description: One answer per question, in request order.
          items:
            oneOf:
              - $ref: '#/components/schemas/DecisionPredicateAnswer'
              - $ref: '#/components/schemas/DecisionChoiceAnswer'
              - $ref: '#/components/schemas/DecisionScoreAnswer'
              - $ref: '#/components/schemas/DecisionRefusalAnswer'
        usage:
          $ref: '#/components/schemas/DecisionUsage'
      additionalProperties: true
    DecisionInputMessage:
      type: object
      required:
        - role
        - content
      properties:
        type:
          type: string
          const: message
        role:
          type: string
          const: user
        content:
          oneOf:
            - type: string
            - type: array
              items:
                oneOf:
                  - $ref: '#/components/schemas/DecisionInputText'
                  - $ref: '#/components/schemas/DecisionInputImage'
      additionalProperties: true
    DecisionPredicateQuestion:
      type: object
      required:
        - type
        - instructions
      properties:
        type:
          type: string
          const: predicate
        name:
          type:
            - string
            - 'null'
          maxLength: 1048576
        instructions:
          type: string
          maxLength: 1048576
      additionalProperties: true
    DecisionChoiceQuestion:
      type: object
      required:
        - type
        - instructions
        - choices
      properties:
        type:
          type: string
          const: choice
        name:
          type:
            - string
            - 'null'
          maxLength: 1048576
        instructions:
          type: string
          maxLength: 1048576
        choices:
          type: array
          minItems: 2
          maxItems: 255
          description: >-
            Options must have unique typed values. Boolean true and string true
            are distinct options.
          items:
            $ref: '#/components/schemas/DecisionChoiceOption'
      additionalProperties: true
    DecisionScoreQuestion:
      type: object
      required:
        - type
        - instructions
        - levels
      properties:
        type:
          type: string
          const: score
        name:
          type:
            - string
            - 'null'
          maxLength: 1048576
        instructions:
          type: string
          maxLength: 1048576
        levels:
          type: array
          minItems: 2
          maxItems: 255
          items:
            $ref: '#/components/schemas/DecisionScoreLevel'
      additionalProperties: true
    DecisionPredicateAnswer:
      type: object
      required:
        - type
        - probability
      properties:
        type:
          type: string
          const: predicate
        name:
          type:
            - string
            - 'null'
        probability:
          type: number
          minimum: 0
          maximum: 1
      additionalProperties: true
    DecisionChoiceAnswer:
      type: object
      required:
        - type
        - choice
      properties:
        type:
          type: string
          const: choice
        name:
          type:
            - string
            - 'null'
        choice:
          type:
            - string
            - boolean
        confidence:
          type: number
          minimum: 0
          maximum: 1
        probabilities:
          type: array
          items:
            type: object
            required:
              - value
              - probability
            properties:
              value:
                type:
                  - string
                  - boolean
              probability:
                type: number
                minimum: 0
                maximum: 1
      additionalProperties: true
    DecisionScoreAnswer:
      type: object
      required:
        - type
        - score
      properties:
        type:
          type: string
          const: score
        name:
          type:
            - string
            - 'null'
        score:
          type: number
          minimum: 0
        confidence:
          type: number
          minimum: 0
          maximum: 1
        probabilities:
          type: array
          items:
            type: object
            required:
              - label
              - value
              - probability
            properties:
              label:
                type: string
              value:
                type: integer
                minimum: 0
              probability:
                type: number
                minimum: 0
                maximum: 1
      additionalProperties: true
    DecisionRefusalAnswer:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          const: refusal
        name:
          type:
            - string
            - 'null'
      additionalProperties: true
    DecisionUsage:
      type: object
      properties:
        input_tokens:
          type: integer
          minimum: 0
        output_tokens:
          type: integer
          minimum: 0
        total_tokens:
          type: integer
          minimum: 0
        input_tokens_details:
          type: object
          additionalProperties: true
        output_tokens_details:
          type: object
          additionalProperties: true
      additionalProperties: true
    InferenceErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            message:
              type: string
            code:
              type:
                - string
                - 'null'
            type:
              type:
                - string
                - 'null'
            param:
              type:
                - string
                - integer
                - 'null'
            details:
              type:
                - object
                - 'null'
              additionalProperties: true
          additionalProperties: true
        type:
          type: string
        request_id:
          type: string
      additionalProperties: true
    AnthropicErrorResponse:
      type: object
      required:
        - type
        - error
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
            message:
              type: string
          additionalProperties: true
        request_id:
          type: string
      additionalProperties: true
    DecisionInputText:
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          const: input_text
        text:
          type: string
      additionalProperties: true
    DecisionInputImage:
      type: object
      required:
        - type
        - image_url
      properties:
        type:
          type: string
          const: input_image
        image_url:
          type: string
          description: A data URL or public HTTP(S) image URL. File IDs are unsupported.
        detail:
          type:
            - string
            - 'null'
          enum:
            - low
            - high
            - auto
            - original
            - null
      additionalProperties: true
    DecisionChoiceOption:
      type: object
      required:
        - value
      properties:
        value:
          type:
            - string
            - boolean
        description:
          type:
            - string
            - 'null'
          maxLength: 1048576
      additionalProperties: true
    DecisionScoreLevel:
      type: object
      required:
        - label
      properties:
        label:
          type: string
          maxLength: 1048576
        description:
          type:
            - string
            - 'null'
          maxLength: 1048576
      additionalProperties: true
  responses:
    GatewayError:
      description: >-
        The gateway or upstream provider rejected the request. Gateway codes
        identify invalid_request or unsupported_feature (400),
        invalid_gateway_api_key (401), access or policy denials (403),
        unavailable models (404), request deadlines (408/504), body limits
        (413), hard-budget admission failures (424), and upstream or gateway
        availability failures (502/503). Native provider error details may
        differ.
      headers:
        x-request-id:
          description: Aixy request identifier for correlation with Activity and support.
          schema:
            type: string
          example: req_example_01
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InferenceErrorResponse'
          example:
            error:
              code: invalid_gateway_api_key
              message: Gateway API key is invalid or revoked
    OpenAIRateLimitError:
      description: >-
        Aixy or the OpenAI-compatible provider rejected the request because of a
        rate limit.
      headers:
        x-request-id:
          description: Aixy request identifier for correlation with Activity and support.
          schema:
            type: string
          example: req_example_01
        Retry-After:
          description: >-
            Optional retry delay. Aixy rate-limit rejections provide a positive
            delay in seconds; a provider may supply its own Retry-After value,
            including an HTTP date.
          required: false
          schema:
            type: string
          example: '60'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InferenceErrorResponse'
          example:
            error:
              code: gateway_rate_limit_exceeded
              message: The configured rate limit was reached. Retry later.
    InferenceInternalError:
      description: >-
        An internal failure occurred. Some failures return a generic text
        response; record x-request-id and avoid relying on a JSON body for every
        server error.
      headers:
        x-request-id:
          description: Aixy request identifier for correlation with Activity and support.
          schema:
            type: string
          example: req_example_01
      content:
        text/plain:
          schema:
            type: string
          example: Internal Server Error
        application/json:
          schema:
            anyOf:
              - $ref: '#/components/schemas/InferenceErrorResponse'
              - $ref: '#/components/schemas/AnthropicErrorResponse'
    NativeProviderError:
      description: >-
        A native provider may return another error status and its original
        payload. After streaming starts, failures can arrive inside the SSE
        stream instead of changing the HTTP status. Handle both HTTP errors and
        protocol error events.
      headers:
        x-request-id:
          description: Aixy request identifier for correlation with Activity and support.
          schema:
            type: string
          example: req_example_01
      content:
        application/json:
          schema:
            type: object
            additionalProperties: true
  securitySchemes:
    GatewayApiKey:
      type: http
      scheme: bearer
      bearerFormat: gak_…
      description: >-
        A project-scoped Aixy API key. Create keys in the dashboard and send the
        secret as a Bearer token.

````

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