mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-10-05 20:28:23 +00:00
OpenRouter occasionally answers /models with a truncated body, so the JSON parse fails. Any exception returned [] for the whole fetch behind one log line, leaving an enabled upstream advertising zero models, with no retry. Split into a single-attempt helper plus a wrapper that retries it 3 times and then returns [] as before. Only /models can fail an attempt; a failing /embeddings/models logs a warning and contributes nothing, so a secondary outage cannot empty the catalogue. Only transient errors retry — a 4xx gives up immediately. The per-attempt timeout drops to 10s so three attempts stay near the old budget: this fetch blocks startup and the refresh loop. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>