AIHuber
aihuber is the easiest and quickest way to communicate with AI providers. Free and open-source.
✨ Features
aihuber is compatible with main AI providers :
Chat completion (Text generation)
AI Providers Comparison
| AI Provider | Buffering sync & async | Streaming (sync & async) | Endpoint |
|---|---|---|---|
| OpenAI | ✅ | ✅ | https://api.openai.com/v1/chat/completions |
| Mistral AI | ✅ | ✅ | https://api.mistral.ai/v1/chat/completions |
| Anthropic | ✅ | ✅ | https://api.anthropic.com/v1/messages |
| Google (Gemini) | ❌ | ❌ | https://generativelanguage.googleapis.com/v1/models/{model}:generateContent |
| Cohere | ✅ | ✅ | https://api.cohere.com/v2/chat |
| Together AI | ✅ | ✅ | https://api.together.xyz/v1/chat/completions |
| Replicate | ❌ | ❌ | https://api.replicate.com/v1/predictions |
| Hugging Face | ❌ | ❌ | https://api-inference.huggingface.co/models/{model_id} |
| Azure OpenAI | ❌ | ❌ | https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-name}/chat/completions?api-version=2024-02-01 |
| AWS Bedrock | ❌ | ❌ | https://bedrock-runtime.{region}.amazonaws.com/model/{model-id}/invoke |
| Perplexity | ✅ | ✅ | https://api.perplexity.ai/chat/completions |
| xAI (Grok) | ❌ | ❌ | https://api.x.ai/v1/chat/completions |
Legend
- ✅ = Available
- ❌ = Not Available
- Text in parentheses = Specific service/model name
🚀 Quick Start
Installation
pip install aihuber
Or with uv:
uv add aihuber
Basic Usage
import asyncio
import os
from dotenv import load_dotenv
from aihuber import LLM, Message
from pydantic import SecretStr
load_dotenv()
MISTRAL_AI_TOKEN = SecretStr(os.getenv("MISTRAL_AI_TOKEN")) # type: ignore
async def main():
"""Chat completion example with asynchronous"""
llm = LLM(model="mistral:mistral-small-latest", api_key=MISTRAL_AI_TOKEN)
messages = [
Message(role="system", content="You are a helpful Python developer assistant."),
Message(role="user", content="Give me 10 numbers from 0"),
]
async_chat_completion = await llm.chat_completion_async(messages, stream=True)
async for chunk in async_chat_completion:
print(chunk)
if __name__ == "__main__":
asyncio.run(main())
📄 License
Metadata
Release files for aihuber 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aihuber-0.3.0.tar.gz | 113.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aihuber-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 133.4 kB
Release files / aihuber-0.3.0.tar.gz
| Download URL | aihuber-0.3.0.tar.gz |
|---|---|
| Size | 113.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
498353b9b871ef8df1745fbc0e3effee20e05028b9af5907c2bf7cfe21f5a975
|
|
BLAKE2b-256 checksum How to use checksums |
d2cda8f4de78535662c1a729b863cd73ca53a41a189b1a5b51e40e52e0e06b04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / aihuber-0.3.0-py3-none-any.whl
| Download URL | aihuber-0.3.0-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a3b131171bcb4e0f63e0be55fa90701a64637922477a1b9872d716d272f8ca6
|
|
BLAKE2b-256 checksum How to use checksums |
4f2264e2a03c7bf58fee56cc217018ce229823e8d6591a32e7be32115bce164b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|