fix: Add retry logic for OpenRouter 429 rate limit errors

- Retries up to 3 times with exponential backoff (2s, 4s, 8s)
- Also handles 503 service unavailable errors
- Logs retry attempts for debugging
- Only retries rate limit errors, other errors fail immediately
This commit is contained in:
2025-12-26 00:06:21 +01:00
parent 8ccd600dcb
commit 8cf51d4aea
3 changed files with 64 additions and 32 deletions

View File

@@ -37,4 +37,4 @@ export function getOpenRouterClient(): OpenAI {
}
// Default OpenRouter model for vision tasks
export const OPENROUTER_VISION_MODEL = 'google/gemma-3-27b-it';
export const OPENROUTER_VISION_MODEL = 'google/gemma-3-27b-it:free';