Jev.TypeSafe.Unofficial.Extensions 0.1.0-preview.3

This is a prerelease version of Jev.TypeSafe.Unofficial.Extensions.
dotnet add package Jev.TypeSafe.Unofficial.Extensions --version 0.1.0-preview.3
                    
NuGet\Install-Package Jev.TypeSafe.Unofficial.Extensions -Version 0.1.0-preview.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Jev.TypeSafe.Unofficial.Extensions" Version="0.1.0-preview.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Jev.TypeSafe.Unofficial.Extensions" Version="0.1.0-preview.3" />
                    
Directory.Packages.props
<PackageReference Include="Jev.TypeSafe.Unofficial.Extensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Jev.TypeSafe.Unofficial.Extensions --version 0.1.0-preview.3
                    
#r "nuget: Jev.TypeSafe.Unofficial.Extensions, 0.1.0-preview.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Jev.TypeSafe.Unofficial.Extensions@0.1.0-preview.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Jev.TypeSafe.Unofficial.Extensions&version=0.1.0-preview.3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Jev.TypeSafe.Unofficial.Extensions&version=0.1.0-preview.3&prerelease
                    
Install as a Cake Tool

Jev.TypeSafe.Unofficial.Extensions

Unofficial. Dependency-injection support for Jev.TypeSafe.Unofficial, the community .NET SDK for TypeSafe AI (Jev). Not affiliated with or endorsed by TypeSafe AI.

Registers ITypeSafeClient and TypeSafeClient with Microsoft.Extensions.DependencyInjection, backed by IHttpClientFactory, with options bound from IConfiguration. Targets netstandard2.0, net8.0, net9.0 and net10.0.

Install

dotnet add package Jev.TypeSafe.Unofficial.Extensions --prerelease

Usage

using Microsoft.Extensions.DependencyInjection;
using TypeSafe.AI;

services.AddTypeSafeClient(options => options.DefaultModel = "jev-latest");

ApiKey falls back to the TYPESAFE_API_KEY environment variable, like the plain client. Inject ITypeSafeClient wherever you need it.

From configuration

{
  "TypeSafe": {
    "ApiKey": "...",
    "DefaultModel": "jev-latest",
    "Timeout": "00:00:10",
    "RetryPolicy": { "MaxRetries": 3 },
    "DefaultHeaders": { "X-Team": "search" }
  }
}
services.AddTypeSafeClient(configuration.GetSection("TypeSafe"));

Keep real keys in user secrets or environment variables, not in appsettings.json.

Overloads

Overload Use it to
AddTypeSafeClient() rely on environment variables and defaults
AddTypeSafeClient(Action<TypeSafeClientOptions>) set options in code
AddTypeSafeClient(Action<TypeSafeClientOptions, IServiceProvider>) set options using other registered services
AddTypeSafeClient(IConfiguration) bind a configuration section

Option sources apply in registration order, with later ones winning. Anything still unset falls back to the environment variables and defaults of the core client.

Customizing the HTTP pipeline

Every overload returns an IHttpClientBuilder:

services.AddTypeSafeClient(configuration.GetSection("TypeSafe"))
    .AddHttpMessageHandler<MyLoggingHandler>();

If you add a resilience handler, consider RetryPolicy.None so retries are not applied twice.

Behavior

  • Lifetime: one singleton, shared by ITypeSafeClient and TypeSafeClient. The container disposes it; it does not dispose the factory's HttpClient.
  • Logging and time: ILoggerFactory and TimeProvider are taken from the container unless you set them explicitly. They are never bound from configuration, nor is Logger.
  • Timeout: the factory HttpClient.Timeout is infinite because the SDK enforces its own per-attempt timeout (TypeSafeClientOptions.Timeout).
  • Connections: on .NET 8 and later the primary handler is a SocketsHttpHandler with a 2-minute pooled-connection lifetime, so DNS changes are honored by the long-lived client. Override it with ConfigurePrimaryHttpMessageHandler.
  • Validation: options are validated when the client is first resolved, not at host start. Resolve it once during startup if you want to fail fast.

See the main README for the client API.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.3 81 10/3/2026