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)

ask-ai features parsing banner

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)

ask-ai resiliency banner

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.3.3.tar.gz (17.5 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.3.3-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: askai_python-0.3.3.tar.gz
  • Upload date:
  • Size: 17.5 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.3.3.tar.gz
Algorithm Hash digest
SHA256 bdb1cefcd12aa7d73f484ef36890c766cc6535a2be19be5395267c1889bdace2
MD5 511ff1f550661e196a8a0116e6ed74d1
BLAKE2b-256 f041f7d0ccce2eb3f743ed4339593f17cb6a1ace65befb4416d517098602c125

See more details on using hashes here.

File details

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

File metadata

  • Download URL: askai_python-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 20.3 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.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 29aa95c0ebe9d78100e7578f0e015d709eac5f4701448a6ec2862dd2c0f43df8
MD5 627eea7d69d1d71fc76166dc1f41637f
BLAKE2b-256 fdc5a214a9c70dd40037d67388bc5b74af25ff73768a3b45c4a10ca71e883d54

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