An OpenAI API key, or an AI Credential's values in JSON.
OptionalendpointURL: stringOverrides the credential's endpoint and DEFAULT_ENDPOINT.
Static ReadonlyDEFAULT_The OpenAI Decisions API endpoint.
Static ReadonlyDEFAULT_The model used when DecisionParams.Model is empty: the only model the API serves.
ProtectedapiOnly sub-classes can access the API key
ProtectedCredentialThe credential, read from the API key with ParseSystemOneCredential.
ProtectedDefaultThe model used when DecisionParams.Model is empty.
The configured Decisions API endpoint URL.
ProtectedSecretsThe secrets an error message must never show, each removed with RedactSecret. Defaults to the credential's API key; a driver that sends only part of it (Cloudflare's token) adds that part.
ProtectedServiceThe API's name in error messages, such as 'OpenRouter Decisions API'.
ProtectedBuildThe request body: { model, input, questions: [...] }. An object state is sent as JSON text,
since input takes a string or messages.
Executes a typed decision request across one or more questions about a given state. This method wraps driver execution with input validation, output verification, execution timing, and structured error handling. It never throws.
Decision request parameters including state, questions, and model.
A Promise resolving to a DecisionResult.
ProtectedDescribeThe message of the error thrown for a non-2xx response. Defaults to the status and the first 500 characters of the body.
The HTTP status.
The response body as text, possibly empty, with the API key already redacted (RedactSecret).
ProtectedDoSends the questions and maps the typed answers.
ProtectedFailMarks the result failed because the response could not be mapped. Another model may still answer, so the failure allows failover (and is not 'Fatal', which would stop the failover loop).
ProtectedGetWhat stops a call before any request, such as a credential without a part the driver needs, or undefined when nothing does. Defaults to undefined. DoDecide turns it into a failure that allows failover, since another candidate may be configured correctly.
ProtectedGetThe one endpoint, whatever the model: the model travels in the body.
ProtectedGetThe error type for a non-2xx status whose ErrorAnalyzer reading is wrong for this API, or
undefined (the default) to leave it to ErrorAnalyzer, which reads the message and the status. A
type returned here is attached to the thrown error as a Retriable error that allows failover:
another candidate may answer what this API refused.
The HTTP status.
ProtectedGetThe request headers. Defaults to the credential's API key as a bearer token and a JSON content type.
The model being asked.
ProtectedGetThe request body's model field. Defaults to the model unchanged.
The model being asked.
ProtectedResolveThe model to ask: DecisionParams.Model trimmed, or DefaultModel when it is empty.
ProtectedSendSends the request. This is the driver's only network call; a test double overrides it to stand in for the network.
The endpoint from GetEndpointURL.
The POST: method, headers, JSON body and the caller's cancellation signal.
ProtectedUnwrapTurns OpenAI's { answers: [...] } into the System One { model, answers: { name: … }, usage }.
ProtectedValidateValidates driver output DecisionResult against the requested questions.
Original decision request parameters.
Result returned by the driver.
An array of error descriptions, empty if valid.
ProtectedValidateValidates input DecisionParams against the decision contract.
Parameters to validate.
An array of error descriptions, empty if valid.
A
BaseDecisiondriver for OpenAI's Decisions API (POST https://api.openai.com/v1/decisions), which answers typed questions with GPT-6 Luna. It is in public beta, andgpt-6-lunais the only model it serves.OpenAI's wire differs from the System One format the other decision drivers share: the questions are an array whose items carry their own
name, a Likelihood is apredicate, a Choice's options arechoices: [{ value, description }], a Score's levels arelevels: [{ label, description }], and the answers come back as an array keyed bynamewith distributions as arrays. This class builds that request and turns the answers back into the System One shape, so the answer mapping, renormalisation and telemetry in BaseSystemOneDecision apply unchanged.A
refusalanswer is passed through with its type, so the base class fails the result with a type mismatch that names it, and the failure allows failover to another decision model.