ForeverTools.AIML 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ForeverTools.AIML --version 1.0.0
                    
NuGet\Install-Package ForeverTools.AIML -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ForeverTools.AIML" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ForeverTools.AIML" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ForeverTools.AIML" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ForeverTools.AIML --version 1.0.0
                    
#r "nuget: ForeverTools.AIML, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ForeverTools.AIML@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ForeverTools.AIML&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ForeverTools.AIML&version=1.0.0
                    
Install as a Cake Tool

ForeverTools.AIML

Access 400+ AI models through a single, unified .NET API. Built on AI/ML API with an OpenAI-compatible interface.

NuGet NuGet Downloads

Features

  • 400+ AI Models - GPT-4, Claude, Llama, Gemini, Mistral, DeepSeek, and more
  • Image Generation - DALL-E 3, Stable Diffusion, Flux, Midjourney-style models
  • Embeddings - Text embeddings for RAG, search, and semantic analysis
  • Audio - Text-to-speech and speech-to-text (Whisper)
  • Video Generation - Sora, Runway, Kling AI
  • OpenAI Compatible - Drop-in replacement using the official OpenAI SDK
  • ASP.NET Core Ready - Built-in dependency injection support
  • Multi-Target - Supports .NET 8, .NET 6, and .NET Standard 2.0

Quick Start

1. Get Your API Key

Sign up at aimlapi.com to get your API key.

2. Install the Package

dotnet add package ForeverTools.AIML

3. Start Using AI

using ForeverTools.AIML;

// Simple chat
var client = new AimlApiClient("your-api-key");
var response = await client.ChatAsync("What is the capital of France?");
Console.WriteLine(response); // "The capital of France is Paris."

// Or use environment variable
var client = AimlApiClient.FromEnvironment(); // Reads AIML_API_KEY

Usage Examples

Chat Completions

using ForeverTools.AIML;
using OpenAI.Chat;

var client = new AimlApiClient("your-api-key");

// Simple message
var answer = await client.ChatAsync("Explain quantum computing in simple terms");

// With specific model
var answer = await client.ChatAsync(
    "Write a haiku about programming",
    model: AimlModels.Chat.Claude35Sonnet
);

// Full control with messages
var messages = new List<ChatMessage>
{
    new SystemChatMessage("You are a helpful coding assistant."),
    new UserChatMessage("How do I read a file in C#?")
};

var completion = await client.CompleteChatAsync(messages);
Console.WriteLine(completion.Content[0].Text);

Streaming Responses

var messages = new[] { new UserChatMessage("Write a story about a robot") };

await foreach (var update in client.StreamChatAsync(messages))
{
    if (update.ContentUpdate.Count > 0)
    {
        Console.Write(update.ContentUpdate[0].Text);
    }
}

Image Generation

// Generate an image
var imageUrl = await client.GenerateImageAsync(
    "A futuristic city at sunset, digital art style"
);
Console.WriteLine(imageUrl);

// With specific model
var imageUrl = await client.GenerateImageAsync(
    "A cute robot reading a book",
    model: AimlModels.Image.FluxPro
);

Embeddings

// Single embedding
var vector = await client.EmbedAsync("Hello, world!");
Console.WriteLine($"Dimensions: {vector.Length}");

// Multiple embeddings
var texts = new[] { "First document", "Second document", "Third document" };
var embeddings = await client.EmbedManyAsync(texts);

Text-to-Speech

var audioData = await client.TextToSpeechAsync(
    "Hello! Welcome to ForeverTools.",
    voice: "nova"
);

await File.WriteAllBytesAsync("output.mp3", audioData.ToArray());

Speech-to-Text

using var audioFile = File.OpenRead("recording.mp3");
var transcript = await client.TranscribeAsync(audioFile, "recording.mp3");
Console.WriteLine(transcript);

ASP.NET Core Integration

Configuration

// Program.cs
builder.Services.AddForeverToolsAiml("your-api-key");

// Or from configuration
builder.Services.AddForeverToolsAiml(builder.Configuration);
// appsettings.json
{
  "AimlApi": {
    "ApiKey": "your-api-key",
    "DefaultChatModel": "gpt-4o",
    "DefaultImageModel": "dall-e-3"
  }
}

Using in Controllers/Services

public class ChatController : ControllerBase
{
    private readonly AimlApiClient _aiml;

    public ChatController(AimlApiClient aiml)
    {
        _aiml = aiml;
    }

    [HttpPost]
    public async Task<string> Chat([FromBody] string message)
    {
        return await _aiml.ChatAsync(message);
    }
}

Available Models

Chat Models

Model Constant
GPT-4o AimlModels.Chat.Gpt4o
GPT-4o Mini AimlModels.Chat.Gpt4oMini
Claude 3.5 Sonnet AimlModels.Chat.Claude35Sonnet
Claude 3 Opus AimlModels.Chat.Claude3Opus
Gemini 1.5 Pro AimlModels.Chat.Gemini15Pro
Llama 3.1 405B AimlModels.Chat.Llama31405B
Mistral Large AimlModels.Chat.MistralLarge
DeepSeek R1 AimlModels.Chat.DeepSeekR1

Image Models

Model Constant
DALL-E 3 AimlModels.Image.DallE3
Stable Diffusion XL AimlModels.Image.StableDiffusionXL
Flux Pro AimlModels.Image.FluxPro

See AI/ML API Model Database for the complete list of 400+ models.

Advanced Usage

Direct OpenAI Client Access

var client = new AimlApiClient("your-api-key");

// Get the underlying OpenAI client for advanced scenarios
var openAiClient = client.UnderlyingClient;

// Use any OpenAI SDK feature
var assistantClient = openAiClient.GetAssistantClient();

Custom Configuration

var options = new AimlApiOptions
{
    ApiKey = "your-api-key",
    DefaultChatModel = AimlModels.Chat.Claude35Sonnet,
    DefaultImageModel = AimlModels.Image.FluxPro,
    TimeoutSeconds = 120
};

var client = new AimlApiClient(options);

Why ForeverTools.AIML?

Feature ForeverTools.AIML Raw API Calls
400+ models Single package Multiple SDKs
Type safety Full IntelliSense Manual JSON
DI support Built-in Manual setup
Model constants Included Magic strings
Async/await Native Manual
Multi-target .NET 6/8 + Standard 2.0 Framework-specific

Requirements

  • .NET 8.0, .NET 6.0, or .NET Standard 2.0 compatible framework
  • AI/ML API key

License

MIT License - see LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 472 12/8/2025
1.0.0 466 12/8/2025