Cloud LM Provider
🚀 The [#1](https://github.com/suddhu-iith2004/cloud-lm-provider/issues/1) Extension for AWS Bedrock & Azure OpenAI in VS Code
Bring Claude 4.5, GPT-4o, Nova, DeepSeek, Llama, and 50+ enterprise AI models directly into GitHub Copilot Chat โ with intelligent token compression that saves you up to 40% on API costs.
Quick Start โข
Features โข
Headroom AI โข
Models โข
Configuration โข
FAQ
🎯 Why Cloud LM Provider?
| Challenge |
Solution |
| 🔒 Enterprise Compliance |
Use your own AWS/Azure credentials โ data never leaves your cloud |
| 💰 Expensive API Costs |
Headroom AI compresses context by 30-45%, saving thousands monthly |
| 🐌 Slow Model Switching |
Instant access to 50+ models in one dropdown |
| 🔧 Complex Setup |
One-click configuration wizard with auto-discovery |
| 📊 No Cost Visibility |
Real-time token tracking & savings dashboard |
โก Quick Start
Installation
Install from VS Code Marketplace
ext install suddhu-iith2004.cloud-lm-provider
Or search "Cloud LM Provider" in the Extensions sidebar.
Run the Configuration Wizard
Ctrl+Shift+P โ "Cloud LM: Manage Provider Configuration"
Choose Your Provider
- AWS Bedrock: Enter credentials or use AWS CLI profile
- Azure OpenAI: Enter endpoint URL and API key
Start Chatting
- Open GitHub Copilot Chat (
Ctrl+Alt+I)
- Select your preferred model from the dropdown
- Experience enterprise AI in your IDE!
โจ Features
🌐 Multi-Cloud AI Access
Access 50+ enterprise AI models from a single extension:
AWS Bedrock Models
- Anthropic Claude โ 4.5 Opus, 4.5 Sonnet, 3.7, 3.5, Haiku
- Amazon Nova โ Premier, Pro, Lite, Micro, Sonic
- Meta Llama โ 3.3 70B, 3.2, 3.1 variants
- Mistral AI โ Large, Small, 7B
- Cohere โ Command R, Command R+
- DeepSeek โ R1 Reasoning Model
- AI21 Jamba โ 1.5 Large, Mini
|
Azure OpenAI Models
- GPT-5 โ Latest frontier reasoning & coding models
- GPT-4o โ Latest multimodal flagship
- GPT-4 Turbo โ 128K context window
- GPT-4 โ Original reasoning model
- GPT-3.5 Turbo โ Fast & cost-effective
- o1 & o1-mini โ Advanced reasoning
- Custom fine-tuned deployments
|
🎉 What's New in v1.3.5
Azure OpenAI GPT-5 support and smoother deployment management. This release brings GPT-5 deployments into Copilot Chat, fixes the request parameter mismatch for newer models, and makes it easier to add or remove Azure deployments without losing your existing list.
- 🤖 Azure OpenAI GPT-5 support โ GPT-5 deployments are now discoverable and usable in Copilot Chat, with the correct
max_completion_tokens parameter sent automatically.
- 📝 Preserve deployment list on refresh โ When Azure auto-discovery falls back to manual entry, the input is pre-filled with your current deployments so you can edit the list instead of retyping it.
- 🔄 Auto-repair cached deployment metadata โ Startup cache entries are re-hydrated with the latest family and capability rules, so stale caches don't hide models after an update.
🎉 Previous Highlights (v1.3.0)
Expanded Azure support and even smarter Headroom compression. This release adds more ways to authenticate with Azure OpenAI and brings additional Azure model deployments into the model picker, while the compression pipeline keeps getting safer and more efficient.
- 🔐 Expanded Azure Authentication & Models โ Added support for additional Azure OpenAI authentication flows and new model deployments, giving you more flexibility when connecting to enterprise Azure endpoints.
- 🧠 Headroom Compression Improvements โ Further refinements to the compression pipeline for better token savings while preserving the context that matters most.
🎉 Previous Highlights (v1.2.3)
Reliable, mode-aware Headroom compression. We fixed cases where conservative/balanced modes could still drop important tokens, so your models now receive exactly the context they need.
- 🛡๏ธ Mode-aware compression tiers โ
conservative, balanced, and aggressive now use separate compressor configurations. Conservative mode preserves nearly all non-code context; balanced keeps full function bodies while still summarising very large files and old history; aggressive uses maximum compression.
- 🚫 Current-turn content is fully protected โ The active user message and any tool results from the current turn are marked exempt and bypass the pipeline entirely, so the model never receives a stub for content it must understand to answer.
- 🔄 Safer incremental context โ Repeated file reads are only deduplicated in older conversation turns; the current turn always keeps the full file content.
- 🛠๏ธ Tool schema compression fixes โ Compressed tool definitions are now correctly applied to the outgoing payload, and conservative mode skips tool-description truncation unless context pressure is already high.
- 📊 New per-file exemptions โ Right-click any source file in the Explorer and choose Exempt File from Headroom Compression to pass it through unchanged.
🎉 Previous Highlights (v1.2.2)
- 🧠 Adaptive Tool Compression โ Dynamic 4-tier compression automatically adjusts based on token budget pressure
- 🖼๏ธ Intelligent Image Compression โ Multimodal models now benefit from automatic image format optimization and quality scaling
- 📋 Enhanced Logging โ Detailed breakdown of compression metrics, per-content-type savings, and transform tracking with structured
[Headroom] format
- โ๏ธ Smart Context Caching โ Frequently-used context patterns cached and referenced to avoid re-transmission
- 💾 Memory Store Optimization โ Improved context deduplication across conversation history
- 🔄 Better Pricing โ Fixed cost calculation accuracy with proper compression-induced savings tracking
🧠 Headroom AI โ Intelligent Token Compression
Save 25-40% on every API call with our multi-strategy compression engine that never corrupts source code the AI needs to understand:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ BEFORE HEADROOM โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 21,000 tokens โ
โ (Messages + System Prompts + Tool Schemas) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ AFTER HEADROOM โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโ 14,700 tokens (-30%) โ
โ (Safe-optimised code + deduplicated + compressed) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
How It Works
Safe Source Code Optimisation โ Strips comments and normalises whitespace but never modifies logic, variable names, or strings. Preserves TODO/FIXME/HACK and JSDoc @param/@returns. Expected savings: 15-25%.
Large File Summarisation โ Files exceeding your configured threshold (default 500 lines) are replaced by a structural summary (exports, classes, functions, interfaces, types) plus the first 100 and last 50 lines verbatim. Request specific sections if you need them. Expected savings: 60-80%.
Incremental Context Deduplication โ When Copilot re-reads the same file in the same conversation, Headroom detects the duplicate and sends a compact reference stub instead of the full content. Expected savings: 40-60% on repeated reads.
Adaptive Tool Schema Compression โ VS Code injects tool definitions on every request. Headroom intelligently compresses tool descriptions based on available context budget:
- Conservative mode (< 50% budget): Full descriptions preserved (200-100 char limits)
- Balanced mode (50-75% budget): Moderate truncation for performance (150-80 char limits)
- Aggressive mode (75-90% budget): Heavy truncation for cost savings (80-40 char limits)
- Critical mode (> 90% budget): Maximum compression to stay within limits (50-25 char limits)
Expected savings: 40-60% depending on aggressiveness level and context pressure.
Intelligent Image Compression โ For multimodal models, Headroom optimizes image transmission:
- Automatic format optimization (JPEG, PNG, WebP support)
- Adaptive image quality scaling based on context pressure
- Base64 encoding optimization for inline image transmission
- Fallback image handling for models without vision capabilities
- Expected savings: 20-35% on image token usage
Conversation History Management โ Older messages are intelligently summarised while preserving key context and decision points.
Smart Context Caching โ Frequently-used context patterns are cached and referenced via compact identifiers to avoid re-transmission in long conversations.
Compression Modes
| Mode |
What it does |
Best for |
| Conservative |
Only light source-code cleanup (strip comments/whitespace). All non-code blocks, current-turn files, and tool results pass through untouched. Tool schemas are only compressed when context pressure is high. |
Default. Maximum context accuracy. |
| Balanced |
Comment stripping + large-file summarisation (files > 500 lines) + incremental deduplication for older turns. Full function bodies and important structure are kept. |
Good cost/accuracy trade-off for long conversations. |
| Aggressive |
Maximum compression: heavy log/JSON reduction, deeper code summarisation, earlier truncation of older messages. |
When you are close to the model context limit and need every token. |
Configuration
{
"cloudLmProvider.headroom.enabled": true,
"cloudLmProvider.headroom.aggressiveness": "conservative",
"cloudLmProvider.headroom.showSavingsNotifications": true,
"cloudLmProvider.headroom.largeFileThreshold": 500,
"cloudLmProvider.headroom.exemptCurrentTurnToolResults": true,
"cloudLmProvider.headroom.exemptTypeDefinitions": true,
"cloudLmProvider.headroom.exemptFiles": ["src/config/secrets.ts"]
}
| Setting |
Values |
Default |
Description |
enabled |
true/false |
true |
Master on/off switch |
aggressiveness |
conservative | balanced | aggressive |
conservative |
How much to compress |
showSavingsNotifications |
true/false |
true |
Milestone toasts (1M tokens / $5 saved) |
largeFileThreshold |
100โ2000 |
500 |
Lines before large-file summary kicks in |
exemptCurrentTurnToolResults |
true/false |
true |
Keep current-turn tool results uncompressed |
exemptTypeDefinitions |
true/false |
true |
Keep .d.ts/type-definition content uncompressed |
exemptFiles |
array of paths |
[] |
Specific files to always pass through unchanged |
preserveAllComments |
true/false |
false |
Keep all source-code comments |
compressionDebugMode |
true/false |
false |
Log every compression decision to the Output panel |
Safety Guarantees
- Current-turn content is exempt. The active user message and any tool results from the current turn bypass compression, so the model always sees what it needs to answer.
- Source code is never lossy-compressed. Headroom uses pattern-based stripping only โ no LLM rewriting of your code.
- Function bodies are kept in conservative and balanced modes. Code is reduced only by stripping comments and whitespace unless you explicitly choose aggressive mode or the file is very large.
- Compression failures fall back to uncompressed. A broken compression result never reaches the API.
- Tool call/result pairs are validated before and after compression. Orphaned blocks are auto-removed to prevent
ValidationException.
- Detailed logging for debugging. Enable
cloudLmProvider.headroom.compressionDebugMode to see every exemption, transform, token saving, and context-pressure decision.
- Context-aware adaptive compression. Automatically adjusts compression aggressiveness based on available token budget to prevent exceeding model limits.
- Image integrity preserved. Vision model images are optimized, never corrupted or misrepresented.
- Per-file exemptions. Right-click a file in the Explorer to exempt it from all compression.
Real Savings Dashboard
Track your savings in real-time:
- 💰 Cost Avoided โ Exact dollar amounts saved
- 📊 Token Reduction โ Session, daily, and lifetime metrics
- 📈 Compression History โ Visual trends over time
- 🎯 Accuracy Index โ Model attention improvement score
"Headroom saved us $2,400/month across our 50-person engineering team."
โ Senior Platform Engineer, Fortune 500 Company
Milestone Notifications
Headroom shows a brief toast when you hit a savings milestone:
🎉 Headroom: 1,000,000 tokens saved ($3.00 avoided) [Open Dashboard]
Milestones fire at every 1M tokens or $5 saved (overall), then auto-dismiss after 5 seconds. Disable via cloudLmProvider.headroom.showSavingsNotifications.
📊 Real-Time Status Bar Telemetry
Always know exactly what you're spending:
$(graph) Tokens: 8,542 In / 1,247 Out | โกโ32% | $0.45
- Live token counts from actual AWS/Azure API responses
- Per-request cost calculation using real-time pricing
- Cumulative session tracking for budget management
- One-click dashboard access for detailed analytics
🎯 Smart Notifications & UI
Receive intelligent notifications about your usage and costs:
- 💰 Milestone Notifications โ Toast alerts when reaching 1M token or $5 saved milestones
- โ ๏ธ Cost Warnings โ Automatic alerts for expensive model usage
- 📈 Usage Trends โ Visual indicators showing compression effectiveness
- 🔔 Status Updates โ Real-time feedback on model availability and connection status
- 🎨 Visual Feedback โ Compression indicator in status bar showing savings percentage
- 📊 Dashboard Analytics โ Comprehensive savings dashboard with daily/lifetime metrics
🔧 Advanced Capabilities
| Feature |
Description |
| 🔄 Full Streaming |
Real-time token-by-token response rendering with smooth output |
| 🛠๏ธ Tool Calling |
Function calling with automatic schema translation and validation |
| 🖼๏ธ Vision Support |
Send images to multimodal models (Claude, GPT-4o) with intelligent compression |
| 🌍 Cross-Region Routing |
Automatic failover across AWS regions for model availability |
| 🔐 Secure Credentials |
Stored in VS Code's encrypted secret storage; no plaintext storage |
| โ๏ธ Inference Profiles |
Support for AWS Bedrock inference profiles and model routing |
| 📝 Request Logging |
Detailed debug logs with compression breakdowns and performance metrics |
| 🧮 Token Counting |
Real-time token consumption tracking with cost breakdown |
| 💾 Context Caching |
Intelligent memory store for reducing redundant API calls |
| 🎯 Auto Discovery |
Automatic detection of AWS and Azure credentials and available models |
🎛๏ธ Configuration
AWS Bedrock Setup
Option 1: AWS CLI Profile (Recommended)
{
"cloudLmProvider.aws.defaultRegion": "us-east-1",
"cloudLmProvider.aws.modelRouting": "auto"
}
The extension automatically uses your configured AWS CLI profile.
Option 2: Access Keys
Run the configuration wizard and enter:
- AWS Access Key ID
- AWS Secret Access Key
- (Optional) Session Token for temporary credentials
Option 3: IAM Role / Instance Profile
For EC2 or ECS environments, credentials are automatically discovered.
Azure OpenAI Setup
{
"cloudLmProvider.azure.defaultDeployment": "gpt-4o",
"cloudLmProvider.azure.apiVersion": "2025-01-01-preview"
}
Run the wizard and enter:
- Azure OpenAI Endpoint URL
- API Key or use Azure AD authentication
All Settings
| Setting |
Default |
Description |
cloudLmProvider.aws.defaultRegion |
us-east-1 |
Primary AWS region |
cloudLmProvider.aws.modelRouting |
auto |
Cross-region inference routing |
cloudLmProvider.aws.showAllRegions |
false |
Show models from all regions |
cloudLmProvider.aws.enabledModelFamilies |
[] |
Filter to specific model families |
cloudLmProvider.aws.minContextWindow |
0 |
Minimum context size filter |
cloudLmProvider.aws.hideExpensiveModels |
false |
Hide high-cost models |
cloudLmProvider.enableCostWarnings |
true |
Show cost alerts for expensive models |
cloudLmProvider.requestTimeoutMs |
120000 |
Request timeout (5s-600s) |
cloudLmProvider.logLevel |
info |
Output verbosity |
🤖 Supported Models
AWS Bedrock
| Model |
Context |
Best For |
Cost Tier |
| Claude 4.5 Opus |
200K |
Complex reasoning, code generation |
💎💎💎 |
| Claude 4.5 Sonnet |
200K |
Balanced performance & cost |
💎💎 |
| Claude 3.7 Sonnet |
200K |
Previous gen, battle-tested |
💎💎 |
| Claude 3.5 Haiku |
200K |
Fast, cost-effective |
💎 |
| Amazon Nova Pro |
300K |
AWS-native, large context |
💎💎 |
| Amazon Nova Lite |
300K |
Budget-friendly AWS model |
💎 |
| DeepSeek R1 |
64K |
Advanced reasoning |
💎💎 |
| Llama 3.3 70B |
128K |
Open-source powerhouse |
💎 |
| Mistral Large |
128K |
European AI excellence |
💎💎 |
Azure OpenAI
| Model |
Context |
Best For |
Cost Tier |
| GPT-5 |
200K |
Frontier reasoning & coding |
💎💎💎 |
| GPT-4o |
128K |
Multimodal, fast |
💎💎 |
| GPT-4 Turbo |
128K |
Large context tasks |
💎💎💎 |
| o1 |
128K |
Advanced reasoning |
💎💎💎 |
| GPT-3.5 Turbo |
16K |
Quick tasks, low cost |
💎 |
🔒 Security & Compliance
Cloud LM Provider is built for enterprise environments:
- โ
No Data Collection โ We don't collect, store, or transmit your conversations
- โ
Local Credential Storage โ All secrets stored in VS Code's encrypted keychain
- โ
Your Cloud, Your Data โ Direct API calls to your AWS/Azure accounts
- โ
SOC 2 / HIPAA Compatible โ Works within your existing compliance framework
- โ
Open Source โ Audit the code yourself on GitHub
Tested on a MacBook Pro M3 with VS Code 1.104:
| Metric |
Cloud LM Provider |
Alternative Extensions |
| Cold Start |
1.2s |
3-5s |
| Model Switch |
<100ms |
500ms-2s |
| First Token |
Network latency only |
+200-500ms overhead |
| Memory Usage |
~45MB |
80-150MB |
| Token Compression |
30-45% savings |
N/A |
โ FAQ
Q: Do I need a GitHub Copilot subscription?
Yes, you need an active GitHub Copilot subscription to use GitHub Copilot Chat. This extension adds additional AI models to the existing Copilot Chat interface.
Q: Why are my AWS models not showing up?
- Ensure your AWS credentials have
bedrock:InvokeModel and bedrock:ListFoundationModels permissions
- Check that the models are available in your selected region
- Run "Cloud LM: Recheck Cloud Connection" to refresh
Q: How does Headroom compression work?
Headroom analyzes your conversation context and applies different strategies based on the selected mode:
- Current-turn protection โ Your active request and current tool results are always sent unchanged.
- Safe source-code cleanup โ Strips comments and whitespace but never modifies logic, variable names, or strings.
- Large-file summarisation โ Files above
largeFileThreshold lines are replaced by a structural summary plus head/tail snippets.
- Incremental context deduplication โ Repeated reads of the same file in older turns are sent as compact reference stubs.
- Mode-aware compressors โ Conservative/balanced/aggressive modes scale JSON, log, search, diff, text, and tool-schema compression independently.
- Smart context caching โ Frequently-used context patterns are cached and referenced to avoid re-transmission in long conversations.
This reduces token count by 25-40% while keeping the tokens the model actually needs to understand your request.
Q: Is my data secure?
Absolutely. The extension makes direct API calls from your machine to your cloud provider. We never proxy, store, or access your data. Credentials are stored in VS Code's encrypted secret storage.
Q: Can I use this with multiple AWS accounts?
Yes! Use AWS CLI profiles or switch credentials via the configuration wizard. The extension supports multiple credential sets.
Q: Why is Claude/GPT not responding?
- Check your API quota limits in AWS/Azure console
- Verify credentials haven't expired
- Check the output log: "Cloud LM: Show Output Log"
- Ensure the model is available in your region
🛠๏ธ Commands
| Command |
Description |
Cloud LM: Manage Provider Configuration |
Open the interactive setup wizard for AWS Bedrock and Azure OpenAI |
Cloud LM: Recheck Cloud Connection |
Refresh model discovery and verify credentials |
Cloud LM: Clear Stored Credentials |
Remove all saved credentials from secure storage |
Cloud LM: Show Output Log |
View detailed debug logs including compression analytics |
Cloud LM: Toggle Headroom Context Compression |
Enable/disable Headroom compression in real-time |
Select Headroom Compression Mode |
Switch between conservative, balanced, and aggressive modes |
Cloud LM: Show Headroom Savings Dashboard |
View comprehensive savings analytics and compression history |
Cloud LM: Manage Accounts |
Switch between multiple AWS/Azure accounts |
Cloud LM: Verify Model Access |
Test connectivity to specific models |
Cloud LM: Export Compression Report |
Generate CSV/JSON report of compression metrics |
🗺๏ธ Roadmap
- [ ] Prompt Library โ Save and reuse effective prompts
- [ ] Team Sharing โ Share configurations across your organization
- [ ] Cost Alerts โ Configurable spending notifications
- [ ] Google Vertex AI โ Support for Gemini models
- [ ] Local Models โ Ollama and LM Studio integration
- [ ] Custom Endpoints โ OpenAI-compatible API support
🤝 Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
# Clone the repository
git clone https://github.com/suddhu-iith2004/cloud-lm-provider.git
# Install dependencies
npm install
# Compile and watch
npm run watch
# Launch Extension Development Host
F5 in VS Code
📄 License
This project is licensed under the MIT License โ see the LICENSE file for details.
🙏 Acknowledgments
โญ If Cloud LM Provider saves you time and money, please star this repo! โญ
Made with โค๏ธ by @suddhu-iith2004
📊 Keywords
aws bedrock azure openai github copilot claude gpt-4 llm language model ai assistant code generation token compression enterprise ai vscode extension copilot chat anthropic openai amazon nova deepseek llama mistral cost optimization api cost token tracking headroom context compression