# OpenAI Decisions


Loads the bundled offline spec (`fastdecisions/specs/openai.json`) for `POST /v1/decisions` and registers `openai_provider` (`OPENAI_API_KEY`, default model `gpt-6-luna`). [`prep_openai_input`](#prep_openai_input) converts `Msg` histories into Decisions message and tool items, wraps structured dicts or lists in `input_json` parts, forwards `detail` on `input_image` parts, and strips `Thinking`, `Msg.raw`, and server-executed `ToolUse(server=True)` together with matching `ToolResult` items. Non-image media raise `ValueError`.

Translates [`noul`](types.html#noul) questions to `predicate` (folding optional `true`/`false` criteria into `instructions`), raises `NotImplementedError` on [`box`](types.html#box) questions, rejects duplicate or missing answer names with `ValueError`, and maps per-question refusals to [`RefusalAnswer`](types.html#refusalanswer).

## prep_openai_input

``` python
def prep_openai_input(
    state, # String, JSON dict/list, `Msg`, `list[Msg]`, `Part`, or `list[Part]`
    detail:str=None, # Optional OpenAI image detail level (e.g. `'low'`, `'high'`, `'auto'`)
):
```

*Convert canonical `state` into an OpenAI Decisions `input` string or item list.*
