AI Made Stupid Simple. Unified API for OpenAI, Groq, Google, and more.
Project description
askai-python 🚀
AI Made Stupid Simple. One unified Python client for OpenAI, Claude, Gemini, Groq, and Azure.
⚡ What is askai-python?
askai-python is a lightweight, zero-dependency-logic wrapper that provides a single API for all major AI providers. Stop learning multiple SDKs; just call .ask() and get your answer.
- Unified Interface: One syntax for OpenAI, Anthropic, Google, and more.
- Zero-Config: Seamlessly uses environment variables for API keys.
- Smart Media: Easy handling of images and audio (Provider permitting).
- Production Grade: Built-in robust error handling and type hints.
📦 Installation
pip install askai-python
🚀 Examples & Tutorials
1. Basic Usage (The 3-Line Magic)
from ask_ai import OpenAI
ai = OpenAI() # Auto-loads OPENAI_API_KEY from env
print(ai.ask("What is the capital of France?").text)
2. Multi-Provider Mastery
Switching between top-tier models has never been easier:
from ask_ai import OpenAI, Anthropic, Google
prompt = "Explain quantum computing to a 5-year-old."
# OpenAI (GPT-4o)
print(OpenAI().ask(prompt).text)
# Anthropic (Claude 3.5 Sonnet)
print(Anthropic().ask(prompt).text)
# Google (Gemini 1.5 Pro)
print(Google().ask(prompt).text)
3. Advanced Configuration (System Personas)
You can set a system prompt and temperature globally for an instance or per-request.
from ask_ai import OpenAI
ai = OpenAI()
# Global config
ai.advanced(
prompt="You are a sarcastic robot from the year 3000.",
temperature=0.9
)
print(ai.ask("What is love?").text)
# Per-request override
print(ai.ask("What is 1+1?", temperature=0.1).text)
4. Handling Structured Exceptions
Build reliable apps by catching specific AI errors:
from ask_ai import OpenAI
from ask_ai.exceptions import AskAIError, APIKeyError
try:
ai = OpenAI(api_key="invalid-key")
ai.ask("Hello")
except APIKeyError:
print("Check your API keys!")
except AskAIError as e:
print(f"An AI error occurred: {e}")
🔌 Supported Providers
| Provider | Class | Capabilities |
|---|---|---|
| OpenAI | OpenAI |
Text, Images (DALL-E), Vision |
| Anthropic | Anthropic |
Text, Vision (Claude 3.5) |
Google |
Text, Images, Video, Audio | |
| Groq | Groq |
Ultra-fast Llama 3 & Mixtral |
| Azure | Azure |
Enterprise-grade OpenAI |
| OpenRouter | OpenRouter |
100+ community models |
🔗 Important Links
- GitHub Repository: Hosseinghorbani0/ask-ai (Star us! ⭐)
- Official Website: hosseinghorbani0.ir
- Bug Tracker: Report an Issue
Built with ❤️ by Hossein Ghorbani.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file askai_python-0.1.6.tar.gz.
File metadata
- Download URL: askai_python-0.1.6.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2738379759b1bf881b9d3688307898b1e4e3d2441c1792228e3dca3958469a17
|
|
| MD5 |
631dd08bcdeb11176ec8b657f8940a1e
|
|
| BLAKE2b-256 |
7e004403b6ff86bcb880a5dfc572acdbb1d0946f977d1cd7a4dceda638e91dc1
|
File details
Details for the file askai_python-0.1.6-py3-none-any.whl.
File metadata
- Download URL: askai_python-0.1.6-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de0f9c848000b4236759d66c5af3fb5aca477d31e4444652a1799a891883e3e2
|
|
| MD5 |
7a73d0cc0bd270c7d5a5dde0d7506aeb
|
|
| BLAKE2b-256 |
6d1b58647ef4f0449594b6d091d6f15e86b815b90ad581149e51bc5193743af3
|