| POST | /v1/decisions |
|---|
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| Model | body | string | Yes | The decision model, e.g. ~typesafe/jev-latest |
| State | body | Object | Yes | The content to evaluate: a plain string, or a JSON object or array of related context |
| Questions | body | Dictionary<string, DecisionQuestion> | Yes | Named noul (yes/no probability), choice (one option) or score (ordered scale) questions |
| SessionId | body | string | No | A unique identifier for grouping related requests |
| User | body | string | No | End-user identifier sent to OpenRouter. Omitted unless you set it. |
| Provider | body | Dictionary<string, Object> | No | OpenRouter provider routing preferences |
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| Type | form | string | Yes | noul, choice or score |
| Instructions | form | Object | Yes | What to decide: text, or a JSON object/array of guidance |
| Criteria | form | Object | No | noul: {true,false} descriptions; choice: {option: description}; score: ordered descriptions |
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| Id | form | string | No | |
| Model | form | string | Yes | |
| Provider | form | string | No | |
| Answers | form | Dictionary<string, DecisionAnswer> | Yes | Answers by question name, validated against the submitted questions |
| Usage | form | DecisionUsage | No |
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| Type | form | string | Yes | |
| Noul | form | double? | No | noul: probability from 0 (no) to 1 (yes) |
| Choice | form | string | No | choice: the selected option |
| Score | form | double? | No | score: position on the scale, 0 = first description |
| Confidence | form | double? | No | |
| Probabilities | form | Dictionary<string, double> | No | choice/score: probability of each option (score options are "0", "1", ...) |
| Legend | form | Dictionary<string, string> | No | score: description of each scale position |
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| InputTokens | form | long | No | |
| OutputTokens | form | long | No | |
| Cost | form | double? | No |
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/decisions HTTP/1.1
Host: vue-spa.web-templates.io
Accept: application/json
Content-Type: application/json
Content-Length: length
{"model":"String","state":{},"questions":{"String":{"type":"String","instructions":{},"criteria":{}}},"session_id":"String","user":"String","provider":{"String":{}}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"id":"String","model":"String","provider":"String","answers":{"String":{"type":"String","noul":0,"choice":"String","score":0,"confidence":0,"probabilities":{"String":0},"legend":{"String":"String"}}},"usage":{"input_tokens":0,"output_tokens":0,"cost":0}}