A VSCode extension that connects OpenAI-compatible APIs to VSCode's Language Model API, enabling integration with GitHub Copilot Chat and other AI-powered features in VSCode.
- ✅ Full OpenAI API Compatibility: Works with any OpenAI-compatible API endpoint
- ✅ Google Gemini Support: Native support for Google Gemini API with dedicated channel
- ✅ VSCode Language Model API Integration: Seamlessly integrates with VSCode's built-in language model features
- ✅ Streaming Support: Real-time streaming responses for better user experience
- ✅ Thinking/Reasoning Support: Stream reasoning content from models that support it (e.g., o1, Claude with thinking)
- ✅ Automatic Model Loading: Fetches available models from the API endpoint on startup
- ✅ Model Caching: Loaded models are cached locally for faster startup times
- ✅ Secure API Key Storage: API keys are stored securely using VSCode's SecretStorage
- ✅ Tool Calling Support: Full support for tool/function calling with improved reliability
- ✅ XML-based Tool Calling: Fallback prompt-based tool calling for models without native support
- ✅ Tool Calling Filter: Optionally filter models by tool/function calling support
- ✅ Per-Model Configuration: Customize token limits, temperature, and capabilities per model
- ✅ Easy Configuration: Simple setup through VSCode settings and commands
- VSCode version 1.107.0 or higher
- An OpenAI-compatible API endpoint
- API key for authentication
- Open VSCode
- Go to Extensions view (
Ctrl+Shift+X/Cmd+Shift+X) - Search for "OAI2LMApi"
- Click Install
Or install directly via VS Code Marketplace.
- Download the
.vsixfile from the Releases page - In VSCode, open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run "Extensions: Install from VSIX..." and select the downloaded file
- Clone this repository
- Run
pnpm installto install dependencies - Run
pnpm run compileto build the extension - Press
F5in VSCode to run the extension in debug mode
- Install the extension
- Open Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run OAI2LMApi: Set API Key and enter your API key
- (Optional) Configure the API endpoint in settings if not using OpenAI
- Models will be automatically loaded and available in GitHub Copilot Chat
| Command | Description |
|---|---|
OAI2LMApi: Set API Key |
Securely store your OpenAI-compatible API key |
OAI2LMApi: Clear API Key |
Remove the stored OpenAI-compatible API key |
OAI2LMApi: Set Gemini API Key |
Securely store your Google Gemini API key |
OAI2LMApi: Clear Gemini API Key |
Remove the stored Gemini API key |
OAI2LMApi: Refresh Models |
Manually reload available models from all providers |
OAI2LMApi: Manage Provider Settings |
Open extension settings |
Configure the extension through VSCode settings (Ctrl+, or Cmd+,):
| Setting | Default | Description |
|---|---|---|
oai2lmapi.apiEndpoint |
https://api.openai.com/v1 |
OpenAI-compatible API endpoint URL |
oai2lmapi.autoLoadModels |
true |
Automatically load models from API on startup |
oai2lmapi.showModelsWithoutToolCalling |
false |
Show models that do not support tool/function calling |
| Setting | Default | Description |
|---|---|---|
oai2lmapi.enableGeminiChannel |
false |
Enable the Gemini channel provider |
oai2lmapi.geminiApiEndpoint |
https://generativelanguage.googleapis.com |
Google Gemini API endpoint URL |
The oai2lmapi.modelOverrides setting allows per-model configuration. Keys are model name patterns (supports wildcards like gemini-*), values are configuration objects:
| Property | Type | Description |
|---|---|---|
maxInputTokens |
number | Override max input tokens |
maxOutputTokens |
number | Override max output tokens |
supportsToolCalling |
boolean | Override tool calling support |
supportsImageInput |
boolean | Override image input support |
temperature |
number | Default temperature for the model |
thinkingLevel |
string/number | Thinking level: token budget number, or 'low'/'medium'/'high'/'auto'/'none' |
usePromptBasedToolCalling |
boolean | Use XML-based prompt tool calling instead of native function calling |
{
"oai2lmapi.apiEndpoint": "https://api.openai.com/v1",
"oai2lmapi.autoLoadModels": true,
"oai2lmapi.showModelsWithoutToolCalling": false,
"oai2lmapi.enableGeminiChannel": true,
"oai2lmapi.geminiApiEndpoint": "https://generativelanguage.googleapis.com",
"oai2lmapi.modelOverrides": {
"gemini-2.0-flash-thinking-exp": {
"thinkingLevel": "auto",
"usePromptBasedToolCalling": true
},
"claude-*": {
"maxOutputTokens": 8192
}
}
}The API key is stored securely using VSCode's built-in SecretStorage. Use the OAI2LMApi: Set API Key command to set your key.
Note: If you previously stored an API key in settings (the deprecated
oai2lmapi.apiKeysetting), it will be automatically migrated to secure storage.
This extension works with any API that implements the OpenAI chat completions format:
- OpenAI API
- Azure OpenAI
- Google Gemini API (native support via Gemini channel)
- Anthropic Claude (via OpenAI-compatible proxy)
- LocalAI
- Ollama (with OpenAI compatibility layer)
- LM Studio
- vLLM
- liteLM (transfer from other APIs)
- OpenRouter
- Any custom OpenAI-compatible implementation
- Ensure you're using VSCode 1.107.0 or higher
- Verify the extension is enabled in the Extensions view
- Run OAI2LMApi: Set API Key to ensure your API key is configured
- For Gemini: Enable
oai2lmapi.enableGeminiChanneland run OAI2LMApi: Set Gemini API Key - Verify your API endpoint is correct and accessible
- Check the OAI2LMApi Output Channel (
View > Output, select "OAI2LMApi") for detailed logs - Try OAI2LMApi: Refresh Models to manually reload
- Ensure your API endpoint supports
/v1/modelsand/v1/chat/completions - For Gemini: The extension uses the native Gemini API format, not OpenAI compatibility
- Verify network connectivity to the API endpoint
- Some models don't support native function calling
- Use
usePromptBasedToolCalling: truein model overrides for XML-based fallback - Check model capabilities in the Output Channel logs
MIT - See LICENSE for details.
Contributions are welcome! Please feel free to submit issues or pull requests on GitHub.