Skip to main content

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.
With BYO-JWT, the SDK does not auto-fill org_id / user_id from /auth/verify. Pass them to the constructor. remember and recall need them in the request scope.
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 pooled httpx.Client under the hood. Construct once, reuse everywhere.

Concurrency

The client is thread-safe for read traffic (recall, usage.today). For high write volume, push remember calls to a worker pool:
A native async client is on the roadmap.

Closing

Or use the context manager pattern above. __exit__ calls close().

Next: Remember

Push conversation turns into memory.