| .gitignore | ||
| Client.cs | ||
| GumYum.NPC.SDK.csproj | ||
| LICENSE | ||
| Managers.cs | ||
| NPC.cs | ||
| README.md | ||
| TESTING.md | ||
GumYum NPC SDK for .NET
This is the core GumYum NPC SDK for .NET applications. It provides a clean, modern C# client for integrating AI-powered NPCs into your applications.
Features
- API Key Authentication: Simple authentication using API keys from the GumYum dashboard
- Automatic JWT Token Management: Handles token exchange and refresh automatically
- NPC Spawning: Deterministic NPC spawning with personality types
- OpenAI-Compatible Chat: Chat completions API with streaming support
- Retry Logic: Built-in retry handling for temporary failures
- Event-Driven Architecture: Rich event system for dialogue and request lifecycle
Installation
For non-Unity .NET projects, copy the following files to your project:
Client.csManagers.csNPC.cs
Dependencies
- .NET 6.0 or later
- System.Text.Json (built-in with .NET)
- Microsoft.Extensions.Logging (optional)
Unity Users
For Unity projects, please use the Unity-specific package located in Unity/Assets/GumYumNPC/ which includes:
- Unity-specific serialization
- Coroutine support
- MonoBehaviour integration
- Unity package manager support
Quick Start
using GumYum.NPC;
// Create client
var client = new Client() {
ApiKey = "your-api-key",
ApiSecret = "your-api-secret"
};
// Spawn an NPC
var npc = await client.NPCs.SpawnAsync("universe-id", seed: 12345);
// Chat with the NPC
var messages = new List<ChatMessage> {
new ChatMessage { Role = "user", Content = "Hello!" }
};
var response = await npc.Chat.CompletionsAsync(messages);
Console.WriteLine($"{npc.Name}: {response.Choices[0].Message.Content}");
Architecture
This SDK uses modern C# features:
- Uses
System.Text.Jsonfor JSON serialization (Unity version uses Newtonsoft.Json) - Supports
ILogger<T>for logging integration - Clean async/await patterns throughout
- No Unity dependencies
License
See LICENSE file in the repository root.