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

# Evaluate Decisions

> Evaluate named probability, choice, and score questions with a native decision model.

Send `state` and named `questions` to a decision model. Use `GET /v1/models?category=decision` for current availability and `GET /v1/models/{model}` for its published contract.

`state` and each question's `instructions` accept a string, JSON object, or JSON array. The endpoint returns synchronous JSON.

| Question type | Criteria                                                  | Result                                                                                                            |
| ------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `noul`        | Optional object with both `true` and `false` guidance     | `noul`, a probability from 0 to 1                                                                                 |
| `choice`      | Object of 1–255 option names mapped to guidance or `null` | `choice`, optionally `probabilities` and `confidence`                                                             |
| `score`       | Ordered array of 2–10 descriptions                        | `score` from 0 to the last index; it can be fractional, with optional `legend`, `probabilities`, and `confidence` |

The response preserves your question names under `answers`. `usage.input_tokens` and `usage.output_tokens` report observed usage when available. Pricing comes from the model's current tariff; free output does not imply zero output tokens.

Chat messages, tools, streaming, and Batch are not part of this endpoint's contract.

```bash theme={null}
curl https://api.tokenlab.sh/v1/systemone \
  -H "Authorization: Bearer $TOKENLAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jev-1.13",
    "state": "I was charged twice. Please refund the duplicate payment.",
    "questions": {
      "refund_requested": {"type": "noul", "instructions": "Is a refund requested?"},
      "department": {
        "type": "choice", "instructions": "Which team should handle this?",
        "criteria": {"billing": "Charges and refunds", "technical": "Software bugs"}
      },
      "urgency": {
        "type": "score", "instructions": "Rate urgency",
        "criteria": ["Routine enquiry", "Money affected", "Safety emergency"]
      }
    }
  }'
```

The HTTP request is also usable with standard `fetch` or `requests` clients. A decision response is structured data, not a generated text explanation.


## OpenAPI

````yaml openapi.json POST /v1/systemone
openapi: 3.1.0
info:
  title: TokenLab AI Gateway
  description: >-
    Organization balance, API key management, and key-level usage/billing via
    management token
  version: 1.0.0
  termsOfService: https://tokenlab.sh/tos
  contact:
    name: Technical Support
    email: support@tokenlab.sh
servers:
  - url: https://api.tokenlab.sh
    description: Production server
security:
  - BearerAuth: []
tags:
  - name: Chat
    description: Chat completions API (OpenAI-compatible)
  - name: Responses
    description: OpenAI Responses API-compatible native endpoints
  - name: Embeddings
    description: Text embeddings API
  - name: Images
    description: Image generation API
  - name: Audio
    description: Audio processing API (TTS & STT)
  - name: Video
    description: Video generation API
  - name: Models
    description: Available models listing
  - name: Anthropic
    description: Anthropic-compatible Messages API
  - name: Gemini
    description: Google Gemini-compatible API
  - name: Management
    description: >-
      Organization API key management and key-level usage/billing via management
      token
  - name: Files
    description: Batch file upload and retrieval
  - name: Batches
    description: OpenAI-compatible asynchronous batch jobs
  - name: Seedance Volc Compatible
    description: Seedance 2.0 Volc-style compatibility endpoints
  - name: Decisions
  - name: Webhooks
    description: >-
      Workspace webhook management with Management Tokens (mt-...). Inference
      API keys do not grant management access.
paths:
  /v1/systemone:
    post:
      tags:
        - Decisions
      summary: Evaluate decision questions
      description: >-
        Evaluate state with named probability, choice, and ordered score
        questions. Synchronous JSON only. Token usage is reported when
        available; zero-priced output tokens are still included.
      operationId: createSystemOneDecision
      parameters:
        - $ref: '#/components/parameters/DeliveryPolicy'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - state
                - questions
              properties:
                model:
                  type: string
                  minLength: 1
                state:
                  oneOf:
                    - type: string
                    - type: object
                      additionalProperties: true
                    - type: array
                      items: {}
                questions:
                  type: object
                  minProperties: 1
                  additionalProperties:
                    oneOf:
                      - type: object
                        required:
                          - type
                          - instructions
                        properties:
                          type:
                            type: string
                            enum:
                              - noul
                          instructions:
                            oneOf:
                              - type: string
                              - type: object
                                additionalProperties: true
                              - type: array
                                items: {}
                          criteria:
                            type: object
                            properties:
                              'true':
                                oneOf:
                                  - type: string
                                  - type: object
                                    additionalProperties: true
                                  - type: array
                                    items: {}
                              'false':
                                oneOf:
                                  - type: string
                                  - type: object
                                    additionalProperties: true
                                  - type: array
                                    items: {}
                            required:
                              - 'true'
                              - 'false'
                            additionalProperties: false
                        additionalProperties: false
                      - type: object
                        required:
                          - type
                          - instructions
                          - criteria
                        properties:
                          type:
                            type: string
                            enum:
                              - choice
                          instructions:
                            oneOf:
                              - type: string
                              - type: object
                                additionalProperties: true
                              - type: array
                                items: {}
                          criteria:
                            type: object
                            minProperties: 1
                            maxProperties: 255
                            additionalProperties:
                              oneOf:
                                - type: string
                                - type: object
                                  additionalProperties: true
                                - type: array
                                  items: {}
                                - type: 'null'
                        additionalProperties: false
                      - type: object
                        required:
                          - type
                          - instructions
                          - criteria
                        properties:
                          type:
                            type: string
                            enum:
                              - score
                          instructions:
                            oneOf:
                              - type: string
                              - type: object
                                additionalProperties: true
                              - type: array
                                items: {}
                          criteria:
                            type: array
                            minItems: 2
                            maxItems: 10
                            items:
                              oneOf:
                                - type: string
                                - type: object
                                  additionalProperties: true
                                - type: array
                                  items: {}
                        additionalProperties: false
              additionalProperties: false
      responses:
        '200':
          description: Decision results
          content:
            application/json:
              schema:
                type: object
                required:
                  - model
                  - answers
                properties:
                  id:
                    type: string
                  model:
                    type: string
                  answers:
                    type: object
                    additionalProperties:
                      oneOf:
                        - type: object
                          required:
                            - type
                            - noul
                          properties:
                            type:
                              type: string
                              enum:
                                - noul
                            noul:
                              type: number
                              minimum: 0
                              maximum: 1
                          additionalProperties: false
                        - type: object
                          required:
                            - type
                            - choice
                          properties:
                            type:
                              type: string
                              enum:
                                - choice
                            choice:
                              type: string
                            probabilities:
                              type: object
                              additionalProperties:
                                type: number
                                minimum: 0
                                maximum: 1
                            confidence:
                              type: number
                              minimum: 0
                              maximum: 1
                          additionalProperties: false
                        - type: object
                          required:
                            - type
                            - score
                          properties:
                            type:
                              type: string
                              enum:
                                - score
                            score:
                              type: number
                              minimum: 0
                            probabilities:
                              type: object
                              additionalProperties:
                                type: number
                                minimum: 0
                                maximum: 1
                            confidence:
                              type: number
                              minimum: 0
                              maximum: 1
                            legend:
                              type: object
                              additionalProperties:
                                oneOf:
                                  - type: string
                                  - type: object
                                    additionalProperties: true
                                  - type: array
                                    items: {}
                          additionalProperties: false
                  usage:
                    type: object
                    required:
                      - input_tokens
                      - output_tokens
                    properties:
                      input_tokens:
                        type: integer
                        minimum: 0
                      output_tokens:
                        type: integer
                        minimum: 0
                    additionalProperties: false
                additionalProperties: true
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          $ref: '#/components/responses/DeliveryUnavailable'
components:
  parameters:
    DeliveryPolicy:
      name: X-TokenLab-Delivery-Policy
      in: header
      required: false
      description: >-
        Per-request Delivery policy. Overrides the API key and Workspace
        defaults. Auto tries TokenLab Verified first and may switch once to
        Official only before output, upstream acceptance, or persistent resource
        creation.
      schema:
        type: string
        enum:
          - auto
          - verified
          - official
  responses:
    BadRequest:
      description: Bad Request - Invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
          example:
            error:
              message: 'model: Model is required'
              type: invalid_request_error
              param: model
            validation_errors:
              - field: model
                message: Model is required
    Unauthorized:
      description: Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              message: Invalid API key provided
              type: invalid_api_key
    DeliveryUnavailable:
      description: >-
        No eligible Delivery route is currently available, or all eligible
        routes failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            requestedTierUnavailable:
              summary: The requested Delivery tier has no eligible route
              value:
                error:
                  message: >-
                    The requested Delivery tier is temporarily unavailable for
                    model gpt-5.4.
                  type: all_channels_failed
                  code: delivery_tier_unavailable
                  retryable: true
                  request_id: req_01JEXAMPLE
            eligibleRoutesFailed:
              summary: All eligible Delivery routes failed
              value:
                error:
                  message: All available routes failed to process the request.
                  type: all_channels_failed
                  retryable: true
                  request_id: req_01JEXAMPLE
  schemas:
    ValidationError:
      allOf:
        - $ref: '#/components/schemas/ApiError'
        - type: object
          properties:
            validation_errors:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
                  code:
                    type: string
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Error message
            type:
              type: string
              description: Error type
              enum:
                - unauthorized
                - invalid_api_key
                - expired_api_key
                - permission_error
                - insufficient_balance
                - quota_exceeded
                - invalid_request_error
                - model_not_found
                - context_length_exceeded
                - unsupported_tool_choice
                - rate_limit_exceeded
                - server_error
                - upstream_error
                - all_channels_failed
                - timeout_error
                - not_found_error
                - no_contract_compatible_route
                - request_shape_channel_mismatch
                - upstream_contract_mismatch
                - platform_normalization_error
                - async_task_not_found
                - async_task_mapping_invalid
                - delivery_tier_unavailable
            code:
              type: string
              description: Error code
            param:
              type: string
              description: Parameter that caused the error
            model:
              type: string
              description: Model associated with the error
            did_you_mean:
              type: string
            suggestions:
              type: array
              items:
                type: object
                required:
                  - id
                properties:
                  id:
                    type: string
                additionalProperties: true
            alternatives:
              type: array
              items:
                type: object
                required:
                  - id
                  - status
                  - tags
                properties:
                  id:
                    type: string
                  status:
                    type: string
                  tags:
                    type: array
                    items:
                      type: string
                additionalProperties: true
            hint:
              type: string
            retry_after:
              type: number
            retryable:
              type: boolean
            balance_usd:
              type: number
            estimated_cost_usd:
              type: number
            supported_operations:
              type: array
              items:
                type: string
            supported_parameters:
              type: array
              items:
                type: string
            required_selectors:
              type: array
              items:
                type: string
            optional_selectors:
              type: array
              items:
                type: string
            allowed_resolutions:
              type: array
              items:
                type: string
            allowed_durations:
              type: array
              items:
                type: string
            allowed_aspect_ratios:
              type: array
              items:
                type: string
            prompt_max_characters:
              type: number
            recommended_request:
              type: object
              additionalProperties: true
            request_endpoint:
              type:
                - string
                - 'null'
            request_shape_mode:
              type:
                - string
                - 'null'
            status_mode:
              type:
                - string
                - 'null'
            request_id:
              type: string
          required:
            - message
            - type
          additionalProperties: true
      additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        API Key authentication. Create or manage API keys in [Dashboard > API >
        API Keys](https://tokenlab.sh/dashboard/api?tab=keys).

````