Skip to content

Simli

Modern .NET SDK for Simli generated from the provider's OpenAPI definition with AutoSDK.

Nuget package dotnet License: MIT Discord

Generated from the source spec

Built from Simli's OpenAPI definition so the SDK stays close to the upstream API surface.

Auto-updated

Designed for fast regeneration and low-friction updates when the upstream API changes without breaking compatibility.

Modern .NET

Targets current .NET practices including nullability, trimming, NativeAOT awareness, and source-generated serialization.

Docs from examples

Examples stay in sync between the README, MkDocs site, and integration tests through the AutoSDK docs pipeline.

Usage

1
2
3
using Simli;

using var client = new SimliClient(apiKey);

List Faces

Lists all available avatar faces for the authenticated user.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
using var client = new SimliClient(apiKey);

// List all available avatar faces
var faces = await client.GetFacesAsync();

Console.WriteLine($"Found {faces.Count} face(s)");
foreach (var face in faces)
{
    Console.WriteLine($"  Face ID: {face.Id}, Version: {face.SimliVersion}, Created: {face.CreatedAt}");
}

Create Session Token

Creates a Compose session token for WebRTC avatar streaming.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
using var client = new SimliClient(apiKey);

// Get available faces first
var faces = await client.GetFacesAsync();

var faceId = faces[0].Id.ToString();

// Create a Compose session token for realtime avatar streaming
var response = await client.StartAudioToVideoSessionComposeTokenPostAsync(
    faceId: faceId);

Console.WriteLine($"Session token: {response.SessionToken}");

Session History

Retrieves session history for the authenticated user.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
using var client = new SimliClient(apiKey);

// Retrieve session history
var response = await client.GetHistorySessionsAsync();

Console.WriteLine($"Found {response.Sessions?.Count ?? 0} session(s)");
if (response.Sessions is { Count: > 0 })
{
    foreach (var session in response.Sessions)
    {
        Console.WriteLine($"  Session ID: {session.Id}, Duration: {session.SessionTotalTime:F1}s");
    }
}

Active Sessions

Gets the current active session count.

1
2
3
4
5
6
using var client = new SimliClient(apiKey);

// Check the number of currently active sessions
var response = await client.GetRatelimiterSessionsAsync();

Console.WriteLine($"Active sessions: {response.CurrentUsage ?? 0}");

Realtime Avatar Client

Test the IRealtimeAvatarClient adapter for Simli realtime sessions.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var apiKey =
    Environment.GetEnvironmentVariable("SIMLI_API_KEY") is { Length: > 0 } key
        ? key
        : throw new AssertInconclusiveException("SIMLI_API_KEY environment variable is not found.");

var faceId =
    Environment.GetEnvironmentVariable("SIMLI_FACE_ID") is { Length: > 0 } id
        ? id
        : "default"; // Use default face if not specified

var client = new SimliClient(apiKey);

// Create and connect via the unified interface
await using var avatar = await SimliRealtimeAvatarClient.ConnectAsync(
    client, faceId);

// Verify the adapter implements IRealtimeAvatarClient
tryAGI.RealtimeAvatar.IRealtimeAvatarClient realtimeClient = avatar;

// SendTextAsync should throw NotSupportedException (Simli is audio-only)
Func<Task> sendText = () => avatar.SendTextAsync("test");

// Send a short PCM16 audio chunk (silence)
var silentAudio = new byte[3200]; // 100ms of silence at 16kHz mono PCM16
await avatar.SendAudioAsync(silentAudio);

// The connection should be established
// Note: IsConnected checks both WebSocket and WebRTC state
// WebRTC may take a moment to establish

Support

Bugs

Open an issue in tryAGI/Simli.

Ideas and questions

Use GitHub Discussions for design questions and usage help.

Community

Join the tryAGI Discord for broader discussion across SDKs.

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.