One API. Every intelligence.
Synapse brings cloud and local AI models into one .NET API. Use built-in HTTP adapters or an existing IChatClient, choose where prompts may go, and apply an application-side budget.
Version 1.0.0 is available as a local build artifact for review. The single Sunmeat.Synapse package includes routing, all built-in adapters, dependency injection and test doubles.
dotnet pack src/Sunmeat.Synapse -c Release -o artifacts
dotnet add package Sunmeat.Synapse --version 1.0.0 --no-restore
dotnet restore --source /absolute/path/to/artifacts --source https://api.nuget.org/v3/index.jsonWhen using a feed that already contains the package, run dotnet add package Sunmeat.Synapse --version 1.0.0. Microsoft AI and DI abstractions restore as ordinary NuGet dependencies. No provider SDK, gateway, or database is required.
using Microsoft.Extensions.AI;
using Sunmeat.Synapse;
using Sunmeat.Synapse.Testing;
using var fixture = new ScriptedChatClient((_, _, _) =>
Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Hello from an offline fixture."))));
await using var ai = Synapse.FromChatClient(fixture);
Console.WriteLine(await ai.AskAsync("Hello!"));Run the same example with dotnet run --project examples/QuickStart. It uses an explicit test double.
| Adapter | Text | Streaming | Embeddings | Verification |
|---|---|---|---|---|
| OpenAI Chat Completions | Yes | SSE | Explicit embedding model | Offline fixtures |
| Anthropic Messages | Yes | SSE | — | Offline fixtures |
| Gemini Developer API | Yes | SSE | — | Offline fixtures |
| Ollama native API | Yes | NDJSON | Explicit embedding model | Offline fixtures |
| OpenAI-compatible | Compatible text schema | Compatible SSE | Compatible embeddings schema | Generic offline fixtures |
Start with Synapse.Create().UseOpenAI(alias, apiKey, model) or use UseAnthropic, UseGemini, UseOllama, or UseOpenAICompatible. Call Default(alias) when configuring multiple aliases. Supply model IDs and credentials explicitly. Built-in adapters never start or install an Ollama model.
Explainshows which explicitly selected aliases are eligible.LocalOnlyand the optional allowlist are evaluated before transport.ChatAsyncreturns the chosen model, response, and attempts. Retry and fallback require explicit options and are disabled for tool and continuation calls. A stream stays on one route.UsdBudgetadmits concurrent requests using an explicit USD reservation, then uses token usage and caller-supplied pricing when both counts and prices are available. Unknown or interrupted requests charge the reservation. Actual provider charges can exceed a reservation.AskJsonAsyncparses and validates output locally. UseConversationSessionfor bounded in-memory text history andPromptTemplatefor literal variable substitution.- Enable
WithTextCacheand callAskCachedAsyncfor bounded exact-response reuse under an application-verified tenant partition. - Pass a custom
IChatClientfor advanced provider capabilities, including tool calls. UseChatWithFunctionsAsyncfor a bounded opt-in function loop andCompareAsyncfor a policy-checked comparison. UseAsChatClientto consume the routed client from Microsoft.Extensions.AI. Optional DI registration is available throughAddSynapse.
Targets .NET 8, 9, 10, and 11. Built-in adapters implement text-only requests; native schema enforcement and built-in provider tool calling, image/audio inputs, explicit xAI certification, durable budgets and model racing are outside this build. The built-in adapters are verified using HTTP fixtures. Live accounts, local models, and Native AOT require separate verification.
Independent .NET libraries with a shared philosophy: simple APIs, modularity and open source.
| Library | Purpose | NuGet / Status |
|---|---|---|
| Sunmeat.Prism | Serialization and format conversion | NuGet |
| Sunmeat.Pulse | Structured logging | NuGet |
| Sunmeat.Nexus | HTTP requests and API communication | NuGet |
| Sunmeat.Lens | Code analysis and architecture visualization | NuGet · Roslyn · Raster |
| Sunmeat.Guard | Validation and argument checks | NuGet |
| Sunmeat.Diff | Data comparison and patches | NuGet |
| Sunmeat.Morph | Object mapping and transformation | NuGet |
| Sunmeat.Forge | Synthetic data and test fixtures | NuGet |
| Sunmeat.Signal | Multichannel notifications | NuGet · Extensions.DependencyInjection |
| Sunmeat.Vault | Cryptography and secret storage | NuGet |
| Sunmeat.Portal | File systems, storage and backups | NuGet |
| Sunmeat.Scribe | Document generation and processing | In development |
| Sunmeat.Flux | In-process Mediator, CQRS and Event Bus | In development |
| Sunmeat.Synapse (this project) | Unified AI API and model routing | In development |
All published packages · Ecosystem website
Voluntary support helps fund development, testing, documentation and new open-source .NET libraries.
Built with curiosity. Shared with the community.
Copyright © 2026 Oleksandr Zahoruiko · sunmeat.dev
