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

# OpenAI Decisions

> OpenAI Decisions 兼容接口。题型与 TypeSafe 对应关系：

- `predicate` ↔ `noul`
- `choice` ↔ `choice`
- `score` ↔ `score`

可用 OpenAI SDK `client.decisions.create`，`base_url=https://api.omniall.ai/v1`
（需 openai Python ≥ 3.26.0 或 JS ≥ 7.30.0）。


## 题型说明

| `type` | 额外字段 | 答案字段 |
| - | - | - |
| `predicate` | — | `probability` |
| `choice` | `choices`（2–255） | `choice`、`probabilities[]`、`confidence` |
| `score` | `levels`（2–10） | `score`、`probabilities[]`、`confidence` |

请求体只认 `model`、`input`、`questions`（带其它字段会被拒绝）。任一题可能单独返回 `type: refusal`，其它题仍正常作答。

接入指南：[TypeSafe Jev API](https://docs.omniall.ai/zh-CN/typesafe-jev-api.md)。


## OpenAPI

````yaml zh-CN/openapi/typesafe-jev.yaml POST /v1/decisions
openapi: 3.1.0
info:
  title: Omniall AI — TypeSafe Jev（System One）
  version: 1.14.0
  description: |
    Omniall AI 上的 TypeSafe Jev System One 判定接口。

    Jev **不生成文字**：传入内容（`state` / `input`）与一组带类型的问题，直接返回每题答案与概率（以及置信度）。

    **两种调用方式：**

    - TypeSafe 官方：`POST /typesafe/v1/systemone`
    - OpenAI Decisions：`POST /v1/decisions`

    **模型：** `jev-1.14.0`、`jev-preview`（当前预览别名）、`jev-latest`。

    **Host：** `https://api.omniall.ai` · 鉴权 `Authorization: Bearer sk-...`

    可选预览请求头：

    - `TypeSafe-Danger-Zone-Images: true` — 官方接口允许图片
    - `TypeSafe-Danger-Zone-Long-Context: true` — 上下文上限提升至 262k tokens
servers:
  - url: https://api.omniall.ai
security: []
tags:
  - name: TypeSafe System One
    description: TypeSafe 官方 System One 格式
  - name: OpenAI Decisions
    description: OpenAI Decisions 兼容格式
paths:
  /v1/decisions:
    post:
      tags:
        - OpenAI Decisions
      summary: OpenAI Decisions
      description: >
        OpenAI Decisions 兼容接口。题型与 TypeSafe 对应关系：


        - `predicate` ↔ `noul`

        - `choice` ↔ `choice`

        - `score` ↔ `score`


        可用 OpenAI SDK
        `client.decisions.create`，`base_url=https://api.omniall.ai/v1`

        （需 openai Python ≥ 3.26.0 或 JS ≥ 7.30.0）。
      operationId: createDecision
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - name: TypeSafe-Danger-Zone-Long-Context
          in: header
          required: false
          schema:
            type: string
            enum:
              - 'true'
          description: 预览功能 — 上下文上限提升至 262k tokens。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenAIDecisionsRequest'
            examples:
              complaint:
                summary: 投诉路由
                value:
                  model: jev-1.14.0
                  input: I was charged twice for my order.
                  questions:
                    - type: choice
                      name: department
                      instructions: Which department should handle this complaint?
                      choices:
                        - value: billing
                          description: Payments, invoices, and refunds.
                        - value: technical
                          description: Problems using the product.
                        - value: other
                          description: Requests outside these categories.
                    - type: predicate
                      name: refund_requested
                      instructions: Is the customer asking for money back?
                    - type: score
                      name: severity
                      instructions: How severe is this issue?
                      levels:
                        - label: Cosmetic
                          description: Appearance only; no lost functionality.
                        - label: Workaround available
                          description: A task fails, but another way works.
                        - label: Fully blocked
                          description: A task fails with no workaround.
      responses:
        '200':
          description: 按请求顺序返回答案
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIDecisionsResponse'
              examples:
                complaint:
                  value:
                    model: jev-1.14.0
                    answers:
                      - type: choice
                        name: department
                        choice: billing
                        probabilities:
                          - value: billing
                            probability: 0.95
                          - value: technical
                            probability: 0.03
                          - value: other
                            probability: 0.02
                        confidence: 0.93
                      - type: predicate
                        name: refund_requested
                        probability: 0.91
                      - type: score
                        name: severity
                        score: 1.1
                        probabilities:
                          - value: 0
                            label: Cosmetic
                            probability: 0.1
                          - value: 1
                            label: Workaround available
                            probability: 0.7
                          - value: 2
                            label: Fully blocked
                            probability: 0.2
                        confidence: 0.55
                    usage:
                      input_tokens: 142
                      output_tokens: 0
                      total_tokens: 142
        '400':
          $ref: '#/components/responses/OpenAIError'
        '401':
          $ref: '#/components/responses/OpenAIError'
        '404':
          $ref: '#/components/responses/OpenAIError'
        '429':
          $ref: '#/components/responses/OpenAIError'
components:
  parameters:
    Authorization:
      name: Authorization
      in: header
      required: true
      schema:
        type: string
        example: Bearer sk-...
      description: Bearer API key, e.g. `Bearer sk-...`.
  schemas:
    OpenAIDecisionsRequest:
      type: object
      required:
        - model
        - input
        - questions
      additionalProperties: false
      properties:
        model:
          type: string
          example: jev-1.14.0
        input:
          description: Shared input — plain string or user-message array.
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                required:
                  - role
                  - content
                properties:
                  role:
                    type: string
                    enum:
                      - user
                  content:
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - input_text
                                - input_image
                            text:
                              type: string
                            image_url:
                              type: string
                              description: HTTPS URL or base64 data URL (PNG/JPEG).
        questions:
          type: array
          minItems: 1
          maxItems: 200
          items:
            $ref: '#/components/schemas/OpenAIDecisionsQuestion'
    OpenAIDecisionsResponse:
      type: object
      properties:
        model:
          type: string
        answers:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/OpenAIPredicateAnswer'
              - $ref: '#/components/schemas/OpenAIChoiceAnswer'
              - $ref: '#/components/schemas/OpenAIScoreAnswer'
              - $ref: '#/components/schemas/OpenAIRefusalAnswer'
        usage:
          type: object
          properties:
            input_tokens:
              type: integer
            output_tokens:
              type: integer
            total_tokens:
              type: integer
    OpenAIDecisionsQuestion:
      type: object
      required:
        - type
        - instructions
      properties:
        type:
          type: string
          enum:
            - predicate
            - choice
            - score
        name:
          type: string
          nullable: true
          description: Optional id echoed in the answer. Must be unique within the request.
        instructions:
          type: string
        choices:
          type: array
          description: Required for `choice` (2–255 options).
          minItems: 2
          maxItems: 255
          items:
            type: object
            required:
              - value
            properties:
              value:
                oneOf:
                  - type: string
                  - type: boolean
              description:
                type: string
        levels:
          type: array
          description: Required for `score` (2–10 ordered levels; score index from 0).
          minItems: 2
          maxItems: 10
          items:
            type: object
            required:
              - label
            properties:
              label:
                type: string
              description:
                type: string
    OpenAIPredicateAnswer:
      type: object
      properties:
        type:
          type: string
          enum:
            - predicate
        name:
          type: string
          nullable: true
        probability:
          type: number
          minimum: 0
          maximum: 1
    OpenAIChoiceAnswer:
      type: object
      properties:
        type:
          type: string
          enum:
            - choice
        name:
          type: string
          nullable: true
        choice:
          oneOf:
            - type: string
            - type: boolean
        probabilities:
          type: array
          items:
            type: object
            properties:
              value:
                oneOf:
                  - type: string
                  - type: boolean
              probability:
                type: number
        confidence:
          type: number
    OpenAIScoreAnswer:
      type: object
      properties:
        type:
          type: string
          enum:
            - score
        name:
          type: string
          nullable: true
        score:
          type: number
        probabilities:
          type: array
          items:
            type: object
            properties:
              value:
                type: integer
              label:
                type: string
              probability:
                type: number
        confidence:
          type: number
    OpenAIRefusalAnswer:
      type: object
      properties:
        type:
          type: string
          enum:
            - refusal
        name:
          type: string
          nullable: true
  responses:
    OpenAIError:
      description: OpenAI-style error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  message:
                    type: string
                  type:
                    type: string
                  code:
                    type: string
                    nullable: true

````

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