Skip to main content

AIWand 🪄

One API to rule them all - Unified OpenAI and Gemini interface with automatic provider switching and structured data extraction from anywhere.

PyPI version Python versions License Coverage Status Downloads Downloads Downloads

🚀 Stop Wrestling with AI APIs

Before: Different APIs, manual JSON parsing, provider-specific code 😫
After: One API, automatic everything ✨

import aiwand
# Works with any model - provider auto-detected
response = aiwand.call_ai(model="gpt-4o", user_prompt="Explain quantum computing?")

# returns structured json data directly
data = aiwand.extract(content="John Doe, john@example.com, (555) 123-4567")

🔧 Installation & Setup

pip install aiwand
export OPENAI_API_KEY="your-key"     # Set either key (or both for fallback)
export GEMINI_API_KEY="your-key"     

💡 Core Features

call_ai - Universal AI Interface

Same code works with OpenAI and Gemini - automatic provider detection:

from pydantic import BaseModel

# Basic AI calls
response = aiwand.call_ai(model="gpt-4o", user_prompt="Explain quantum computing?")

# Structured output - get Pydantic objects directly
class BlogPost(BaseModel):
    title: str
    content: str
    tags: list[str]

blog = aiwand.call_ai(
    model="gemini-2.0-flash",
    user_prompt="Write a blog about AI",
    response_format=BlogPost    # Returns BlogPost object!
)
print(blog.title)  # Direct access, no JSON parsing

# Works with any model
for model in ["gpt-4o", "gemini-2.0-flash", "o3-mini"]:
    response = aiwand.call_ai(model=model, user_prompt=f"What makes {model} special?")

extract - Smart Data Extraction

Extract structured data from text, web links, documents, and images:

from pydantic import BaseModel

class CompanyInfo(BaseModel):
    name: str
    founded: int
    employees: int
    technologies: list[str]

# Extract from individual sources
contact = aiwand.extract(content="John Doe, john@example.com, (555) 123-4567")
webpage = aiwand.extract(links=["https://company.com/about"])
docs = aiwand.extract(document_links=["resume.pdf", "report.docx"])
images = aiwand.extract(images=["chart.png", "diagram.jpg"])

# Or mix all sources together with custom structure
company = aiwand.extract(
    content="Research notes about tech companies...", 
    links=["https://company.com/about"],           # Web pages
    document_links=["annual_report.pdf"],          # Documents  
    images=["company_chart.png"],                  # Images
    response_format=CompanyInfo                    # Get typed object back
)

print(f"{company.name} founded in {company.founded}")  # Direct access

⚡ Quick Examples

import aiwand

# Instant AI calls
summary = aiwand.summarize("Long article...", style="bullet-points")
response = aiwand.chat("What is machine learning?")
story = aiwand.generate_text("Write a haiku about coding")

# Smart classification  
grader = aiwand.create_binary_classifier(criteria="technical accuracy")
result = grader(question="What is 2+2?", answer="4", expected="4")
print(f"Accuracy: {result.score}/5")

🎨 CLI Magic

# Quick chat
aiwand "Explain quantum computing simply"

# Extract from anything
aiwand extract "Dr. Sarah Johnson, sarah@lab.com" --json
aiwand extract --links https://example.com --document-links resume.pdf --images chart.png

# Built-in functions
aiwand summarize "Long text..." --style concise
aiwand chat "Hello there!"

✨ Why Choose AIWand?

🔄 Provider Agnostic Same code, OpenAI or Gemini
🏗️ Structured Output Pydantic objects, no JSON parsing
🧠 Smart Detection Automatic provider selection
📄 Universal Extraction Text, web links, documents, images
⚡ Zero Setup Just add API keys
🎯 Drop-in Ready Minimal code changes

📚 Documentation

🤝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

📝 License

MIT License - see LICENSE file for details.


⭐ Star this repo if AIWand makes your AI development easier!

Made with ❤️ by Aman Kumar

Metadata

Release files for aiwand 0.4.39

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiwand 0.4.39
File Size Uploaded Provenance Actions
aiwand-0.4.39.tar.gz 76.7 kB Without provenance Details for aiwand-0.4.39.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiwand 0.4.39
File Interpreter ABI Platform Actions
aiwand-0.4.39-py3-none-any.whl Python 3 none any Details for aiwand-0.4.39-py3-none-any.whl

Total release size: 117.9 kB

Release files / aiwand-0.4.39.tar.gz

Download URL aiwand-0.4.39.tar.gz
Size 76.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2f74386dab49724b06908f516723f0d45d738d07e0351e1ac3d7ef7b02e4f5b5
BLAKE2b-256 checksum
How to use checksums
4dd5831d522bba1bd3901382974561c9b6ee44f8f609e06f25942b009f73adf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / aiwand-0.4.39-py3-none-any.whl

Download URL aiwand-0.4.39-py3-none-any.whl
Size 41.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a06ab4212a4a86852e0ed1a511af4737ffa6a79022afebeea0c1761754a5a816
BLAKE2b-256 checksum
How to use checksums
cc5cfb680172f92e65d637f516a465fabd7ed11f8108032712b91a0a46ea25d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for aiwand 0.4.39

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.39 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page