---
title: "Generate decisions"
method: POST
path: "/api/experimental/generate/decisions"
tags: ["generate"]
---

# Generate decisions

`POST /api/experimental/generate/decisions`

## Request

- Base URL: `https://opencode.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://opencode.ai/api/experimental/generate/decisions`
- Auth: none required

Ask a decision model typed predicate, choice and score questions about the input and return one probability-bearing answer per question, in question order. Stateless: nothing is stored.

## Request body

- GenerateDecisionRequest
  - `model` ModelRef, required
    - `id` string, required
    - `providerID` string, required
    - `variant` string
  - `input` GenerateDecisionPart[], required: The evidence every question is asked about, in order
    - union
      - GenerateDecisionTextPart
        - `type` 'text', required
        - `text` string, required
      - GenerateDecisionJsonPart
        - `type` 'json', required
        - `value` unknown, required
      - GenerateDecisionFilePart
        - `type` 'file', required
        - `data` string, required
        - `mime` string, required
        - `name` string
  - `questions` GenerateDecisionQuestion[], required: Question names must be unique; duplicates fail with InvalidRequestError
    - union
      - GeneratePredicateQuestion: The probability that a statement is true
        - `type` 'predicate', required
        - `name` string, required: Unique within the request; echoed on the matching answer
        - `instructions` string, required
      - GenerateChoiceQuestion: Pick one value from a fixed set
        - `type` 'choice', required
        - `name` string, required: Unique within the request; echoed on the matching answer
        - `instructions` string, required
        - `choices` object[], required
          - `value` union, required: Choice values are typed: true and "true" are different values
            - string
            - boolean
          - `description` string
      - GenerateScoreQuestion: Place the input on ordered levels, lowest first
        - `type` 'score', required
        - `name` string, required: Unique within the request; echoed on the matching answer
        - `instructions` string, required
        - `levels` object[], required
          - `label` string, required
          - `description` string

## Response `200`

GenerateDecisionsResponse

- GenerateDecisionsResponse
  - `data` GenerateDecisionResult, required
    - `answers` GenerateDecisionAnswer[], required: One answer per question, in question order
      - union
        - GeneratePredicateAnswer
          - `type` 'predicate', required
          - `name` string, required
          - `probability` number, required
        - GenerateChoiceAnswer
          - `type` 'choice', required
          - `name` string, required
          - `choice` union, required: Choice values are typed: true and "true" are different values
            - string
            - boolean
          - `probabilities` object[], required
            - `value` union, required: Choice values are typed: true and "true" are different values
              - …
            - `probability` number, required
          - `confidence` number, required
        - GenerateScoreAnswer
          - `type` 'score', required
          - `name` string, required
          - `score` number, required: Probability-weighted level index, so it can fall between levels
          - `probabilities` object[], required
            - `value` integer, required
            - `label` string, required
            - `probability` number, required
          - `confidence` number, required
        - GenerateErrorAnswer: This one question has no answer; the other answers still came back
          - `type` 'error', required
          - `name` string, required
          - `reason` string, required: Why the question has no answer, for example refusal
          - `message` string
    - `cost` number
    - `tokens` GenerateUsage: Token counts, when the provider reports them
      - `input` number
      - `output` number
    - `native` GenerateNative1: Provider-specific data the shared fields do not cover

## Other responses

- `400`: InvalidRequestError
- `401`: UnauthorizedError
- `404`: ProviderNotFoundError | ModelNotFoundError | LocationNotFoundError
- `422`: UnsupportedModelError
- `502`: ProviderRequestError
- `503`: ServiceUnavailableError

## Changes

> 50 revisions in range; 1 not diffed.

- **2026-10-27** `d6d739fceba2`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kaaass/apis/opencode/changes/api/experimental/generate/decisions/post.md)

---

[API](https://skmtc.dev/kaaass/apis/opencode.md) - [All operations](https://skmtc.dev/kaaass/apis/opencode/llms.txt) - [OpenAPI document](https://skmtc.dev/kaaass/apis/opencode/revisions/4e083d954707?raw)
