ruby_decision_model
Ruby client with standard-library transport for TypeSafe and OpenRouter decision endpoints.
# ruby_decision_model
The decision-model interface for Ruby. Decision models answer typed questions
about a state with calibrated probabilities instead of generating text. This gem
talks to them through one `Client` with a provider behind it. OpenRouter is the
default. Typesafe (Jev), OpenAI (gpt-6-luna), Cloudflare (Clef), Perplexity
(pplx-decider), and Databricks (`ai_decide`) each have a native provider, and
any server that speaks the System One API (Ollama, strands-decider, the
autojev server) works through `:system_one`. Your questions and answers keep
one shape whichever provider serves them. No runtime dependencies beyond the
standard library.
## Install
```ruby
gem "ruby_decision_model"
```
## Quick start
```ruby
require "ruby_decision_model"
client = RubyDecisionModel::Client.new
response = client.ask(
state: { title: "Server returns 500 on checkout", reporter: "support" },
questions: {
"urgent" => RubyDecisionModel::Questions.noul("Is this urgent?"),
"severity" => RubyDecisionModel::Questions.score(
"How severe is this issue?",
criteria: ["cosmetic", "minor", "major", "critical"]
)
}
)
response["urgent"].noul # => 0.87
response["severity"].score # => 2.4
response.usage.input_tokens # => 120
```
`Client.new` with no arguments reads the environment.
`RUBY_DECISION_MODEL_PROVIDER` names a provider outright (`openai`,
`cloudflare`, and so on, in any case, with `-` or `_`), and an `api_key:` passed without `provider:` goes
to that provider. Without it, `TYPESAFE_API_KEY` selects Typesafe,
then `OPENROUTER_API_KEY` selects OpenRouter, then `SYSTEM_ONE_BASE_URL`
selects a System One server. General-purpose credentials such as
`OPENAI_API_KEY` or `CLOUDFLARE_API_TOKEN` never pick a provider on their own,
since plenty o