SmooAI.Config 4.5.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SmooAI.Config --version 4.5.0
                    
NuGet\Install-Package SmooAI.Config -Version 4.5.0
                    
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="SmooAI.Config" Version="4.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmooAI.Config" Version="4.5.0" />
                    
Directory.Packages.props
<PackageReference Include="SmooAI.Config" />
                    
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 SmooAI.Config --version 4.5.0
                    
#r "nuget: SmooAI.Config, 4.5.0"
                    
#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 SmooAI.Config@4.5.0
                    
#: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=SmooAI.Config&version=4.5.0
                    
Install as a Cake Addin
#tool nuget:?package=SmooAI.Config&version=4.5.0
                    
Install as a Cake Tool

SmooAI.Config

NuGet License: MIT

.NET client for SmooAI.Config — the OpenAI-compatible configuration service for your entire stack. One schema, one API, every language. Typed access to public values, secrets, and feature flags from any .NET app, with a local-baked runtime for zero-latency cold starts.

Wire-compatible with the TypeScript, Python, Rust and Go clients — the same encrypted bundle decrypts and resolves to the same keys no matter which language you ship.

Install

dotnet add package SmooAI.Config

What you get

  • HTTP client with OAuth2 client-credentials auth, token caching, and 401 retry
  • Local runtime — AES-256-GCM decrypt of a baked config bundle for zero-network reads at cold start
  • Build pipeline — fetch all values and encrypt them into a bundle your deploy tool ships with the function
  • Strongly-typed keys via a Roslyn source generator — mis-typed keys fail at compile time
  • Feature flag support — live-fetched through the client, never baked

Quickstart

1. Point the generator at your schema

In your csproj:

<ItemGroup>
  <AdditionalFiles Include="schema.json" SmooConfigSchema="true" />
</ItemGroup>

Your schema.json (emitted by smooai-config init / smooai-config push):

{
    "publicConfigSchema": { "apiUrl": "stringSchema", "retries": "numberSchema" },
    "secretConfigSchema": { "moonshotApiKey": "stringSchema", "anthropicApiKey": "stringSchema" },
    "featureFlagSchema": { "newFlow": "booleanSchema" }
}

2. Use the generated typed keys

using SmooAI.Config;
using SmooAI.Config.Generated;
using SmooAI.Config.Runtime;

var runtime = SmooConfigRuntime.Load();  // reads SMOO_CONFIG_KEY_FILE + SMOO_CONFIG_KEY
using var client = new SmooConfigClient(new SmooConfigClientOptions
{
    ClientId     = Environment.GetEnvironmentVariable("SMOOAI_CLIENT_ID")!,
    ClientSecret = Environment.GetEnvironmentVariable("SMOOAI_CLIENT_SECRET")!,
    OrgId        = Environment.GetEnvironmentVariable("SMOOAI_ORG_ID")!,
});

// Public + secret come from the baked runtime (sync, no network).
// Feature flags fall through to the HTTP client automatically.
var apiUrl    = await Public.ApiUrl.ResolveAsync(runtime, client);
var moonshot  = await Secrets.MoonshotApiKey.ResolveAsync(runtime, client);
var newFlow   = await FeatureFlags.NewFlow.ResolveAsync(runtime, client);

No stringly-typed keys. Rename a key in schema.json and every call site becomes a compile-time error.

The three pieces

HTTP client

OAuth2 client-credentials flow against {baseUrl}/token (with the api. subdomain rewritten to auth.), tokens cached in memory and refreshed 60 seconds before expiry, automatic 401 retry.

using var client = new SmooConfigClient(new SmooConfigClientOptions
{
    ClientId     = "...",
    ClientSecret = "sk_...",
    OrgId        = "...",
    BaseUrl      = "https://api.smoo.ai",       // default
    DefaultEnvironment = "production",           // default
});

// Untyped
JsonElement value = await client.GetValueAsync("moonshotApiKey");
Dictionary<string, JsonElement> all = await client.GetAllValuesAsync();

// Typed (via generated keys)
string? anthropic = await Secrets.AnthropicApiKey.GetAsync(client);

Local runtime

Decrypts a pre-built bundle at cold start and exposes it in-memory. Parity with the TS / Python / Rust / Go runtimes — blob layout is nonce (12 bytes) || ciphertext || authTag (16 bytes), AES-256-GCM.

Set two env vars on your function:

Variable Value
SMOO_CONFIG_KEY_FILE Absolute path to the .enc bundle on disk
SMOO_CONFIG_KEY Base64-encoded 32-byte AES-256 key
var runtime = SmooConfigRuntime.Load();   // null when env vars are unset — dev fallback
if (runtime is null) {
    // No baked bundle present; fall back to a live-fetching client.
}

var apiUrl = runtime?.GetPublic("apiUrl")?.GetString();
var retries = runtime?.GetValue<int>("retries");

Build pipeline

Bake all public + secret values into an encrypted bundle at deploy time. Feature flags are skipped — they stay live-fetched so you can flip them without a redeploy.

using var client = new SmooConfigClient(clientOptions);

var classify = SchemaClassifier.FromSchemaFile(".smooai-config/schema.json");
var result = await SmooConfigBuilder.BuildAsync(client, new BuildBundleOptions
{
    Environment = "production",
    Classify    = classify,
});

File.WriteAllBytes("smoo-config.enc", result.Bundle);

Console.WriteLine($"SMOO_CONFIG_KEY_FILE={Path.GetFullPath("smoo-config.enc")}");
Console.WriteLine($"SMOO_CONFIG_KEY={result.KeyB64}");
Console.WriteLine($"Baked {result.KeyCount} keys ({result.SkippedCount} feature flags skipped).");

Ship smoo-config.enc alongside the function bundle, set the two env vars on the function, and the runtime picks up both automatically.

Wire compatibility

The .NET client produces and consumes exactly the same bundle format as every other SmooAI.Config language client:

  • @smooai/config (TypeScript)
  • smooai-config (Python)
  • smooai_config (Rust)
  • github.com/smooai/config/go (Go)

You can bake the bundle in any language and decrypt it in any other.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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 was computed.  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. 
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
6.0.1 38 5/14/2026
6.0.0 54 5/13/2026
5.0.0 64 5/13/2026
4.7.4 78 5/12/2026
4.7.1 79 5/12/2026
4.7.0 93 5/11/2026
4.6.0 94 5/11/2026
4.5.3 95 4/24/2026
4.5.2 98 4/24/2026
4.5.1 90 4/24/2026
4.5.0 91 4/24/2026
0.1.0 92 4/24/2026