AI Search API Python Client
A Python client library for the AI Search API that provides semantic search, contextual awareness, and intelligent AI-powered results.
This package makes it easy for developers to integrate the AI Search API into Python projects.
👉 To start, get your free API key from the AI Search API dashboard.
Features
- 🔍 AI-Powered Semantic Search: Natural language search powered by embeddings
- 🎯 Context Awareness: Include history for smarter results
- ⚡ Simple API Client: Clean Python interface with error handling
- 🛡️ Type Safety: Strong type hints
- 🔄 Flexible Output: Get text or markdown results
- 💰 Usage Tracking: Monitor your API credit balance anytime
Installation
Install from PyPI:
pip install aisearchapi-client
Or install from source:
git clone https://github.com/aisearchapi/aisearchapi-python.git
cd aisearchapi-python
pip install -e .
Quick Start
Get Your API Key
- Sign up at aisearchapi.io.
- Log in to the dashboard.
- Copy your API key.
Use this key when creating a client:
from aisearchapi_client import AISearchAPIClient
client = AISearchAPIClient(api_key="your-api-key-here")
Basic Usage Example
from aisearchapi_client import AISearchAPIClient
client = AISearchAPIClient(api_key="your-api-key-here")
result = client.search(
prompt="What is machine learning and how does it work?",
response_type="markdown"
)
print("Answer:", result.answer)
print("Sources:", result.sources)
print(f"Total time: {result.total_time}ms")
balance = client.balance()
print(f"Available credits: {balance.available_credits}")
client.close()
Advanced Usage
Contextual Search
from aisearchapi_client import AISearchAPIClient, ChatMessage
with AISearchAPIClient(api_key="your-api-key-here") as client:
result = client.search(
prompt="What are the main advantages and disadvantages?",
context=[
ChatMessage(role="user", content="I am researching solar energy for my home"),
ChatMessage(role="user", content="I live in a sunny climate with high electricity costs")
],
response_type="text"
)
print("Contextual Answer:", result.answer)
Custom Configuration
client = AISearchAPIClient(
api_key="your-api-key-here",
base_url="https://api.aisearchapi.io",
timeout=60
)
API Reference
Full API reference is available in the official documentation.
Error Handling
from aisearchapi_client import AISearchAPIClient, AISearchAPIError
try:
with AISearchAPIClient(api_key="your-api-key") as client:
result = client.search(prompt="Your query")
print(result.answer)
except AISearchAPIError as e:
print(f"API Error [{e.status_code}]: {e.description}")
Environment Variables
export AI_SEARCH_API_KEY="your-api-key-here"
Then use in Python:
import os
from aisearchapi_client import AISearchAPIClient
api_key = os.getenv("AI_SEARCH_API_KEY")
client = AISearchAPIClient(api_key=api_key)
Development
git clone https://github.com/aisearchapi/aisearchapi-python.git
cd aisearchapi-python
python -m venv venv
source venv/bin/activate
pip install -e ".[dev,test]"
pytest
License
MIT License - see the LICENSE file.
Support
- Get API Key: AI Search API Dashboard
- Documentation: docs.aisearchapi.io
- Homepage: aisearchapi.io
- Issues: GitHub Issues
Metadata
Release files for aisearchapi-client 1.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aisearchapi_client-1.0.8.tar.gz | 11.7 kB | Without provenance | Details for aisearchapi_client-1.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aisearchapi_client-1.0.8-py3-none-any.whl | Python 3 | none | any | Details for aisearchapi_client-1.0.8-py3-none-any.whl |
Total release size: 21.1 kB
Release files / aisearchapi_client-1.0.8.tar.gz
| Download URL | aisearchapi_client-1.0.8.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e5a65bbdb717edb0bb1e790fa13f8ea56b8a8767eb0df54c1e667aa72d8a23a
|
|
BLAKE2b-256 checksum How to use checksums |
b21586415f89df2b66391be0361ad6e03a2c15b21ef7d45c1771c439f1b56d72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / aisearchapi_client-1.0.8-py3-none-any.whl
| Download URL | aisearchapi_client-1.0.8-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3bc0586a8fb9c3d8266a3960993bec9a7124959ec2b97242e22c5e2c8fda7b5d
|
|
BLAKE2b-256 checksum How to use checksums |
76e3155766871afda8f4dc1c95d961dc631ddd5033b1fa9cbaaa776d0085ef3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for aisearchapi-client 1.0.8
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.