Installation
Requirements
- Python 3.10 or newer.
- An external agent registered in CortexHub.
- An API key beginning with cxh_key_, or a programmatic MCP OAuth client.
Install
pip install cortexhub
pip install "cortexhub[ai]"
pip install "cortexhub[mcp]"
pip install "cortexhub[all]"
The core package builds connection objects. The ai extra provides the OpenAI-compatible client and the mcp extra provides the official MCP client support.
Environment variables
| Variable | Default | Used by |
|---|---|---|
| CORTEXHUB_API_KEY | none | Agent API key |
| CORTEXHUB_URL | https://mcp.cortexhub.ai | MCP connection and OAuth token requests |
| CORTEXHUB_ROUTER_URL | https://api.cortexhub.ai/v1 | AI gateway |
| CORTEXHUB_CLIENT_ID | none | Programmatic MCP OAuth |
| CORTEXHUB_CLIENT_SECRET | none | Programmatic MCP OAuth |
from cortexhub import Cortexhub
cx = Cortexhub()
Keep credentials out of source control and application logs. If both API-key and OAuth credentials are configured, the API-key path takes precedence.