schainks
Hello everyone ![]()
I’d like to introduce SystemOneClient, an Elixir client for System One decision models: TypeSafe’s Jev, Cloudflare’s Clef, the OpenRouter decisions endpoint, and anything self-hosted that serves the same /v1/systemone wire format.
A System One model doesn’t generate text. You give it some state (any JSON) and a map of typed questions, and it returns a probability for every allowed answer:
- noul: the probability that a condition holds
- choice: a probability for each option
- score: a probability-weighted position on an ordered scale
That makes them a good fit for the decisions code usually hands to an LLM and then parses: routing, gating, classification, picking a tool (btw, you can save actual
using a System One model to do tool selection!).
Usage
questions = %{
"tool" => %{ "type" => "choice",
"instructions" => "Which action should run next to make progress on `request`?",
"criteria" => %{"add" => "Adds two numbers", "gcd" => "Greatest common divisor", "none" => "No action fits"} },
"needs_tool" => %{
"type" => "noul",
"instructions" => "Does the next step need one of the actions in `available_actions`?"
}
}
{:ok, answers, meta} =
SystemOneClient.evaluate(%{request: "gcd of 1071 and 462", available_actions: ["add", "gcd"]}, questions)
answers["tool"].probabilities #=> %{"gcd" => 0.97, "add" => 0.02, "none" => 0.01}
answers["needs_tool"].noul #=> 0.96
Answers come back as Choice, Noul and Score structs with the full probability distribution, so you can take the top-k, apply a threshold, or cut
on a confidence level yourself. Nothing is collapsed to a single pick.
Providers
One provider: option, with url: and model: always able to override:
:typesafe(default): Jev at api.typesafe.ai:cloudflare: Clef and Clef-flash on Workers AI. It builds the account-scoped URL and unwraps Cloudflare’sresultenvelope for you.:openrouter: OpenRouter’s decisions endpoint:compatible: any/v1/systemoneURL, with or without a key, for self-hosted models
What else is in it
- A
SystemOneClientbehaviour plusSystemOneClient.Stub, so your tests need no network. HTTP tests work withReq.Testthrough aplug:option. - Retries on 429, 529, 502, 503 and 504, and on transport errors, honouring
Retry-After. - Tagged error tuples at the boundary; it never raises for network conditions.
:telemetryspan[:system_one_client, :request, *]that never includes state, question text, or keys.- Depends only on
req,jasonandtelemetry. Apache 2.0, Elixir 1.18+.
Using it in Jido
The reason this library exists is a contribution that was just merged into jido_ai and will ship in its next release: a ReAct request transformer that asks a System One model, before each LLM turn, which tools the next step needs. The model then sees only those tools, or none when it can answer directly. It can optionally pick a model tier by how much reasoning the request needs. jido_ai defines a small client behaviour and adds no dependency, and SystemOneClient satisfies it as-is:
defmodule MyApp.ToolRouter do
use Jido.AI.Reasoning.ReAct.Transformers.SystemOne,
client: SystemOneClient,
client_opts: [provider: :typesafe],
top_k: 3
end
use Jido.AI.Agent, name: "support", tools: [...], request_transformer: MyApp.ToolRouter
Every tool schema rides along on every LLM turn, so this adds up. In a benchmark with a live Jido.AI.Agent, 24 tools and 30 graded tasks, gating with Jev cut input tokens per task from about 5,600 to about 900 (6.2x) at the same pass rate as Claude Haiku 4.5 with all tools, for about a third of the cost. Each decision call adds roughly 100 ms per turn. Routing between model tiers didn’t pay off on that task set, so it’s off by default. The scripts, raw results and caveats are in the experiment linked below. It’s a small, hand-built benchmark, so please measure on your own traffic before trusting thresholds.
Status
0.1.0 is on Hex. Several community TypeSafe clients appeared around Jev’s launch, and they’re worth a look too. This one’s focus is the full distributions, the offline stub, and covering Clef and self-hosted endpoints behind the same interface. Feedback, issues and provider additions are very welcome.
- Hex: system_one_client | Hex
- Docs: SystemOneClient v0.1.0 — Documentation
- jido_ai guide: Tool And Model Routing With A System One Model (in the next jido_ai release’s docs)
- Benchmarks and experiments about the money saving: jido/experiments/jev_routing at experiment/jev-tool-routing · schainks/jido · GitHub
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #ai
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
alvinkatojr
Nice! There have been a couple of Elixir clients and bindings released for System One this past month, but I believe that you are NOT late to the party.
Good work with this!
schainks
mikehostetler
Amazing work @schainks !!! Thank you so much for the PR’s and helping land this!
schainks
Thank you @mikehostetler ! Here’s to more collaboration and adventures with Jido