Swift SDK
Unofficial Swift 6.4 TypeSafe SDK following the Python SDK API, with macro-based question sets, result builders and dynamic questions.
Overview
swift-typesafe is an unofficial Swift SDK for TypeSafe AI that follows the Python SDK's API (0.7.2 per the README) and supports Apple platforms version 26 and Linux. It uses Apple's experimental HTTPClient package, pinned to a specific version, so its Swift 6.4 and OS requirements apply.
It offers three styles. A @QuestionSet struct with @Choice, @Noul and @Score property wrappers gives reusable questions with concrete typed answers (enum choices, probability nouls, fractional scores). A result-builder closure gives typed ad-hoc questions returned in declaration order. Dynamic questions built at runtime return answers by name. It pays attention to option order, since order can affect probabilities: dictionary literals keep their written order and a Criteria type preserves order for runtime options. Configuration follows the Python SDK's environment variables, defaults to jev-latest with a 10-second per-attempt timeout, and typed errors are provided.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Choice | What is this ticket about? | billing · technical · other |
| Yes / no | Does this need urgent attention? | — |
| Score | How severe is the issue? | minor · moderate · severe |
How it works
- Add the package and set TYPESAFE_API_KEY
- Declare a @QuestionSet, use a builder, or build dynamic questions
- Call client.systemOne(state:questions:)
- Read typed answers
Strengths
- Three question styles for different needs
- Preserves option order deliberately
- Linux support
Caveats
- Depends on an experimental Apple HTTP package
- Requires Swift 6.4 and OS 26
- Unofficial
Getting started
.package(url: "https://github.com/ainame/swift-typesafe.git", from: "0.7.4") and import TypeSafe.At a glance
- Type
- Library
- Status
- beta
- Language
- Swift
- Runtime
- Swift library
- Has code
- yes
- License
- MIT
Use cases and integrations
How curated lists describe it
Unofficial Swift 6.4 client aligned with the Python SDK 0.6.0 API, including Linux
AnotiaWang/awesome-decision-modelsA community Swift TypeSafe client with typed questions, dynamic questions and response parsing.
logicrw/awesome-jev-projectsUnofficial Swift SDK following the Python SDK's API, for Apple platforms and Linux.
MrJev/awesome-jev
Frequently asked questions
Is this an official SDK?
No; it is unofficial and mirrors the Python SDK's API.
Why does option order matter?
The README notes order can affect probabilities, so it preserves written order.
Does it run on Linux?
Yes, per the README.
Related projects
Hack Club's lightweight LLM proxy, listed for adding a Jev forwarding endpoint behind its auth, limits and usage logging.
MCP serverproductionTypeScriptAx, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.
PluginproductionTypeScriptEffect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.
ProjectproductionTypeScriptPHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.
ProjectproductionPHPGo MCP server giving any client typed Jev decisions via OpenRouter or TypeSafe, with validated answers and no paid retries.
MCP serverproductionGoSimon Willison's LLM plugin that adds Jev as a model for yes/no, choice and score questions from the command line.
PluginproductionPython