Tex(...) constructor
Create one Tex client and reuse it. The same client handles remember, recall, token refresh, retries, and usage calls.
str
Your API key. Falls back to
TEX_API_KEY env var.str
Base URL of the Tex API. Falls back to
TEX_BASE_URL. Required for production:https://api.getmetacognition.com
str | None
Default
org_id for all requests. Optional. The SDK auto-fills it from your JWT.str | None
Default
user_id. Set this for end-user partitioning in multi-tenant SaaS.str | None
Default
session_id. Most apps pass this per call.str | None
Bring-your-own JWT. If set, the SDK skips the
api_key exchange.str | None
Companion to
access_token. Used for refresh on 401.float
default:"60.0"
Per-request timeout in seconds.
int
default:"2"
Retries transient errors: 408, 429, 5xx, and network failures.
bool
default:"true"
HTTP/2 multiplexing. Disable if your egress proxy strips it.
Environment variables
A
.env template:
Lifecycle
The client keeps a pooledhttpx.Client under the hood. Construct once, reuse everywhere.
- ✅ Module-level
- ✅ Context manager
- ❌ Per-request
Concurrency
The client is thread-safe for read traffic (recall, usage.today).
For high write volume, push remember calls to a worker pool:
Closing
__exit__ calls close().
Next: Remember
Push conversation turns into memory.

