layered-soul/memories/curated/api-timezone-handling.md
Hermes & Sam a38b60e775 feat: quota exhaustion policy scripts + docs (rename ETR→ETA)
- scripts/quota_reset_eta.py: timezone-aware quota reset calculator
- scripts/task_dedup_before_retry.py: skip retry if task already resolved
- AGENTS.md: cross-harness 4-step quota policy
- SOUL.md: 'Never retry solved work' principle
- memories/curated/api-timezone-handling.md: provider timezone map
2026-06-17 11:58:43 +02:00

1.3 KiB

API Timezone Handling

API quota reset timestamps are provider-specific and often lack timezone metadata. Always convert to UTC before scheduling retries.

Provider timezone map

Provider Timezone UTC offset Example
Z.AI / GLM (Zhipu) Asia/Shanghai UTC+8 "15:43" → 07:43 UTC
DeepSeek Asia/Shanghai UTC+8 Chinese company, Hangzhou
OpenRouter UTC UTC+0 Timestamps are UTC
Anthropic America/Los_Angeles UTC-8/-7 (PDT/PST) California
OpenAI America/Los_Angeles UTC-8/-7 (PDT/PST) California

Detection

Use scripts/quota_reset_eta.py to parse error messages and compute the correct reset time. It detects providers via keywords ("z.ai", "智谱", "使用上限", "deepseek", "openrouter", "anthropic", "openai") and applies the correct timezone.

Common traps

  • Chinese error messages lack timezone: "您的限额将在 2026-06-18 15:43:27 重置" means Beijing time (UTC+8), not UTC.
  • English messages may include timezone: "reset on 2026-06-20T00:00:00Z" is explicit (Z = UTC). Trust explicit timezone over provider guess.
  • Retry-After header: in seconds from now, not an absolute timestamp.
  • CEST vs CET: Slovenia uses CEST (UTC+2) in summer, CET (UTC+1) in winter. Always compute from datetime objects, not hardcoded offsets.