LLM Provider - SAP AI Core Integration for VSCode

Integrate SAP AI Core models seamlessly with VSCode's Language Model API for enhanced AI-powered development.
🚀 Features
Core Capabilities
- 🤖 AI Model Integration: Access SAP AI Core foundation models directly within VSCode
- 💬 Chat Provider: Native integration with VSCode's chat interface
- 🔄 Real-time Streaming: Support for streaming responses from AI models
- 🔐 Secure Credential Management: Encrypted storage of SAP AI Core credentials
- 📊 Token Estimation: Accurate token counting for cost management
- 🎯 Multi-Scenario Support: Foundation models and orchestration scenarios
Advanced Features
- ⚡ Version Compatibility: Automatic detection and adaptation to different VSCode API versions
- 🔧 Diagnostic Tools: Built-in API compatibility checking and troubleshooting
- 📝 Comprehensive Logging: Configurable logging levels for debugging and monitoring
- 🔄 Model Cache Management: Efficient caching with manual refresh capabilities
- 🎛️ Configuration Management: Flexible scenario switching and model selection
📦 Installation
From VSCode Marketplace
- Open VSCode
- Go to Extensions (
Ctrl+Shift+X
/ Cmd+Shift+X
)
- Search for "LLM Provider"
- Click Install
Manual Installation
- Download the latest
.vsix
file from Releases
- Open VSCode
- Run
Extensions: Install from VSIX...
from Command Palette
- Select the downloaded
.vsix
file
⚙️ Configuration
1. SAP AI Core Credentials Setup
The extension requires SAP AI Core credentials to function. Set up your credentials using the Command Palette:
- Open Command Palette (
Ctrl+Shift+P
/ Cmd+Shift+P
)
- Run
SAP AI Core: Manage Credentials
- Select
Set/Update Credentials
- Enter your credential JSON:
{
"clientid": "your-client-id",
"clientsecret": "your-client-secret",
"url": "https://your-auth-url",
"aiApiUrl": "https://your-ai-api-url",
"resourceGroup": "your-resource-group"
}
2. Scenario Configuration
Configure the AI scenario in your VSCode settings:
{
"sapAiCore.scenarioId": "foundation-models"
}
Available scenarios:
foundation-models
- Direct access to foundation models (default)
orchestration
- Advanced orchestration capabilities (future)
3. Logging Configuration
Control logging verbosity for debugging:
{
"sapAiCore.logLevel": "info"
}
Log levels: debug
| info
| warn
| error
🎯 Usage
Basic Chat Integration
- Open VSCode Chat: Use
Ctrl+Alt+I
/ Cmd+Alt+I
- Select SAP AI Core: Choose from the model dropdown
- Start Chatting: Ask questions or request code assistance
Command Palette Actions
Command |
Description |
SAP AI Core: Manage Credentials |
Set up or update your SAP AI Core credentials |
SAP AI Core: Refresh Models |
Clear model cache and reload available models |
SAP AI Core: Check API Compatibility |
View compatibility diagnostics |
SAP AI Core: Test API Compatibility |
Run compatibility detection tests |
Credential Management
- View Status: Check which credentials are configured
- Update Credentials: Modify existing credential configuration
- Remove Credentials: Securely delete stored credentials
- Legacy Cleanup: Remove old API key formats
🔧 Development
Prerequisites
- Node.js 18+
- VSCode 1.103.0+
- TypeScript 5.8+
Setup
# Clone the repository
git clone https://github.com/anjanpoonacha/llmprovider.git
cd llmprovider
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Run tests
npm test
# Package extension
npm run package
Project Structure
src/
├── commands/ # VSCode commands
├── config/ # Configuration and constants
├── core/ # Core extension logic
├── providers/ # Language model providers
├── services/ # Business logic services
├── strategies/ # AI scenario strategies
├── types/ # TypeScript definitions
└── utils/ # Utility functions
Architecture Highlights
- 🏗️ Modular Design: Clean separation of concerns with dependency injection
- 🔄 Adapter Pattern: Support for multiple VSCode API versions
- 🎯 Strategy Pattern: Flexible AI scenario handling
- 📊 Universal Provider: Unified interface for different model types
- 🔍 Compatibility System: Automatic API version detection and adaptation
🐛 Troubleshooting
Common Issues
Extension not loading models:
- Check credentials:
SAP AI Core: Manage Credentials
→ View Credential Status
- Verify API compatibility:
SAP AI Core: Check API Compatibility
- Refresh models:
SAP AI Core: Refresh Models
Authentication errors:
- Verify your SAP AI Core credentials are correct
- Check network connectivity to SAP AI Core endpoints
- Ensure resource group has proper permissions
Performance issues:
- Adjust log level to
warn
or error
in production
- Clear model cache if experiencing stale data
- Check VSCode version compatibility
Debug Mode
Enable detailed logging for troubleshooting:
{
"sapAiCore.logLevel": "debug"
}
View logs in: Output → SAP AI Core Language Model Provider
📋 Requirements
System Requirements
- VSCode: Version 1.103.0 or higher
- Node.js: Version 18+ (for development)
- Operating System: Windows, macOS, or Linux
SAP AI Core Requirements
- Valid SAP AI Core subscription
- Configured service instance with appropriate permissions
- Network access to SAP AI Core endpoints
🤝 Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Workflow
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
Code Standards
- Follow TypeScript strict mode guidelines
- Use ESLint configuration provided
- Write tests for new features
- Update documentation as needed
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔗 Links
📞 Support
- GitHub Issues: For bug reports and feature requests
- Documentation: Check the inline help and command descriptions
- Logs: Enable debug logging for detailed troubleshooting information
Made with ❤️ for the SAP AI Core and VSCode communities