Skip to content

Token Usage and Rate Limits

What is tracked

For each analyze request, PsychAI tracks:

  • Input token count
  • Output token count
  • Request usage against your plan quota

Rate-limit model

  • Quotas are monthly per plan tier
  • Analyze responses include remaining quota and reset time

Plan defaults

Tier Requests per month
Free 10
Pro 100
Enterprise 1000

Quota headers

Successful analyze responses include:

  • X-Requests-Remaining
  • X-Reset-At

If quota is exceeded:

  • Status: 429 Too Many Requests
  • Header: Retry-After

Integration advice

  • Surface remaining quota in your app logs/dashboard
  • Handle 429 with retry/backoff behavior

Input/transcript/mode and estimated-token validation run before quota consumption. A valid admitted request consumes quota even if the provider later fails; retries within that request are not charged as additional requests. One transcript is one request regardless of speaker count. Existing database usage token counts are estimates; content-free pipeline telemetry separately records provider usage.

The default character cap is 50,000 Unicode code points for all tiers. See analysis budgets for the independent token ceilings.

Analysis budgets

Environment variable Default Scope
ANALYSIS_MAX_CHARACTERS 50000 Unicode code points in the complete request
ANALYSIS_MAX_INPUT_TOKENS 100000 Estimated input per category, including instructions and schema
ANALYSIS_MAX_COMPLETION_TOKENS 32768 Completion allowance per category
ANALYSIS_ATTEMPT_TIMEOUT 75 Seconds per provider attempt
ANALYSIS_PIPELINE_TIMEOUT 180 Seconds for the analysis pipeline
ANALYSIS_TOKEN_ENCODING o200k_base Tokenizer used for input estimates

These are application budgets, not claims about the model deployment's context window. The 100,000-character override remains experimental. The frontend's VITE_ANALYSIS_MAX_CHARACTERS build setting should match the API character cap.