onellmCookbook
onellm cookbook
Answers to common LLM tasks in C#: structured output, agents with tools, local models with Ollama, cost per call and tests without an API key. Each recipe is a complete program you can run without a key, with the output it really prints on OneLLM 1.0.0.
Ask a model
Get LLM structured output into a C# recordLLM structured output in C#: OneLLM builds a JSON Schema from your record, sends it as native structured output and returns a typed value. Free, open source.Call Ollama from C#Call Ollama from C#: OneLLM’s ollama preset talks to a local Ollama server with no key, streams, chats and reports usage at zero cost. Free, open source.
Cost and testing
Track OpenAI API cost per call in C#Track OpenAI API cost per call in C#: OneLLM prices every call from its model catalog in decimal line items, with spend caps and JSONL logs. Free, open source.Unit test LLM calls in C# without an API keyUnit test LLM calls in C# with no API key: OneLLM’s ScriptedProvider answers in place of OpenAI, records each request and prices it. Free, open source.