LLM Chat & Streaming
Run LLaMA 3.x, Qwen 3 / 3.5, Gemma 4 (incl. MoE), SmolLM 3, Nemotron-H, Nemotron-3 Elastic, and Bonsai 1-bit models locally on the Atelico AI Engine. Chat, completion, streaming, structured output.
Streaming Inference
Token-by-token streaming for responsive UIs. Display partial responses as they generate — dialogue feels alive instead of waiting for a wall of text.
// Stream tokens as they generate
await Atelico.StreamChat(
"Tell me about this dungeon.",
"You are a mysterious guide.",
(string token) => {
dialogueLabel.text += token;
}
);Supported Models
Load any GGUF from Hugging Face or bundle a model with your game. GGUF Q2–Q8 for compatibility, SafeTensors for full precision, Bonsai's 1-bit MLX for extreme compression. The engine can support any open-source model.
Size in memory, by parameter class
Same parameter count, very different footprint. Bonsai's 1-bit MLX wins in every bucket: an 8B-class model fits in ~1.15 GB, ~4× smaller than the equivalent GGUF Q4.
Decode Throughput
Same one-line call, faster than llama.cpp on every measured model on RTX 3090.
// Sample once. Same call works on every supported model.
let reply = engine.llm()
.chat(prompt, system_prompt)
.await?;Pure-decode, median of 5 runs. vLLM is CUDA-only and runs at its weakest mode by design at batch=1 — the single-user real-time regime this engine targets. Full per-model and per-backend tables (vs llama.cpp, Ollama, vLLM) live on the benchmarks page.
GGUF Support
Point the engine at any .gguf file. Compatible with the
thousands of GGUF-quantized models on Hugging Face. Q2, Q3, Q4, Q5, Q6,
Q8, and F16 all supported — pick the quality/size tradeoff that
fits your target hardware.
Atelico.Init();
Atelico.LoadModel("Assets/Models/my-custom-model-q4.gguf");
string response = await Atelico.Chat(
"Hello!",
"You are a friendly shopkeeper."
);Structured Output
Constrain output at the token level. Four ways to lock the shape, all enforced during generation: every token the model emits is masked against the constraint, so invalid output is impossible (not unlikely — impossible).
- JSON Schema — full Draft-7 (nested objects, arrays, enums, ranges, required fields).
- Choice / enum — pick from a fixed list of strings.
- Regex — any regular expression. IDs, timestamps, dice notation, version strings.
- Lark grammar — context-free grammars for shapes JSON Schema can't express (DSLs, command languages).
let schema = json!({
"type": "object",
"properties": {
"action": { "type": "string",
"enum": ["attack", "defend", "flee", "talk"] },
"target": { "type": "string" },
"confidence": { "type": "number", "minimum": 0, "maximum": 1 }
},
"required": ["action", "target", "confidence"]
});
let reply = engine.llm()
.generate_structured(prompt, &schema)
.await?;
// reply: { "action": "defend", "target": "dragon", "confidence": 0.85 }Constraint trees are cached across requests with the same shape, so the per-call overhead drops to near-zero on the second call. Full reference →
Prefix Cache
When requests share a prompt prefix (system prompt, world state, character backstory) the engine reuses the cached KV state instead of re-prefilling. Up to ~4× faster time-to-first-token on a ~1,000-token persona prompt — the win scales with the cached length.
Answer Caching
Identical prompts return cached results instantly. In-memory cache with configurable TTL and LRU eviction, isolated per adapter, namespace, and temperature. Useful for repetitive queries like NPC barks, tooltip descriptions, or any prompt that recurs frequently with the same parameters.
Multi-Backend Routing
Same API, different backends. Route per-request: local on-device
models for gameplay, cloud providers for development, testing, or
heavier capability calls. All through the same
engine.chat().