TouAI

Configuration

All SDK settings can be provided either through constructor arguments or environment variables.

Configuration Matrix

ParameterEnv VariableDefaultDescription
access_key_idTOUAI_ACCESS_KEY_IDAPI key ID (ak_live_...)
secret_keyTOUAI_SECRET_KEYAPI secret key (sk_live_...)
base_urlTOUAI_BASE_URLhttps://app.tou.aiAPI base URL
timeoutTOUAI_TIMEOUT60Request timeout in seconds
max_retriesTOUAI_MAX_RETRIES3Max retry attempts for 429 and 5xx responses

Constructor Example

from touai import TouAI
 
client = TouAI(
    access_key_id="ak_live_...",
    secret_key="sk_live_...",
    base_url="https://app.tou.ai",
    timeout=120,
    max_retries=5,
)

Environment-Driven Setup

export TOUAI_ACCESS_KEY_ID=ak_live_...
export TOUAI_SECRET_KEY=sk_live_...
export TOUAI_TIMEOUT=120
export TOUAI_MAX_RETRIES=5
from touai import TouAI
 
client = TouAI()

Use constructor arguments for per-process overrides. Use environment variables when you want consistent configuration across scripts, local shells, and CI jobs.

Retry Behavior

The SDK automatically retries on 429, 500, 502, 503, and 504 responses with exponential backoff and respects Retry-After when present.

AuthenticationClient Lifecycle
Configuration | Documentation