# POST /v1/decide

> POST /v1/decide reference: request fields, question objects, the answer for each question type, response headers, compressed and multipart bodies.

Section: API reference. Web page: https://www.launchables.ai/docs/api/decide

```
POST https://api.launchables.ai/v1/decide
```

Answers one or more questions about one situation. Needs a [bearer token](https://www.launchables.ai/docs/authentication) and a JSON body with a `Content-Length` header (see [Request bodies](https://www.launchables.ai/docs/api/decide#request-bodies) for compressed and multipart bodies). This endpoint serves the Myles-G models. The CPU models (Myles-400M, 150M and 22M) are not called over HTTP; see [Model types](https://www.launchables.ai/docs/model-types). There is no text-generation endpoint.

## Request body

| Field | Type | Meaning |
|---|---|---|
| `state` | text or JSON | The situation to decide about. JSON is passed to the model as indented JSON. See [Writing the state](https://www.launchables.ai/docs/state). |
| `questions` | object | One or more questions, each under a name you choose (up to 16). Each answer comes back under the same name. |
| `assets` | object, optional | Images for the model to read (Myles-G 12B and Myles-G 31B), each under a reference you then write in the state, the instructions or the criteria descriptions. See [Images](https://www.launchables.ai/docs/api/images). |
| `image_budget` | number, optional | The most input tokens one image may use: `70`, `140` or `280` (the default). Lower is cheaper and faster but sees less detail. See [Image budget](https://www.launchables.ai/docs/api/images#image-budget). |
| `model` | text, optional | A model id from [`GET /v1/models`](https://www.launchables.ai/docs/api/models). Leave it out for the endpoint's default (`myles-g-12b` on `api.launchables.ai`). An endpoint that serves one model ignores it; the response's `model` says which model answered. |

## Question object

| Field | Type | Meaning |
|---|---|---|
| `type` | text | `noul`, `choice` or `score`. |
| `instructions` | text | The question, in plain language. `null` is read as no instructions. |
| `criteria` | object or list | For `choice`: labels mapped to descriptions, or a list of labels. For `score`: level descriptions, lowest first. Optional for `noul`: what `true` and `false` mean (or `yes` and `no`), both sides given. A description may be `null`: the option is then shown by its name (Yes or No, the label, or "Level 2"). Up to 26 options. |

## Response

| Field | Meaning |
|---|---|
| `model` | The model that answered. |
| `answers` | One answer per question name. `noul`: the probability of yes; uncertain answers are committed, at least 0.80 towards the chosen side. `choice`: `choice`, `confidence` and `probabilities`. `score`: `level`, `score`, `confidence`, `legend` and `probabilities`. See [Question types](https://www.launchables.ai/docs/question-types). |
| `usage` | `input_tokens` and `output_tokens` for the request. Images count as input tokens (see [Billing](https://www.launchables.ai/docs/api/images#billing)). Hosted pricing counts input tokens only. |

## Example

```bash
curl https://api.launchables.ai/v1/decide \
  -H "Authorization: Bearer $LAUNCHABLES_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "state": "Charged twice for order 4471, need the extra payment back",
    "questions": {
      "route": {"type": "choice", "instructions": "Which team?", "criteria": ["billing", "returns", "technical", "other"]}
    }
  }'
```

```json
{
  "model": "myles-g-12b",
  "answers": {
    "route": {
      "type": "choice",
      "choice": "billing",
      "confidence": 0.89,
      "probabilities": { "billing": 0.93, "returns": 0.04, "technical": 0.01, "other": 0.02 }
    }
  },
  "usage": { "input_tokens": 118, "output_tokens": 1 }
}
```

Illustrative probabilities and token counts. The response is one JSON object, sent when every question is answered; there is no streaming. To send an image with the request, see [Images](https://www.launchables.ai/docs/api/images).

## Response headers

| Header | Meaning |
|---|---|
| `X-Request-Id` | An id for this call, on every response (errors included). Quote it to support. |
| `Launchables-Key-Id`, `Launchables-Key-Expires` | The calling key's id and expiry date, so a program can plan key rotation. See [Authentication](https://www.launchables.ai/docs/authentication). |
| `Retry-After` | On `429` and `503`: the seconds to wait before trying again. |

## Request bodies

- **Size:** up to 32 MiB as sent, and 32 MiB once decompressed.
- **Compression:** send `Content-Encoding: gzip` or `Content-Encoding: zstd` with a compressed body. Any other encoding returns `415`.
- **Multipart:** a `multipart/form-data` body is accepted when its first part is named `request` and holds the JSON body. File parts carry images, named from `assets`; see [Images](https://www.launchables.ai/docs/api/images).

## Compatibility

The API works with existing decision-model clients:

- `POST /v1/systemone` accepts the same request and returns the same response as `POST /v1/decide`. On that path a `model` the endpoint does not serve is answered by the default model.
- Criteria given as an object with `null` descriptions, for example `{"true": null, "false": null}` or `{"approve": null, "reject": null}`, are read by option name.
- `choice` and `score` answers carry `confidence`, and `score` answers carry `legend`, beside the fields described above. Clients that ignore fields they do not know see no change.
- Compressed (`gzip`, `zstd`) and `multipart/form-data` bodies are accepted, as above.
- `GET /v1/models` lists the models both as `data` and as `models`.
- An image opt-in header that some clients send is accepted and not required.
