Free multi-provider AI SDK with terminal TUI, OpenAI-compatible API, and 27+ provider routing
Project description
AI Synapse
Free multi-provider AI SDK — drop-in OpenAI client, optional local server, and a terminal chat UI. Routes across 27+ providers with automatic failover, model caching, and intent-aware routing.
pip install ai-synapse # SDK
pip install ai-synapse[tui] # + terminal chat UI
pip install ai-synapse[all] # SDK + TUI + server extras
Terminal UI (recommended)
ChatGPT-style chat in your terminal:
python -m ai_engine tui
| Feature | How |
|---|---|
| Model picker | F2 — search, favorites (☆), paginated list |
| Provider | F3 — auto or pinned provider |
| Attach files | @filename fuzzy picker, or Attach button |
| Read file into prompt | /read + fuzzy picker |
| Slash commands | /help, /persona, /export, /defaults, … |
| Defaults | /defaults save · /defaults clear restore · shown in sidebar |
| Sidebar | Ctrl+B collapse · hidden scrollbar chat list |
| Copy | Ctrl+C / y — selection first, then last reply |
Data lives under ~/.ai-engine/ (chats, preferences, personas).
Python SDK
No server required — call providers directly:
from ai_engine import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=[{"role": "user", "content": "Hello!"}],
provider="groq", # optional; auto-routes if omitted
)
print(response.choices[0].message.content)
Streaming:
stream = client.chat.completions.create(
model="default",
messages=[{"role": "user", "content": "Tell me a joke"}],
stream=True,
)
for chunk in stream:
piece = chunk.choices[0].delta.content or ""
print(piece, end="", flush=True)
CLI:
ai-engine chat "Explain quantum tunneling"
ai-engine providers
ai-engine version
Local server (optional)
OpenAI-compatible HTTP API + web dashboard:
cp .env.example .env # add free-tier API keys
pip install ai-synapse[server]
python -m ai_engine serve
# API: http://localhost:8000/v1/ · Docs: http://localhost:8000/docs
Use with the official OpenAI Python client:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
Providers
No key: Pollinations, Hermes, G4F proxies, OpenCode Zen, and more.
Free tier (signup): Groq, OpenRouter, Gemini, NVIDIA, Cerebras, Cloudflare, GitHub Models, Mistral, Cohere, Hugging Face, Vercel, Kilo.
Bring your own key: hcnsec, LLM7, PaxSenix, Ollama, self-hosted G4F.
Provider list and keys: see docs/collect_api.md. CDN config sync can refresh provider definitions at runtime (CDN_CONFIG_URL=default).
Configuration
cp .env.example .env
Set any keys you have — more keys mean more failover paths. The engine skips providers without credentials.
| Variable | Purpose |
|---|---|
GROQ_API_KEY |
Groq free tier |
OPENROUTER_API_KEY |
OpenRouter free models |
GEMINI_API_KEY |
Google Gemini |
GITHUB_TOKEN |
GitHub Models |
| … | See .env.example |
Project layout
| Path | Role |
|---|---|
ai_engine/ |
PyPI package — SDK, TUI, CLI |
core/ |
Provider engine, cache, capabilities |
server.py |
Standalone FastAPI server (repo checkout) |
docs/ |
API, deployment, security guides |
Development
git clone https://github.com/mihir0209/AI_engine.git
cd AI_engine
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev,all]"
pytest tests/
Documentation
License
MIT — see LICENSE.
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 ai_synapse-1.0.0.tar.gz.
File metadata
- Download URL: ai_synapse-1.0.0.tar.gz
- Upload date:
- Size: 247.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba615512c40559cdd7907bc1fbbbc7983d60ded177cc807c670159eb690f4dc1
|
|
| MD5 |
46fac1c258358c55ed081217a1d92b87
|
|
| BLAKE2b-256 |
5161c355a0334c9315392c374101689ac173f7ee695f7a6eb5256981b6b3013d
|
File details
Details for the file ai_synapse-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ai_synapse-1.0.0-py3-none-any.whl
- Upload date:
- Size: 238.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0c9b86ebe89b428c34e222898789d2af27cee0fc70b9a1b80093e9804da90f2
|
|
| MD5 |
cde6677dc9ae03ac71d1d82bfce0792c
|
|
| BLAKE2b-256 |
57a6ececa32b8b99bfaa0396d5e95794f92ed1cdd315dcb7382d8b7bf7d4ffdb
|