Let’s skip the theory and get our hands dirty. In this post, you’ll go from a blank terminal to a working AI call in under 5 minutes.
Prerequisites
| Requirement | Version | Check |
|---|---|---|
| .NET SDK | 9.0+ | dotnet --version |
| Git | Any | git --version |
| API Key | OpenAI or Anthropic | Your dashboard |
Step 1: Clone the Repository
git clone https://github.com/martiendejong/Hazina.git
cd hazina
Step 2: Restore Dependencies
dotnet restore Hazina.QuickStart.sln
Step 3: Set Your API Key
# PowerShell
$env:OPENAI_API_KEY = "sk-your-key-here"
# Or for Anthropic
$env:ANTHROPIC_API_KEY = "sk-ant-your-key-here"
Step 4: Run the Demo
dotnet run --project apps/Demos/Hazina.Demo.ConfigurationShowcase
You should see output showing various AI providers responding to prompts. That’s it – Hazina is running.
Step 5: Your First Custom AI Call
Create a new console app or add this to any existing project:
using Hazina.AI.FluentAPI.Configuration;
using Hazina.AI.FluentAPI.Core;
// One-time setup
QuickSetup.SetupOpenAI(Environment.GetEnvironmentVariable("OPENAI_API_KEY")!);
// Ask anything
var answer = await Hazina.AskAsync("What is the meaning of life?");
Console.WriteLine(answer);
Two lines of setup. One line to call AI. That’s the Hazina way.
Verification Checklist
| Component | Command | Expected |
|---|---|---|
| Build | dotnet build Hazina.QuickStart.sln |
0 errors |
| Tests | dotnet test Hazina.QuickStart.sln |
All pass |
| Demo | dotnet run --project apps/Demos/... |
AI output |
Common Scenarios
Just exploring? Open Hazina.QuickStart.sln and browse the demos.
Building an AI app? Reference Hazina.AI.FluentAPI in your project and use QuickSetup.
Need document search? We’ll cover RAG in a later post – stay tuned.
In the next post, we’ll dive into the FluentAPI – Hazina’s elegant way of talking to any LLM provider.
Frequently Asked Questions
To clone the Hazina repository, open your terminal and run the command `git clone https://github.com/martiendejong/Hazina.git`. After cloning, navigate into the directory with `cd hazina` to start working on your AI call.
You need the .NET SDK version 9.0 or higher and Git installed on your system. Additionally, you must have an API key from either OpenAI or Anthropic to authenticate your AI calls.
You can set your OpenAI API key in a PowerShell terminal by using the command `$env:OPENAI_API_KEY = ‘sk-your-key-here’`. Replace ‘sk-your-key-here’ with your actual API key to ensure proper authentication.
The `Hazina.Demo.ConfigurationShowcase` demonstrates how various AI providers respond to prompts. Running the command `dotnet run –project apps/Demos/Hazina.Demo.ConfigurationShowcase` will showcase the output and help you verify that Hazina is set up correctly.