Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

kortexio-contextmemory

Thin header helper for ContextMemory — the OpenAI-compatible agentic memory gateway behind Kortexio.

This is not a full SDK. It only builds the auth / tenant headers (Authorization, X-App-Id, X-User-Id, X-Session-Id) so you can keep using the official OpenAI Python client (or httpx / requests).

Beta (0.0.1b*). APIs may still change.
PyPI name: kortexio-contextmemory · Import name: contextmemory

Install

pip install kortexio-contextmemory openai

Quick start (OpenAI Python client)

Point the client at your gateway /v1 base URL (self-host or Cloud):

import os
from openai import OpenAI
from contextmemory import openai_client_kwargs

client = OpenAI(
    **openai_client_kwargs(
        base_url=os.environ.get("CONTEXTMEMORY_BASE_URL", "http://localhost:5100/v1"),
        api_key=os.environ["CONTEXTMEMORY_API_KEY"],  # cm_live_… or self-host key
        app_id="demo-dev",
        user_id="user-42",
        session_id="sess-abc",
    )
)

completion = client.chat.completions.create(
    model="qwen3.5:9b",
    messages=[{"role": "user", "content": "Remember that my staging DB is postgres-staging."}],
)
print(completion.choices[0].message.content)

Headers only (httpx, requests)

import httpx
from contextmemory import headers

h = headers(
    api_key="cm_live_...",
    app_id="demo-dev",
    user_id="user-42",
    session_id="sess-abc",
)

r = httpx.post(
    "http://localhost:5100/v1/chat/completions",
    headers=h,
    json={
        "model": "qwen3.5:9b",
        "messages": [{"role": "user", "content": "Hello"}],
    },
)
print(r.json())

API

Function Purpose
openai_client_kwargs(...) dict for OpenAI(**kwargs) / AsyncOpenAI(**kwargs)
headers(...) Plain dict[str, str] for any HTTP client

Required: api_key (and base_url for the OpenAI helper)
Optional: app_id, user_id, session_id, extra (merged into headers)

Cloud vs self-host

Base URL API key
Self-host http://localhost:5100/v1 (or your host) App key from Admin / config
Kortexio Cloud Cloud API /v1 cmk_live_…

Gateway docs: GitHub README · compare (why not RAG)

License

AGPL-3.0-or-later — same as the ContextMemory core.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kortexio_contextmemory-0.0.1b1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kortexio_contextmemory-0.0.1b1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file kortexio_contextmemory-0.0.1b1.tar.gz.

File metadata

File hashes

Hashes for kortexio_contextmemory-0.0.1b1.tar.gz
Algorithm Hash digest
SHA256 b67df0f33d34627338054f6704ee1c1303badcbc8d165d218069366a6dd5d120
MD5 de344598f22ba613c6648c176db07c18
BLAKE2b-256 853888ad83187995f310d31ef95ae47281b8365a75f9c74e5360a67e6a14327e

See more details on using hashes here.

File details

Details for the file kortexio_contextmemory-0.0.1b1-py3-none-any.whl.

File metadata

File hashes

Hashes for kortexio_contextmemory-0.0.1b1-py3-none-any.whl
Algorithm Hash digest
SHA256 095342e88c9ce73f175a3b9ad64876e169d9be6bd1bcf3c1601ffa453bedd62a
MD5 de69875914e4249e0823ee914b48fe92
BLAKE2b-256 3e9350f49a71eb03052054d03b5b8f3ded2cc12f0736758ce4574469e620c68d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page