Skip to content

Jev directory

TypeSafe AI SDK for PHP

An unofficial PHP client for the TypeSafe AI System One API with typed Noul, Choice, and Score responses, synchronous and Guzzle-promise calls, model discovery, retries, and PSR-3 logging.
Stars
2
Language
PHP
License
MIT
Reading time
3 min
Published by
Community
Author
Butochnikov
Last verified
Sep 2026

About this project

PHP client for the TypeSafe AI System One API. Ask yes/no questions, select categories, and score text or structured data with typed responses. Community-maintained and unofficial; this package is not affiliated with TypeSafe AI. Noul, Choice and Score questions with typed answers and probabilities. Synchronous calls and asynchronous requests through Guzzle promises. Model discovery, configurable retries and timeouts, and PSR-3 logging. PHP 8.2 or later in the PHP 8 series.

Quoted from the project's README. Read the full README.

Highlights

  • Noul returns the probability of a yes answer, not a boolean; Score returns a possibly fractional expected score on a zero-based rubric.
  • AsyncTypeSafeClient returns Guzzle promises with then(), rejection handlers, wait(), and cancel(); closing cancels pending operations and is idempotent.
  • RetryPolicy defaults to two retries for 408, 429, 5xx, connection errors, and timeouts, with per-call policies that do not mutate client state.
  • Failures map to typed exceptions such as TypeSafeRateLimitError and TypeSafeAuthenticationError; debug logs redact credentials, not bodies.
  • Requires PHP 8.2 or later, cURL and JSON extensions, Composer 2, and a TypeSafe API key; environment variables are read directly, not from .env files.

Quickstart

php
use TypeSafe\{Choice, Noul, Score, TypeSafeClient};

$client = new TypeSafeClient();
$result = $client->systemOne(
    state: ['document' => 'I was charged twice. Please help ASAP.'],
    questions: [
        'billing' => new Noul(instructions: 'Is this about billing?'),
        'urgency' => new Score(criteria: ['low', 'medium', 'high'], instructions: 'Urgency?'),
    ],
);
$client->close();

Watch out

MIT-licensed. Community-maintained and unofficial, not affiliated with TypeSafe AI; the default test suite is offline, and live API compatibility and exhaustive equivalence with the Python SDK have not been verified.

Questions about this entry

Short answers drawn from the linked project or page.

From the Jev guides

Original write-ups on what this entry is for.

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai