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

# Run decisions

> Score fixed outcomes for each decision against one shared context. Inspect each result's probabilities and policy before acting, and check the returned model and fallback details. Scores are normalized across the outcomes you supply; they are not a guarantee that the selected outcome is correct.

Reuse an Idempotency-Key and identical body after a lost response. The original operation is replayed without executing or charging again. Responses are retained for 24 hours; afterward the same key returns an expired-response error.

The response example is a historical pilot recording from 26 September 2026; its model, timing and probabilities describe that run.



## OpenAPI

````yaml /openapi.json post /v1/decide
openapi: 3.1.0
info:
  title: DecisionOne workbench
  description: >-
    Native decisions, immutable datasets, adaptation and shared-base deployment.
    Authenticate with `Authorization: Bearer d1_sk_...` when accounts are on. A
    short guide for coding agents is at /llms.txt. Hosted account APIs accept a
    Bearer API key or a browser session. Browser mutations require the
    configured Origin and X-CSRF-Token from /auth/session. Account recovery and
    history remain available to blocked accounts. Waitlisted accounts can read
    their account summary and model catalogue and request early access; private
    member APIs require admission. Money fields ending in _usd are exact decimal
    strings; never interpret them as integer cents. Authenticated customer reads
    and existing-operation replays share read_rpm. Exhausted budgets return 429
    with Retry-After; unavailable admission storage returns 503.
  version: 0.1.0
servers:
  - url: https://console.sqwish.ai
security: []
tags:
  - name: Decisions
    description: Probabilities for questions with fixed outcomes.
  - name: Feedback
    description: Report outcomes and turn them into training data.
  - name: Models
    description: Base models, adapters and named models with versions.
  - name: Datasets
    description: Validated training examples. A dataset never changes.
  - name: Fine-tuning
    description: Training jobs, their events and held-out results.
  - name: Prompt tuning
    description: Better wording for a decision, tested on your rows. Words, not weights.
  - name: Labeling
    description: Teacher labels for real queries, reviewed by you.
  - name: Accounts
    description: Email OTP sign-in, revocable sessions, security and API keys.
  - name: Billing
    description: Exact USD balances, purchases, automatic top-ups and referrals.
  - name: Integrations
    description: Endpoints other tools call, such as Claude Code.
  - name: System
    description: Health and discovery.
paths:
  /v1/decide:
    post:
      tags:
        - Decisions
      summary: Run decisions
      description: >-
        Score fixed outcomes for each decision against one shared context.
        Inspect each result's probabilities and policy before acting, and check
        the returned model and fallback details. Scores are normalized across
        the outcomes you supply; they are not a guarantee that the selected
        outcome is correct.


        Reuse an Idempotency-Key and identical body after a lost response. The
        original operation is replayed without executing or charging again.
        Responses are retained for 24 hours; afterward the same key returns an
        expired-response error.


        The response example is a historical pilot recording from 26 September
        2026; its model, timing and probabilities describe that run.
      operationId: decide
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            minLength: 1
            maxLength: 255
            pattern: ^[!-~]+$
          description: >-
            Reuse the same key and body after a lost response. A successful
            replay does not execute or charge again. Changed request bodies
            conflict; expired replay bodies are not executed again under the old
            key.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DecideRequest'
            examples:
              support-triage:
                summary: Route a support ticket
                description: >-
                  The 200 example is the real answer, recorded on 26 September
                  2026.
                value:
                  model: sqwish-d1-core
                  context: >-
                    Our billing export has failed for two days. We need it for
                    today's audit.
                  decisions:
                    - id: team
                      kind: single
                      question: Which team should handle this ticket?
                      outcomes:
                        billing: Charges, invoices, and financial exports.
                        technical: Other application failures.
                        sales: New purchases.
                    - id: urgent
                      kind: binary
                      question: Does the ticket state a deadline within one day?
                      outcomes:
                        'yes': >-
                          An explicit deadline is today or within the next 24
                          hours.
                        'no': The deadline is later, absent, or unclear.
                    - id: impact
                      kind: ordinal
                      question: >-
                        How severe is the reported impact on the customer's
                        work?
                      outcomes:
                        - '0'
                        - '1'
                        - '2'
                      rubric:
                        - Minor inconvenience; the task can still be completed.
                        - >-
                          The task is impaired, but a workable alternative is
                          stated.
                        - >-
                          An important task is blocked and no workable
                          alternative is stated.
        required: true
      responses:
        '200':
          description: One probability distribution for each decision.
          content:
            application/json:
              schema:
                properties:
                  id:
                    type: string
                    title: Id
                  model:
                    type: string
                    title: Model
                  decisions:
                    additionalProperties:
                      $ref: '#/components/schemas/DecisionResult'
                    title: Decisions
                    type: object
                  render:
                    $ref: '#/components/schemas/Render'
                  usage:
                    $ref: '#/components/schemas/DecisionUsage'
                  timing_ms:
                    $ref: '#/components/schemas/Timing'
                  provenance:
                    $ref: '#/components/schemas/Provenance'
                  version:
                    title: Version
                    type: string
                  fallback:
                    $ref: '#/components/schemas/Fallback'
                  charge:
                    $ref: '#/components/schemas/Charge'
                required:
                  - id
                  - model
                  - decisions
                  - render
                  - usage
                  - timing_ms
                title: DecideResponse
                type: object
              example:
                id: dec_963b7180cbd24e69a09870f8
                model: sqwish-d1-core
                decisions:
                  team:
                    kind: single
                    probabilities:
                      billing: 0.9268172836638902
                      technical: 0.05394723671050278
                      sales: 0.019235479625606948
                    top: billing
                    p_top: 0.9268172836638902
                    margin: 0.8728700469533874
                    entropy: 0.3039487736089271
                    action: billing
                    abstained: false
                  urgent:
                    kind: binary
                    probabilities:
                      'yes': 0.9124361664296878
                      'no': 0.08756383357031215
                    top: 'yes'
                    p_top: 0.9124361664296878
                    margin: 0.8248723328593757
                    entropy: 0.2968648920244629
                    p_yes: 0.9124361664296878
                    action: 'yes'
                    abstained: false
                  impact:
                    kind: ordinal
                    probabilities:
                      '0': 0.05066966056527368
                      '1': 0.105604641144301
                      '2': 0.8437256982904253
                    top: '2'
                    p_top: 0.8437256982904253
                    margin: 0.7381210571461243
                    entropy: 0.5318959230835276
                    expected_level: 1.7930560377251517
                    legend:
                      '0': Minor inconvenience; the task can still be completed.
                      '1': >-
                        The task is impaired, but a workable alternative is
                        stated.
                      '2': >-
                        An important task is blocked and no workable alternative
                        is stated.
                    median_level: '2'
                    action: '2'
                    abstained: false
                render:
                  layout: idea061
                  reads: 2
                  independent: false
                usage:
                  input_tokens: 648
                  decisions: 3
                timing_ms:
                  render: 3.829091787338257
                  score: 221.20973281562328
                provenance:
                  base_model: Qwen/Qwen3.5-9B
                  base_revision: c202236235762e1c871ad0ccb60c8ee5ba337b9a
                  base_id: d1-core-pilot-640
                  base_artifact_sha256: >-
                    65fadf0bf136811e06198a7dd97ee47559d63f2fdafb64a9ec48306ba53f2333
                  compute_dtype: float16
                  serving_artifact_sha256: null
                  serving_master_artifact_sha256: null
                  serving_execution_artifact_sha256: null
                  engine_dtype: float16
                  engine_quantization: null
                  adapter: null
                  artifact_sha256: null
                  probabilities: conditional_on_declared_outcomes
                  calibration: not_established
        4XX:
          description: >-
            Client error. On a 422, `error.details` lists each field that
            failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: Server error. A 503 names what is not running on this server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    DecideRequest:
      properties:
        model:
          anyOf:
            - type: string
              maxLength: 128
              minLength: 1
            - type: 'null'
          title: Model
        context:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - items: {}
              type: array
          title: Context
        decisions:
          items:
            $ref: '#/components/schemas/Decision'
          type: array
          maxItems: 64
          minItems: 1
          title: Decisions
        independent:
          type: boolean
          title: Independent
          default: false
        store:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Store
        metadata:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Metadata
        fallback:
          anyOf:
            - type: string
              enum:
                - auto
                - none
            - items:
                type: string
              type: array
            - type: 'null'
          title: Fallback
      additionalProperties: false
      type: object
      required:
        - context
        - decisions
      title: DecideRequest
    DecisionResult:
      properties:
        kind:
          type: string
          enum:
            - single
            - binary
            - ordinal
          title: Kind
        probabilities:
          additionalProperties:
            type: number
          type: object
          title: Probabilities
          description: >-
            Scores normalized over the declared outcomes; not calibrated
            correctness.
        top:
          type: string
          title: Top
        p_top:
          type: number
          title: P Top
        margin:
          type: number
          title: Margin
        entropy:
          type: number
          title: Entropy
        action:
          type: string
          title: Action
          description: The policy's action, or abstain when deferred.
        abstained:
          type: boolean
          title: Abstained
        abstain_reason:
          type: string
          enum:
            - min_probability
            - cost
          title: Abstain Reason
        policy_probabilities:
          additionalProperties:
            type: number
          type: object
          title: Policy Probabilities
        p_yes:
          type: number
          title: P Yes
        expected_level:
          type: number
          title: Expected Level
        median_level:
          type: string
          title: Median Level
        legend:
          additionalProperties: true
          type: object
          title: Legend
        expected_costs:
          additionalProperties:
            type: number
          type: object
          title: Expected Costs
        expected_cost:
          type: number
          title: Expected Cost
      type: object
      required:
        - kind
        - probabilities
        - top
        - p_top
        - margin
        - entropy
        - action
        - abstained
      title: DecisionResult
    Render:
      properties:
        layout:
          type: string
          title: Layout
        reads:
          type: integer
          title: Reads
        independent:
          type: boolean
          title: Independent
      type: object
      required:
        - layout
        - reads
        - independent
      title: Render
    DecisionUsage:
      properties:
        input_tokens:
          type: integer
          title: Input Tokens
        decisions:
          type: integer
          title: Decisions
        tokenizer:
          $ref: '#/components/schemas/Tokenizer'
      type: object
      required:
        - input_tokens
        - decisions
      title: DecisionUsage
    Timing:
      properties:
        render:
          type: number
          title: Render
        score:
          type: number
          title: Score
        load:
          type: number
          title: Load
      type: object
      required:
        - render
        - score
      title: Timing
    Provenance:
      properties:
        serving_artifact_sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Serving Artifact Sha256
        serving_master_artifact_sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Serving Master Artifact Sha256
        serving_execution_artifact_sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Serving Execution Artifact Sha256
        engine_dtype:
          type: string
          title: Engine Dtype
        engine_quantization:
          anyOf:
            - type: string
            - type: 'null'
          title: Engine Quantization
        base_model:
          type: string
          title: Base Model
        base_revision:
          type: string
          title: Base Revision
        base_id:
          type: string
          title: Base Id
        base_artifact_sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Base Artifact Sha256
        compute_dtype:
          type: string
          title: Compute Dtype
        adapter:
          anyOf:
            - type: string
            - type: 'null'
          title: Adapter
        weights_sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Weights Sha256
        adapter_bundle_sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Adapter Bundle Sha256
        artifact_sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Artifact Sha256
        probabilities:
          type: string
          const: conditional_on_declared_outcomes
          title: Probabilities
        calibration:
          type: string
          const: not_established
          title: Calibration
        compatibility_confidence:
          type: string
          title: Compatibility Confidence
      type: object
      title: Provenance
    Fallback:
      properties:
        from:
          type: string
          title: From
        to:
          type: string
          title: To
        reason:
          type: string
          title: Reason
      type: object
      required:
        - from
        - to
        - reason
      title: Fallback
    Charge:
      properties:
        currency:
          type: string
          const: USD
          title: Currency
        amount_usd:
          type: string
          title: Amount Usd
        reserved_usd:
          type: string
          title: Reserved Usd
        operation_id:
          type: string
          title: Operation Id
      type: object
      required:
        - currency
        - amount_usd
        - reserved_usd
        - operation_id
      title: Charge
    ErrorResponse:
      description: >-
        The body of every error. app.failure() builds it; this model documents
        it.
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      required:
        - error
      title: ErrorResponse
      type: object
    Decision:
      properties:
        id:
          type: string
          maxLength: 128
          minLength: 1
          title: Id
        question:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - items: {}
              type: array
          title: Question
        kind:
          type: string
          enum:
            - single
            - binary
            - ordinal
          title: Kind
          default: single
        outcomes:
          title: Outcomes
        rubric:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Rubric
        weights:
          anyOf:
            - additionalProperties:
                type: number
              type: object
            - type: 'null'
          title: Weights
        costs:
          anyOf:
            - additionalProperties:
                additionalProperties:
                  type: number
                type: object
              type: object
            - type: 'null'
          title: Costs
        abstain:
          anyOf:
            - $ref: '#/components/schemas/Abstain'
            - type: 'null'
      additionalProperties: false
      type: object
      required:
        - id
        - question
      title: Decision
    Tokenizer:
      properties:
        name:
          type: string
          title: Name
        revision:
          type: string
          title: Revision
      type: object
      required:
        - name
        - revision
      title: Tokenizer
    ErrorBody:
      properties:
        code:
          description: A stable code to branch on, such as invalid_request.
          title: Code
          type: string
        message:
          description: What went wrong and what to change, in plain words.
          title: Message
          type: string
        retryable:
          description: >-
            True when another attempt may succeed; it does not prove that no
            work was done. Respect Retry-After when present. Only operations
            that support Idempotency-Key replay a prior result, including
            /v1/decide for 24 hours.
          title: Retryable
          type: boolean
        request_id:
          description: Also sent as X-Request-ID. Quote it in bug reports.
          title: Request Id
          type: string
        details:
          anyOf:
            - items:
                $ref: '#/components/schemas/ErrorDetail'
              type: array
            - type: 'null'
          default: null
          description: On validation errors, one entry for each field that failed.
          title: Details
      required:
        - code
        - message
        - retryable
        - request_id
      title: ErrorBody
      type: object
    Abstain:
      properties:
        min_probability:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Min Probability
        cost:
          anyOf:
            - type: number
            - type: 'null'
          title: Cost
      additionalProperties: false
      type: object
      title: Abstain
    ErrorDetail:
      properties:
        path:
          description: Where the problem is, such as ["body", "decisions", 0, "outcomes"].
          items:
            anyOf:
              - type: string
              - type: integer
          title: Path
          type: array
        message:
          title: Message
          type: string
        type:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Type
      required:
        - path
        - message
      title: ErrorDetail
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: d1_sk_...
      description: Create an API key in the console. Required when accounts are enabled.

````