π§ AI Cortex#
The unified Python toolkit for accessing any LLM through Ollama β zero API keys, zero signup, completely free.
What is AI Cortex?#
AI Cortex gives you a single, clean Python interface to hundreds of language models β Llama, Mistral, Gemma, DeepSeek, Qwen, and more β all served through Ollama. No accounts. No credit cards. No rate limits.
Whether youβre building a chatbot, a code assistant, a research tool, or an AI-powered app, AI Cortex handles the model discovery, server routing, and API compatibility so you donβt have to.
from aicortex import chat
# That's it. One line of Python, any model, any server.
response = chat("Explain neural networks like I'm five.")
print(response)
β¨ Why AI Cortex?#
Feature |
What it means for you |
|---|---|
π 100% Free |
No API keys, no billing, no subscriptions β ever |
π€ Any Model |
Llama, Mistral, Gemma, DeepSeek, Qwen, and more |
π Any Server |
Local Ollama, remote servers, or community endpoints |
β‘ Streaming |
Real-time token streaming for responsive UIs |
π OpenAI-Compatible |
Drop-in replacement for |
π‘οΈ Type-Safe |
Full type hints, stubs, and IDE autocomplete |
π§ Production Ready |
Automatic failover, multi-server routing, error handling |
π¦ Lightweight |
One dependency ( |
π Get Started in 60 Seconds#
pip install aicortex-core
from aicortex import chat, models, families
# Chat with any model
print(chat("What is the speed of light?"))
# Discover what's available
print(families()) # ['llama', 'mistral', 'gemma', 'deepseek', 'qwen']
print(models("mistral")) # ['mistral:7b', 'mistral:instruct', ...]
π Documentation#
Getting Started#
Installation β install options, requirements, and verification
Quick Start β your first chat in 5 minutes
Basic Usage β parameters, patterns, and error handling
Core Reference#
Core API β complete function and class reference
Streaming β real-time token streaming guide
Model Management β families, discovery, metadata
Deployment#
Server Mode β OpenAI-compatible REST API server
Tools β endpoint validation, model fetch/resolve/apply pipeline
Contributing#
Contributing Guide β how to submit issues and PRs
Development Setup β local dev environment, tests, CI
ποΈ Architecture at a Glance#
aicortex/
βββ chat() β Your main entry point
βββ api.py β Ollama client, model registry, server routing
βββ chat.py β Stream / StreamEvent types
βββ models/ β Bundled model metadata (JSON per family)
βββ tools/
βββ check_models.py β Validate live Ollama endpoints
βββ fetch_models.py β Pull model lists from valid endpoints
βββ resolve_models.py β Merge fetched data with IP metadata
βββ apply_valid_models.py β Write resolved models into family JSONs
βββ server.py β OpenAI-compatible FastAPI proxy
π License#
AI Cortex is released under the GNU Lesser General Public License v3.0. You can use it freely in open-source and commercial projects.