Skip to content

Swift SDK

Unofficial Swift 6.4 TypeSafe SDK following the Python SDK API, with macro-based question sets, result builders and dynamic questions.

LibrarybetaMIT

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

TypeQuestionAnswers
ChoiceWhat is this ticket about?billing · technical · other
Yes / noDoes this need urgent attention?—
ScoreHow severe is the issue?minor · moderate · severe

How it works

  1. Add the package and set TYPESAFE_API_KEY
  2. Declare a @QuestionSet, use a builder, or build dynamic questions
  3. Call client.systemOne(state:questions:)
  4. 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

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 serverproductionTypeScript
  • Ax, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.

    PluginproductionTypeScript
  • Effect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.

    ProjectproductionTypeScript
  • PHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.

    ProjectproductionPHP
  • Go MCP server giving any client typed Jev decisions via OpenRouter or TypeSafe, with validated answers and no paid retries.

    MCP serverproductionGo
  • Simon Willison's LLM plugin that adds Jev as a model for yes/no, choice and score questions from the command line.

    PluginproductionPython