Files
archon/python
leex279 185b952c62 refactor: Implement provider-agnostic error handling architecture
Transform OpenAI-specific error handling into extensible multi-provider system
that supports OpenAI, Google AI, Anthropic, Ollama, and future providers.

## Backend Enhancements
- Add ProviderErrorAdapter pattern with provider-specific implementations
- Create ProviderErrorFactory for unified error handling across providers
- Refactor API key validation to detect and handle any provider
- Update error sanitization to use provider-specific patterns
- Add provider context to all error responses

## Frontend Enhancements
- Rename interfaces from OpenAI-specific to provider-agnostic
- Update error detection to work with any provider name
- Add provider context to error messages and guidance
- Support provider-specific error codes and classifications

## Provider Support Added
 OpenAI: sk-* keys, org/proj/req IDs, quota/rate limit patterns
 Google AI: AIza* keys, googleapis.com URLs, project patterns
 Anthropic: sk-ant-* keys, anthropic.com URLs
 Ollama: localhost URLs, connection patterns (no API keys)

## Error Message Examples
- OpenAI: 'Invalid or expired OpenAI API key. Please check your API key in settings.'
- Google: 'Invalid or expired Google API key. Please check your API key in settings.'
- Anthropic: 'Invalid or expired Anthropic API key. Please check your API key in settings.'

## Security Features
- Provider-specific sanitization patterns prevent data exposure
- Auto-detection of provider from error content
- Structured error codes for reliable classification
- Enhanced input validation and ReDoS protection

This addresses the code review feedback to make error handling truly generic
and extensible for all LLM providers, not just OpenAI, while maintaining
the same level of user experience and security for each provider.
2025-09-12 21:47:25 +02:00
..