One of the most frustrating things about working with AI APIs is that every provider has a different SDK, different request format, and different response structure. Hazina’s FluentAPI solves this with a unified interface that works with OpenAI, Anthropic, and more.
The Problem
Without Hazina, switching from OpenAI to Anthropic means rewriting your integration code. Different parameter names, different streaming patterns, different error handling. Multiply this across a production app and you have a maintenance nightmare.
The Solution: One API to Rule Them All
using Hazina.AI.FluentAPI.Core;
// Simple question
var answer = await Hazina.AskAsync("Explain quantum computing in simple terms");
// With system prompt
var answer = await Hazina.AskAsync(
"Translate this to Dutch",
systemPrompt: "You are a professional translator"
);
Provider Configuration
Hazina supports multiple LLM providers through a clean configuration pattern:
using Hazina.AI.FluentAPI.Configuration;
// OpenAI
QuickSetup.SetupOpenAI(apiKey, model: "gpt-4o");
// Anthropic
QuickSetup.SetupAnthropic(apiKey, model: "claude-sonnet-4-5-20250929");
// Multiple providers simultaneously
QuickSetup.SetupAndConfigure(config => {
config.AddOpenAI(openAiKey);
config.AddAnthropic(anthropicKey);
config.DefaultProvider = "anthropic";
});
Streaming Responses
For real-time output (like a chat interface), Hazina supports streaming out of the box:
await foreach (var chunk in Hazina.StreamAsync("Write a short story"))
{
Console.Write(chunk);
}
The streaming interface is provider-agnostic – same code whether you’re using OpenAI or Anthropic.
Conversation History
For multi-turn conversations, use the conversation builder:
var conversation = Hazina.CreateConversation()
.WithSystemPrompt("You are a helpful coding assistant")
.AddUserMessage("How do I sort a list in C#?")
.AddAssistantMessage("You can use LINQ: list.OrderBy(x => x)")
.AddUserMessage("What about descending order?");
var response = await conversation.SendAsync();
Why This Matters
The FluentAPI isn’t just syntactic sugar. It’s a strategic abstraction that lets you:
- Switch providers without changing application code
- A/B test different models easily
- Fall back to alternative providers when one is down
- Keep your codebase clean and testable
In the next post, we’ll look at how Hazina’s configuration system gives you fine-grained control over every aspect of the AI pipeline.
Frequently Asked Questions
Hazina FluentAPI is a unified interface designed to simplify the integration of various AI providers like OpenAI and Anthropic. It eliminates the need for different SDKs and response structures, allowing developers to work seamlessly across multiple LLMs.
Hazina FluentAPI supports real-time output using a provider-agnostic streaming interface. This means you can receive streaming responses from any supported provider, such as OpenAI or Anthropic, using the same code.
Yes, Hazina FluentAPI allows you to switch between different AI providers without rewriting your application code. This feature enables developers to maintain a clean codebase while easily A/B testing or falling back to alternative models.
Setting up multiple LLM providers with Hazina is straightforward using the QuickSetup configuration. You can add different providers like OpenAI and Anthropic, specify your API keys, and choose a default provider, all while keeping your configuration clean and manageable.