The Memory Layer for Enterprise AI — persistent memory and 40% token cost reduction for any LLM stack
Project description
Cortyxia Python SDK
The Memory Layer for Enterprise AI — persistent memory and 40% token cost reduction for any LLM stack.
Installation
pip install cortyxia
Requires Python >= 3.9.
Quickstart
Set your email and initialize the client. On first run, Cortyxia auto-provisions a project, API key, and ISO token. No signup form required.
import os
os.environ["CORTYXIA_EMAIL"] = "you@example.com"
from cortyxia import Cortyxia
client = Cortyxia() # Auto-provisions on first run
# Chat with automatic memory injection
response = client.chat.completions.create(
messages=[{"role": "user", "content": "What was I working on yesterday?"}]
)
print(response["choices"][0]["message"]["content"])
Credential Storage
Cortyxia stores credentials in two locations for resilience and portability:
| Location | Path | Priority |
|---|---|---|
| Project-local | ./.cortyxia/credentials.json |
1st (highest) |
| Machine-global | ~/.cortyxia/credentials.json |
2nd |
| Environment | CORTYXIA_EMAIL |
Triggers provisioning / override |
Both files are created with 0600 permissions. A ./.cortyxia/.gitignore with * is auto-generated to prevent accidental commits.
Resolution Order
- If
iso_tokenis passed explicitly toCortyxia(), it is used directly. - Otherwise, read
CORTYXIA_EMAILfrom the environment. - Fall back to
./.cortyxia/credentials.json, then~/.cortyxia/credentials.json. - If credentials exist for the resolved email, use them.
- If not, call
/v1/auth/provisionto create a Supabase auth user, default project, and key.
Credential changes propagate to both files automatically.
Email Switching
Change CORTYXIA_EMAIL to switch accounts. Your data is never deleted — each email has its own isolated project world.
import os
os.environ["CORTYXIA_EMAIL"] = "work@company.com"
client = Cortyxia() # Provisions or resumes work@company.com
os.environ["CORTYXIA_EMAIL"] = "personal@gmail.com"
client2 = Cortyxia() # Provisions or resumes personal@gmail.com
If Cortyxia detects another email on the same machine, it stores a soft link and prints a discovery message so you know where your other projects live.
API Reference
Chat
# Non-streaming
response = client.chat.completions.create(
messages=[{"role": "user", "content": "Hello"}],
model="gpt-4o", # optional
temperature=0.7, # optional
max_tokens=256, # optional
)
# Streaming
for line in client.chat.completions.stream(
messages=[{"role": "user", "content": "Hello"}]
):
print(line)
Memory
# Add a memory node
node = client.memory.add(
content="User prefers Rust over Go",
tags=["preference", "language"]
)
# Query memory directly
results = client.memory.query("What language does the user prefer?", limit=5)
Projects
# List all projects
projects = client.projects.list()
# Create a new project
project = client.projects.create("Agentic Coding", shared_memory_enabled=True)
# Get / Delete
project = client.projects.get(project["id"])
client.projects.delete(project["id"])
Keys
# Create a standard key
key = client.keys.create(
project_id=client.project_id,
label="Production Key",
provider="OpenAI",
model="gpt-4o",
)
# Create a developer-mode key (isolated context window for agentic coding)
key = client.keys.create(
project_id=client.project_id,
label="Claude Code Agent",
provider="Anthropic",
model="claude-sonnet-4-20250514",
dev_mode=True,
dev_namespace="isolated",
recent_window_min=2,
recent_window_max=8,
)
# Update
client.keys.update(
project_id=client.project_id,
key_id=key["id"],
dev_mode=False,
recent_window_max=16,
)
# List / Delete
keys = client.keys.list(client.project_id)
client.keys.delete(client.project_id, key["id"])
Self-hosted
# Configure a self-hosted Postgres + Turso backend
client.self_hosted.configure(
postgres_url="postgresql://user:pass@host/db",
libsql_url="libsql://your-db.turso.io",
libsql_auth_token="ey...",
)
# Read / Test / Delete
config = client.self_hosted.get()
result = client.self_hosted.test(postgres_url="...")
client.self_hosted.delete()
Web Dashboard Graduation
SDK-provisioned accounts are fully compatible with the web dashboard. When you sign up on the web with the same email:
- The dashboard detects your SDK-provisioned account via
/api/auth/check-sdk-user. - You set a password via
/api/auth/complete-sdk-signup. - You sign in normally. Your projects, keys, and memory are already there.
Environment Variables
| Variable | Required | Description |
|---|---|---|
CORTYXIA_EMAIL |
Yes (first run) | Email for provisioning and account resolution |
CORTYXIA_URL |
No | Base URL of the project service (default: https://api.cortyxia.com) |
Error Handling
from cortyxia import Cortyxia, CortyxiaError
try:
client = Cortyxia()
except CortyxiaError as e:
print(f"Setup failed: {e}")
License
MIT
Project details
Release history Release notifications | RSS feed
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 cortyxia-0.1.10.tar.gz.
File metadata
- Download URL: cortyxia-0.1.10.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
220fe9dc28c1d1f81cd4f20d4bbb36ce15240316436f7d9c2db811cf49764362
|
|
| MD5 |
2a7e08ebbfbb04e42667accc4e7cac96
|
|
| BLAKE2b-256 |
99ac90c73c908c6e3ea7eba72e016812e4c6ea06abd6ff2011106a32876785a7
|
File details
Details for the file cortyxia-0.1.10-py3-none-any.whl.
File metadata
- Download URL: cortyxia-0.1.10-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afa9e69f7d03c5676dbcbbd0d40ced945e5b8a183b216156b629d9d5b17ea2e7
|
|
| MD5 |
8a9cb619b92cdbb4ea8402e8962e4598
|
|
| BLAKE2b-256 |
869edba9ccfca054e4f271f5b71c3e220e5ccd075135d834d30d2839d5a10e82
|