chaos-coder
chaos-coder copied to clipboard
feat: Add OpenAI Compatible API support
- Add multi-provider AI service architecture supporting OpenAI, Groq, Anthropic, local Ollama, and custom endpoints
- Implement unified AI service abstraction layer with automatic provider switching
- Create user-friendly configuration interface with real-time validation
- Add persistent configuration storage in localStorage
- Maintain backward compatibility with existing Portkey integration
- Enhance error handling and fallback mechanisms
- Update documentation and add environment variable examples
New files:
- nextjs-web-app/src/lib/ai-config.ts - AI provider configuration management
- nextjs-web-app/src/lib/ai-service.ts - Unified AI service abstraction
- nextjs-web-app/src/hooks/useAIConfig.ts - Configuration management hook
- nextjs-web-app/src/components/AIConfigModal.tsx - Configuration UI modal
- nextjs-web-app/src/components/AIConfigButton.tsx - Configuration button component
- nextjs-web-app/.env.example - Environment variables template
- nextjs-web-app/src/lib/tests/ai-config.test.ts - Unit tests
Modified files:
- nextjs-web-app/src/app/api/generate/route.ts - Multi-provider API support
- nextjs-web-app/src/app/page.tsx - AI configuration integration
- nextjs-web-app/src/app/results/page.tsx - Provider selection support
- README.md - Updated documentation with new features
Features:
- Support for 6 different AI providers out of the box
- Seamless provider switching without application restart
- Real-time configuration validation with user feedback
- Secure API key storage and management
- Full TypeScript support with proper type safety
- Comprehensive error handling and user-friendly messages
- No breaking changes - fully backward compatible