The bearer token, empty for an open server, or an AI Credential's values in JSON
({"apiKey":"…","endpoint":"https://…"}).
OptionalbaseURL: stringOverrides the credential's endpoint and SYSTEMONE_BASE_URL.
Static ReadonlyBASE_The environment variable the base URL is read from when neither the constructor nor the credential gives one.
Static ReadonlyDEFAULT_The model used when DecisionParams.Model is empty.
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 URL requests go to, ending in /v1/systemone; undefined when no base URL is configured.
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, state, questions }.
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.
ProtectedDescribeNames the server's own message when the body has one: Kev's server (FastAPI) sends detail, as a
string or a list of { msg }; llama.cpp sends error.message. Otherwise the start of the body.
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).
ProtectedGetNo base URL stops the call before any request, naming the ways to give one. It is a
NoCredentials error that allows failover: another candidate may be configured, and the type does
not exclude this vendor's other models, each of which may have its own endpoint bound.
ProtectedGetThe URL the request is POSTed to.
The model being asked: DecisionParams.Model, or DefaultModel when that is empty.
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 token as a bearer token when there is one; no Authorization header when there is none.
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.
ProtectedUnwrapReturns the System One response ({ model, answers, usage }) from a parsed 2xx body. Defaults to
the body itself. A vendor that wraps the response in an envelope unwraps it here, and throws
(with CreateSystemOneHTTPError) when the envelope reports a failure.
The parsed JSON body.
The HTTP status, for an error thrown from here.
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 any server that speaks TypeSafe's System One API,POST {base}/v1/systemone:modal deploy kev_serve.pydeployment athttps://<workspace>--kev-api.modal.run(one deployment serves one Kev size);llama-serverwith a decision model, such asllama-server -hf ggml-org/Kev-4B-GGUF, on any machine, VM or Hugging Face Inference Endpoint;The wire mapping comes from BaseSystemOneDecision. These servers return the response bare.
Endpoint. The base URL comes from the constructor, else the credential's
endpoint(anAPI Key with EndpointAI Credential), else theSYSTEMONE_BASE_URLenvironment variable./v1/systemoneis appended unless the URL already ends with it (a URL ending in/v1gets/systemone). With no base URL the call fails before any request.Token. Optional. With an API key the request carries
Authorization: Bearer <key>; with none it carries no Authorization header, because a localllama-serveror Kev server is open by default.Model. The body's
modelisDecisionParams.Model, the model-vendor row'sAPIName, defaulting tokev-latest. Kev's server acceptskev-latestandjev-latest.Timeouts. The driver sets none of its own: a Kev deployment that scaled to zero takes 35 to 55 seconds to start. The caller's cancellation and timeout apply.