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

# Create System One Decision

> Ask typed questions about a piece of content in TypeSafe's System One format. Images go in `assets`, as JSON or as multipart form parts.

<RequestExample>
  ```bash cURL theme={"dark"}
  curl https://router.requesty.ai/v1/systemone \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
    -d '{
      "model": "openai/gpt-6-luna",
      "state": "The dragon heist in this fantasy novel had me hooked, but the ending dragged a little.",
      "questions": {
        "positive": {
          "type": "noul",
          "instructions": "The review is positive."
        },
        "genre": {
          "type": "choice",
          "instructions": "Which genre is the book?",
          "criteria": {
            "fantasy": "Magic, myth or invented worlds",
            "mystery": "A crime or puzzle to solve",
            "romance": "A love story"
          }
        },
        "rating": {
          "type": "score",
          "instructions": "How much did the reviewer enjoy the book?",
          "criteria": ["Hated it", "Disliked it", "Neutral", "Liked it", "Loved it"]
        }
      }
    }'
  ```

  ```python Python theme={"dark"}
  import httpx

  response = httpx.post(
      "https://router.requesty.ai/v1/systemone",
      headers={"Authorization": "Bearer YOUR_REQUESTY_API_KEY"},
      json={
          "model": "openai/gpt-6-luna",
          "state": "The dragon heist in this fantasy novel had me hooked, but the ending dragged a little.",
          "questions": {
              "positive": {"type": "noul", "instructions": "The review is positive."},
          },
      },
  )

  answer = response.json()["answers"]["positive"]
  if answer["type"] == "refusal":
      print("The model declined to answer")
  else:
      print(answer["noul"])
  ```

  ```typescript TypeScript theme={"dark"}
  const response = await fetch("https://router.requesty.ai/v1/systemone", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.REQUESTY_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "openai/gpt-6-luna",
      state: "The dragon heist in this fantasy novel had me hooked, but the ending dragged a little.",
      questions: {
        positive: { type: "noul", instructions: "The review is positive." },
      },
    }),
  });

  const { answers } = await response.json();
  const answer = answers.positive;
  console.log(answer.type === "refusal" ? "The model declined to answer" : answer.noul);
  ```
</RequestExample>

<ResponseExample>
  ```json Response 200 theme={"dark"}
  {
    "answers": {
      "genre": {
        "type": "choice",
        "choice": "fantasy",
        "confidence": 1,
        "probabilities": {
          "fantasy": 1,
          "mystery": 0,
          "romance": 0
        }
      },
      "positive": {
        "type": "noul",
        "noul": 0.73
      },
      "rating": {
        "type": "score",
        "score": 3.1,
        "confidence": 0.87,
        "probabilities": [
          { "value": 0, "probability": 0.01 },
          { "value": 1, "probability": 0 },
          { "value": 2, "probability": 0 },
          { "value": 3, "probability": 0.86 },
          { "value": 4, "probability": 0.13 }
        ]
      }
    },
    "id": "rqsty-dcsn-15e2efde-f7c6-49cb-92ae-c763b1b16193",
    "model": "gpt-6-luna",
    "provider": "openai",
    "usage": {
      "input_tokens": 424,
      "output_tokens": 0
    }
  }
  ```

  ```json Refusal theme={"dark"}
  {
    "answers": {
      "positive": {
        "type": "refusal"
      }
    },
    "id": "rqsty-dcsn-75924058-d3b3-471a-b19c-4e003550bcc7",
    "model": "gpt-6-luna",
    "provider": "openai",
    "usage": {
      "input_tokens": 5,
      "output_tokens": 0
    }
  }
  ```
</ResponseExample>

Ask typed questions about a piece of content and get a calibrated answer for each one. The request and response follow TypeSafe's System One format. `model` needs its provider prefix, for example `typesafe/jev-1.13.0` or `cloudflare/clef`. List the available models with [`/v1/models/decision`](/api-reference/endpoint/models-decision-list). See [Decisions](/features/decisions) for the question types.

Every answer has a `type`. A model can decline a question and return `{"type": "refusal"}` for it, so check `type` before reading the value. See OpenAI's [Decisions guide](https://developers.openai.com/api/docs/guides/decisions).

Responses are not streamed. To put images directly inside `state`, use [`/v1/decisions`](/api-reference/endpoint/decisions-create).

## Images

Models that accept images, such as `cloudflare/clef` and `openai/gpt-6-luna`, also look at images. Send each image in `assets` under a name you choose, and mention that name in `state` so the model knows which image it refers to. `typesafe` models reject assets that `state` does not reference. Images inside `state` are rejected on this endpoint.

### JSON

Each asset carries its `format` and the base64-encoded image bytes in `data_base64`, without a `data:` prefix.

```bash theme={"dark"}
curl https://router.requesty.ai/v1/systemone \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
  -d '{
    "model": "openai/gpt-6-luna",
    "state": "Listing title: Red leather armchair. Photo: listing_photo",
    "assets": {
      "listing_photo": {
        "type": "image",
        "format": "jpeg",
        "data_base64": "/9j/4AAQSkZJRgABAQAAAQABAAD..."
      }
    },
    "questions": {
      "matches_title": {
        "type": "noul",
        "instructions": "The photo shows the item in the title."
      },
      "color": {
        "type": "choice",
        "instructions": "What is the main colour in the photo?",
        "criteria": {
          "red": "Red",
          "green": "Green",
          "blue": "Blue"
        }
      }
    }
  }'
```

### Multipart

Upload image files without base64-encoding them by sending a `multipart/form-data` request, the format TypeSafe's SDKs use. Put the JSON request in a part named `request`, and point each asset at the part that holds its file with `part`. Image parts need an `image/*` content type.

```bash theme={"dark"}
curl https://router.requesty.ai/v1/systemone \
  -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
  -F 'request={"model":"openai/gpt-6-luna","state":"Listing title: Red leather armchair. Photo: listing_photo","assets":{"listing_photo":{"type":"image","part":"photo"}},"questions":{"matches_title":{"type":"noul","instructions":"The photo shows the item in the title."}}};type=application/json' \
  -F 'photo=@armchair.jpg;type=image/jpeg'
```

Both forms return the same response:

```json theme={"dark"}
{
  "answers": {
    "color": {
      "type": "choice",
      "choice": "red",
      "confidence": 0.99,
      "probabilities": {
        "blue": 0,
        "green": 0.01,
        "red": 0.99
      }
    },
    "matches_title": {
      "type": "noul",
      "noul": 0.52
    }
  },
  "id": "rqsty-dcsn-b57050ea-7298-4d59-a0b0-ffc87db60fe8",
  "model": "gpt-6-luna",
  "provider": "openai",
  "usage": {
    "input_tokens": 287,
    "output_tokens": 0
  }
}
```


## OpenAPI

````yaml POST /v1/systemone
openapi: 3.0.3
info:
  title: Requesty Inference API
  description: >-
    Requesty Inference API for AI model routing. OpenAI-compatible endpoints for
    chat completions, embeddings, images, audio, and more.
  version: 1.0.0
servers:
  - url: https://router.requesty.ai
    description: Inference router endpoint
security:
  - BearerAuth: []
paths:
  /v1/systemone:
    servers:
      - url: https://router.requesty.ai
        description: Inference router endpoint
    post:
      summary: Create System One decision
      description: >-
        Ask typed questions about a piece of content in TypeSafe's System One
        format. Images go in `assets`, as JSON or as multipart form parts.
      operationId: createSystemOneDecision
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SystemOneRequest'
            example:
              model: openai/gpt-6-luna
              state: >-
                The dragon heist in this fantasy novel had me hooked, but the
                ending dragged a little.
              questions:
                positive:
                  type: noul
                  instructions: The review is positive.
                genre:
                  type: choice
                  instructions: Which genre is the book?
                  criteria:
                    fantasy: Magic, myth or invented worlds
                    mystery: A crime or puzzle to solve
                    romance: A love story
                rating:
                  type: score
                  instructions: How much did the reviewer enjoy the book?
                  criteria:
                    - Hated it
                    - Disliked it
                    - Neutral
                    - Liked it
                    - Loved it
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/SystemOneMultipartRequest'
      responses:
        '200':
          description: Decision response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DecisionResponse'
              example:
                answers:
                  genre:
                    type: choice
                    choice: fantasy
                    confidence: 1
                    probabilities:
                      fantasy: 1
                      mystery: 0
                      romance: 0
                  positive:
                    type: noul
                    noul: 0.73
                  rating:
                    type: score
                    score: 3.1
                    confidence: 0.87
                    probabilities:
                      - value: 0
                        probability: 0.01
                      - value: 1
                        probability: 0
                      - value: 2
                        probability: 0
                      - value: 3
                        probability: 0.86
                      - value: 4
                        probability: 0.13
                id: rqsty-dcsn-15e2efde-f7c6-49cb-92ae-c763b1b16193
                model: gpt-6-luna
                provider: openai
                usage:
                  input_tokens: 424
                  output_tokens: 0
        '400':
          description: >-
            Bad request - malformed payload, invalid parameters, or images
            inside `state`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - missing or empty Authorization header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Payment required - organization balance exhausted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden - invalid token or model not in access list.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found - provider/model not supported.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          description: Payload too large - the state exceeds the model's context window.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded. Retry after the Retry-After header value.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Bad gateway - upstream provider returned an invalid response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SystemOneRequest:
      type: object
      required:
        - model
        - state
        - questions
      properties:
        model:
          type: string
          description: >-
            A decision model ID from
            [`/v1/models/decision`](/api-reference/endpoint/models-decision-list).
          example: openai/gpt-6-luna
        state:
          description: >-
            The content to evaluate: a string, an object or an array. Mention
            each asset's name in `state` so the model knows which image it
            refers to; `typesafe` models reject assets that `state` does not
            reference.
        questions:
          type: object
          description: Map of question ID to question. Each ID gets one entry in `answers`.
          additionalProperties:
            $ref: '#/components/schemas/DecisionQuestion'
        assets:
          type: object
          description: >-
            Map of asset name to image. Only for models that accept images, such
            as `cloudflare/clef` and `openai/gpt-6-luna`.
          additionalProperties:
            $ref: '#/components/schemas/DecisionImageAsset'
      description: >-
        Request body for `POST /v1/systemone`, in TypeSafe's System One format.
        Images go in `assets`; images inside `state` are rejected on this
        endpoint.
    SystemOneMultipartRequest:
      type: object
      required:
        - request
      description: >-
        Multipart form of `POST /v1/systemone`, as sent by TypeSafe's SDKs. The
        `request` part holds the JSON request; each asset names the part that
        carries its image bytes as `{"type": "image", "part": "<part name>"}`.
        Every other part is an image file with an `image/*` content type.
      properties:
        request:
          type: string
          description: >-
            The request as JSON, with `assets` entries that reference image
            parts by name.
          example: >-
            {"model":"openai/gpt-6-luna","state":"Listing title: Red leather
            armchair. Photo:
            listing_photo","questions":{"matches_title":{"type":"noul","instructions":"The
            photo listing_photo shows the item in the
            title."}},"assets":{"listing_photo":{"type":"image","part":"photo"}}}
      additionalProperties:
        type: string
        format: binary
    DecisionResponse:
      type: object
      required:
        - answers
        - model
        - usage
      properties:
        answers:
          type: object
          description: One answer per question ID.
          additionalProperties:
            $ref: '#/components/schemas/DecisionAnswer'
        id:
          type: string
          example: rqsty-dcsn-15e2efde-f7c6-49cb-92ae-c763b1b16193
        model:
          type: string
          description: The upstream model name.
          example: gpt-6-luna
        provider:
          type: string
          example: openai
        usage:
          $ref: '#/components/schemas/DecisionUsage'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - origin
            - message
          properties:
            origin:
              type: string
              enum:
                - router
                - provider
              description: >-
                Whether the error originated from Requesty's router or an
                upstream provider.
            message:
              type: string
              description: Human-readable error description.
    DecisionQuestion:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - noul
            - choice
            - score
          description: >-
            `noul`: yes/no, answered with a probability. `choice`: pick one
            option from `criteria`. `score`: a position on the ordered scale in
            `criteria`.
        instructions:
          description: What to ask about the state. Usually a string.
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        criteria:
          description: >-
            For `choice`: an object mapping each option to its description. For
            `score`: a list of labels from lowest to highest. Not used by
            `noul`.
          oneOf:
            - type: object
              additionalProperties:
                type: string
                nullable: true
            - type: array
              items:
                type: string
    DecisionImageAsset:
      type: object
      required:
        - type
        - format
        - data_base64
      description: An image sent in `assets` on `POST /v1/systemone`.
      properties:
        type:
          type: string
          enum:
            - image
          description: Always `image`.
        format:
          type: string
          description: Image format without the `image/` prefix.
          example: jpeg
        data_base64:
          type: string
          description: Base64-encoded image bytes, without a `data:` prefix.
          example: /9j/4AAQSkZJRgABAQAAAQABAAD...
    DecisionAnswer:
      type: object
      required:
        - type
      description: >-
        Answer to one question. Check `type` first: a model can return `refusal`
        instead of answering.
      properties:
        type:
          type: string
          enum:
            - noul
            - choice
            - score
            - refusal
        noul:
          type: number
          description: '`noul` only. Probability between 0 and 1 that the statement is true.'
        choice:
          type: string
          description: '`choice` only. The most likely option.'
        score:
          type: number
          description: >-
            `score` only. Probability-weighted average of the zero-based label
            indices, so it can be fractional.
        confidence:
          type: number
          description: >-
            `choice` and `score` only. Confidence in the answer, between 0 and
            1.
        probabilities:
          description: >-
            `choice` and `score` only. Probability per option (`choice`) or per
            label index (`score`). Depending on the model, score probabilities
            are an object keyed by index or a list of `{value, probability}`.
          oneOf:
            - type: object
              additionalProperties:
                type: number
            - type: array
              items:
                type: object
                properties:
                  value:
                    type: integer
                  probability:
                    type: number
        legend:
          type: object
          additionalProperties:
            type: string
          description: '`score` only, on some models. Maps each label index to its label.'
    DecisionUsage:
      type: object
      required:
        - input_tokens
        - output_tokens
      properties:
        input_tokens:
          type: integer
        output_tokens:
          type: integer
          description: Can be 0.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key for authentication

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.