Skip to content
sunmeatPublic

About

One API. Every intelligence. In development: unified AI integration, model routing and budget controls for .NET.

Topics

Resources

Code of conduct

Contributing

Security policy

Accessibility

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Sunmeat.Synapse

Sunmeat.Synapse

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.

Українська

Install

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.json

When 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.

Offline quick start

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.

Providers

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.

Routing and application policy

  • Explain shows which explicitly selected aliases are eligible. LocalOnly and the optional allowlist are evaluated before transport.
  • ChatAsync returns 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.
  • UsdBudget admits 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.
  • AskJsonAsync parses and validates output locally. Use ConversationSession for bounded in-memory text history and PromptTemplate for literal variable substitution.
  • Enable WithTextCache and call AskCachedAsync for bounded exact-response reuse under an application-verified tenant partition.
  • Pass a custom IChatClient for advanced provider capabilities, including tool calls. Use ChatWithFunctionsAsync for a bounded opt-in function loop and CompareAsync for a policy-checked comparison. Use AsChatClient to consume the routed client from Microsoft.Extensions.AI. Optional DI registration is available through AddSynapse.

Compatibility and limitations

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.


Sunmeat ecosystem

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


❤️ Support the project

Voluntary support helps fund development, testing, documentation and new open-source .NET libraries.

Support development Patreon Monobank Star on GitHub Developer website


Built with curiosity. Shared with the community.

Copyright © 2026 Oleksandr Zahoruiko · sunmeat.dev

About

One API. Every intelligence. In development: unified AI integration, model routing and budget controls for .NET.

Topics

Resources

Code of conduct

Contributing

Security policy

Accessibility

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages