Tex(...) constructor
Create one Tex client and reuse it. The same client handles remember, recall, token refresh, retries, and usage calls.
Your API key. Falls back to
TEX_API_KEY env var.Base URL of the Tex API. Falls back to
TEX_BASE_URL. Required for production:https://api.getmetacognition.com
Default
org_id for all requests. Optional. The SDK auto-fills it from your JWT.Default
user_id. Set this for end-user partitioning in multi-tenant SaaS.Default
session_id. Most apps pass this per call.Bring-your-own JWT. If set, the SDK skips the
api_key exchange.Companion to
access_token. Used for refresh on 401.Per-request timeout in seconds.
Retries transient errors: 408, 429, 5xx, and network failures.
HTTP/2 multiplexing. Disable if your egress proxy strips it.
Environment variables
| Variable | Purpose |
|---|---|
TEX_API_KEY | Read by the constructor when api_key= is omitted. |
TEX_BASE_URL | Read by the constructor when base_url= is omitted. |
.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.

