Skip to main content

AI Made Stupid Simple. Unified API for OpenAI, Groq, Google, and more.

Project description

askai-python 🚀

A minimal Python SDK to switch between LLM providers in one line.
No frameworks. No servers. No overengineering.

PyPI version License: MIT GitHub


⚡ Quick Start (5 seconds)

pip install askai-python
from ask_ai import OpenAI, Groq

# Auto-detects OPENAI_API_KEY from environment
print(OpenAI().ask("Explain black holes like I'm 5").text)

# Switch provider instantly
print(Groq().ask("Explain black holes like I'm 5").text)

🧐 Why ask-ai?

  • One function: Just call .ask()
  • Multiple providers: OpenAI, Anthropic, Google Gemini, Groq, Azure, OpenRouter
  • Zero config: Keys are pulled from the environment automatically
  • SDK-first, not a framework: It stays out of your way.

🚫 What this project is NOT

❌ Not an AI framework
❌ Not an API gateway
❌ Not an agent memory system

It does one thing perfectly: Simplifying the API call to LLMs.


🛠️ Advanced Usage

🧰 Developer QoL Utilities (Auto-Parsing)

Stop writing Regex to clean up model outputs! ask-ai comes with built-in text processing flags:

from ask_ai import OpenAI
ai = OpenAI()

# 1. Clean Markdown (Removes ```json and ``` tags)
# Perfect for extracting raw data from models that wrap everything in markdown
clean_text = ai.ask("Write JSON", clean=True).text

# 2. Extract Code (Returns ONLY the code block, ignores conversational filler)
# Great for automation pipelines
code = ai.ask("Write a python ping script", code=True).text

# 3. Strip Tags (Removes <think> blocks and HTML)
# Essential for reasoning models like DeepSeek-R1
answer_only = ai.ask("What is 1+1?", strip=True).text

# 4. Enforce & Parse JSON (Directly returns a Parsed Python Dictionary)
# Adds JSON instructions to the prompt and safely runs json.loads()
data_dict = ai.ask("Extract user info", json=True).json
print(data_dict['name'])

🚀 Built-in Resiliency (Retries & Timeouts)

Build reliable apps without writing your own loops. askai-python handles rate limits (429) and network drops via an internal exponential backoff.

from ask_ai import OpenAI

ai = OpenAI()

# Automatically retries up to 3 times on transient errors, with a 15-second timeout
response = ai.ask(
    "Write a complex python script", 
    retry=3, 
    timeout=15 
)

🔌 Supported Providers

Provider Class Capabilities
OpenAI OpenAI Text, Images (DALL-E), Vision
Anthropic Anthropic Text, Vision (Claude 3.5)
Google Google Text, Images, Video, Audio
Groq Groq Ultra-fast Llama 3 & Mixtral
Azure Azure Enterprise-grade OpenAI
OpenRouter OpenRouter 100+ community models

🗺️ Roadmap

  • Baseline multiple providers
  • Automated Retry & Timeout controls
  • Async API (await ask_async)
  • Provider Fallback (fallback=[Groq()])
  • Structured Outputs (Pydantic Support)

🔗 Important Links

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

askai_python-0.2.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

askai_python-0.2.1-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file askai_python-0.2.1.tar.gz.

File metadata

  • Download URL: askai_python-0.2.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for askai_python-0.2.1.tar.gz
Algorithm Hash digest
SHA256 44820e0930b2b8c7438cc4ab79593298068ee6f8c32415475be76c5c36483ac6
MD5 9e7eaa6035e0a8b9ddabc364d1e40c4a
BLAKE2b-256 afe61a46822fda3ba20e581887ae975865e104acae1bc1d05f72e90a0fc627d4

See more details on using hashes here.

File details

Details for the file askai_python-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: askai_python-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for askai_python-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 caa4c2ebb8c2201a3aeef4714c1dae8e68c2de737ecdbd749dbffdd5b50fa64a
MD5 4c752a6f0223a19e381564539a32a7b6
BLAKE2b-256 117386403d4e3b3e2edbce6290f66c4cfbcc7e48fe8d7901b370358ce5392cd2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page