How your API key becomes a JWT, how the SDK refreshes it, and where to store secrets in dev and prod.
If you only need a working client, start with the Quickstart. Come back here when you are wiring secrets, using your own JWT, or rotating keys.
The SDK starts with your API key. On the first real call, it exchanges that key for short-lived access and refresh tokens.After that, the client keeps the tokens in memory, refreshes them when needed, and retries the original call. Most apps never need to handle raw token strings.
/auth/login is disabled in production. It returns 403 unless the integration backend runs with DEBUG=true. Use this only for local development against a self-hosted backend. In production, use an API key.
from tex import Tex, AuthenticationErrortry: tex = Tex(api_key="tex_live_BOGUS", base_url="https://api.getmetacognition.com") tex.usage.today()except AuthenticationError as e: print(e.status_code) # 401 print(e.message) # "Invalid API key" or similar print(e.request_id) # Quote this when filing tickets
Token lifetimes. Access JWTs last 24h. Refresh JWTs last 7d. After that, the SDK exchanges your API key again. To invalidate tokens, revoke the API key they came from.
Next: multi-user memory
How org_id / user_id / session_id partition memory.