Jev directory
CommunityJev Repos & SDKs
TypeSafe SDK for PHP
PHP SDK for the TypeSafe AI API that asks typed questions about text or JSON and returns probabilities, labels, or rubric scores, reachable directly from TypeSafe or through OpenRouter.
- Reading time
- 2 min
- Published by
- Community
- Added
- Nov 23, 2026
Highlights
- Requires PHP 8.3 or newer and installs with composer require phox/typesafe-sdk-php.
- One call switches between the TypeSafe and OpenRouter providers; answer bodies stay the same.
- Supports noul yes/no questions, choice labels, and ordered rubric scores.
- Auto-registers a Laravel Client singleton; config publishes with vendor:publish --tag=typesafe-config.
- jev-latest works on both providers; OpenRouter also accepts ~typesafe/jev-latest and pinned builds.
Questions about this entry
Short answers drawn from the linked project or page.
Run composer require phox/typesafe-sdk-php. The package requires PHP 8.3 or newer. Set TYPESAFE_API_KEY in your environment, or OPENROUTER_API_KEY when using the OpenRouter provider, then construct a Client and send a request.
Noul asks a yes/no question and returns a probability of yes, with isYes() at a default 0.5 threshold. Choice picks one of several labels and returns the label, its confidence and per-label probabilities. Score returns a level on an ordered rubric of at least two levels.
Yes. The package auto-registers a Client singleton that can be injected straight away, so setting the API key is the whole setup. To change provider, model, timeout or logging, publish the config with php artisan vendor:publish --tag=typesafe-config.
Publish the config file if you run php artisan config:cache. With a cached config Laravel never loads the .env, so a key left to an environment lookup resolves to nothing, and because a missing key is only reported when a request is sent, calls fail in production rather than at boot.
Only on OpenRouter. $response->usage()->cost() returns the charge in USD, null when the provider did not price the call, and 0.0 when it priced it at nothing. Calling TypeSafe directly does not report cost, and requestId() returns the generation id on OpenRouter.
The client logs through Laravel's logger, with log.channel naming a channel and log.level accepting error, warn, info, debug or off. Credential headers are redacted but bodies are not, so debug writes your state and answers to the log.
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.