Skip to content

pydecide

Python client that sends one Choice/Score/Noul request down a fallback chain of hosted and local decision models with confidence gates.

LibrarybetaMIT

Overview

pydecide (imported as decide) is an unofficial Python client for typed decisions over any System One-style model: TypeSafe's hosted Jev, OpenRouter's Decisions endpoint, OpenAI's Decisions API, the open-weight laya family (PyTorch and MLX), any sentence-transformers CrossEncoder, and a JSON-prompted LLM fallback. Its core is a fallback chain: a Client takes an ordered list of backends and a confidence policy, and moves to the next backend when one errors or answers a Choice or Noul below threshold. Score answers are not gated.

Every response records which backend answered, the model, latency and the route taken. A drop-in TypeSafeClient class matches the official SDK's constructor and system_one call, so existing code can add a local fallback by swapping an import. It also ships a CLI (decide ask) and a FastAPI server that speaks TypeSafe's /v1/systemone wire protocol, letting the official SDK talk to a chain of local and hosted models.

What the decision model decides

TypeQuestionAnswers
ChoiceWhich team owns this?billing · engineering
Yes / noDoes the customer ask for money back?—
OtherShould this answer be accepted or escalated to the next backend, based on confidence?—

How it works

  1. Configure an ordered backend chain (for example laya_mlx then typesafe) and confidence thresholds
  2. Send Choice, Score or Noul questions once
  3. If a backend errors or a Choice/Noul answer is below threshold, try the next backend
  4. Return the answer with result.decide recording backend, model, latency and route

Strengths

  • Cheap local model can handle confident cases and escalate only when unsure
  • Drop-in compatibility with the typesafe-sdk TypeSafeClient
  • Keeps working when the hosted API is down
  • Vendor error types preserved so existing except clauses still work

Caveats

  • Unofficial; some SDK options (response_model, per-call overrides) raise NotImplementedError
  • Score answers are not confidence-gated
  • Local backends need the [all] extra

Getting started

uv tool install pydecide (or pip install "pydecide[all]" for local models), then decide ask "text" --noul "question".

At a glance

Type
Library
Status
beta
Language
Python
Runtime
Library, CLI and HTTP server
Has code
yes
Has tests
yes
License
MIT

Use cases and integrations

How curated lists describe it

  • Python ecosystem: one client that sends the same typed Choice, Score and Noul questions to hosted Jev, OpenRouter, OpenAI's Decisions API, laya and laya-mlx, or any sentence-transformers reranker, walking an ordered fallback chain when a backend errors or answers a Choice or Noul question below a configured confidence threshold (Score answers are not gated, since there is no single confidence number for them), and recording on each response which backend answered and why; it also ships a client class matching `typesafe_sdk.TypeSafeClient`'s constructor and `system_one` call for existing code, without `response_model` or the per-call overrides, and a `/v1/systemone` server their SDK parses unchanged.

    yibie/awesome-jev
  • Unofficial Python client (`pip install pydecide`) that sends one set of Choice / Score / Noul questions to hosted Jev, OpenRouter, OpenAI's Decisions API, Laya, Laya MLX, or a sentence-transformers reranker, falling through an ordered chain when a backend errors or a Choice or Noul answer falls below its confidence threshold, and recording which backend answered on every response; also ships a `/v1/systemone` server and a client class matching the official Python SDK's constructor and `system_one` call

    AnotiaWang/awesome-decision-models
  • pydecide is a Python client that calls Jev's /v1/systemone endpoint via TypeSafeBackend for typed decisions.

    logicrw/awesome-jev-projects
  • Python client that sends one typed Choice, Score or Noul request down an ordered chain of backends (hosted Jev, OpenRouter, OpenAI's Decisions API, laya/laya-mlx, a CrossEncoder); code owns the order and the confidence thresholds at which a Choice or Noul answer escalates, and each response records which backend answered. Also ships a TypeSafeClient-compatible class and a /v1/systemone server.

    cobanov/awesome-jev
  • One client for every decision model: Choice, Score and Noul over Jev, OpenRouter, laya, MLX, CrossEncoders and LLM fallback.

    hellogumbo/awesome-jev

Frequently asked questions

What does pydecide decide?

It answers your Choice, Score and Noul questions, and also decides which backend's answer to trust based on confidence thresholds.

Can I use it with existing typesafe-sdk code?

Yes; import TypeSafeClient from decide instead and optionally add fallback= backends.

Does it need a TypeSafe key?

No; it can run on local laya or CrossEncoder backends, and uses TypeSafe only if TYPESAFE_API_KEY is set.

Related projects

  • Unofficial Rust gateway routing /v1/systemone requests to TypeSafe, Vercel, OpenRouter or local Laya via an editable DAG.

    ProxybetaRust
  • Go gateway that puts local and hosted System One models behind one TypeSafe API, with a local Laya router choosing Laya or Jev.

    ServicebetaGo
  • Go harness for System One models: hosted Jev, open Kev in-process via llama.cpp, and Cloudflare Clef, with typed helpers and a CLI.

    ServicebetaGo
  • Open-source dual-brain runtime that answers typed decisions with a fast local engine or the Jev API before falling back to LLMs.

    ServicebetaPython, TypeScript
  • TypeScript library for one-line local decisions with open models (kev-0.6b, kev-4b, open-jev), no API keys or cloud.

    ProjectbetaTypeScript
  • Swift 6 bridge that runs System One decision models behind Apple's Foundation Models API, on device with Laya or via hosted endpoints.

    ProjectbetaSwift