AI Proxy API for VS Code
Install from Visual Studio Marketplace · Reviews · Source code
Run a private, OpenAI-compatible API from VS Code using API keys or OAuth accounts from supported AI providers.
AI Proxy API installs a pinned CLIProxyAPI engine in VS Code extension storage, exposes it only on 127.0.0.1, and manages the service through native VS Code panes. It keeps its profile separate from any other CLIProxyAPI installation.
Highlights
- One local API: use OpenAI-compatible clients against
http://127.0.0.1:<port>/v1.
- Five OAuth account types: Claude, OpenAI Codex, Google Antigravity, xAI, and Kimi.
- API-key providers: OpenAI-compatible endpoints, Anthropic Claude, and Google Gemini.
- Account quotas: view provider quota windows, remaining percentages, reset times, and refresh each account on demand.
- Cost estimates: calculate USD API list-price estimates from retained input, cached-input, and output token totals, with per-model overrides for custom endpoints.
- Native VS Code UI: control the service, providers, accounts, models, aliases, activity, privacy, and diagnostics from six resizable panes.
- Cross-platform: macOS, Linux, and Windows on x64 and arm64. Linux uses the portable build for glibc and musl systems.
- Local-first security: loopback-only traffic, VS Code Secret Storage, an isolated profile, pinned downloads, SHA-256 verification, and no extension analytics.
Get started
- Install AI Proxy API from Visual Studio Marketplace. For a local package, use Extensions: Install from VSIX…, or open this repository in VS Code for development.
- Open AI Proxy API from the Activity Bar.
- Choose Install Engine, then Start Local Service. The primary control stays at the top of the pane and changes to Stop Local Service while running. If a download is interrupted, choose Download Engine Again.
- Add an API-key provider or connect an OAuth account.
- Refresh Models & Aliases.
- Copy the API endpoint, client API key, and model ID from the sidebar.
The installed extension defaults to port 8317. This repository's development workspace uses port 18317 to avoid conflicts. Change aiProxyApi.port in VS Code settings and restart the service when another port is required.
Supported connections
| Connection |
Authentication |
Quota display |
| Anthropic Claude |
OAuth or API key |
OAuth accounts |
| OpenAI Codex |
OAuth |
Yes |
| Google Antigravity |
OAuth |
Yes |
| xAI |
OAuth |
Yes |
| Kimi |
OAuth |
Yes |
| Google Gemini |
API key |
— |
| Any OpenAI-compatible service |
API key and base URL |
Provider dependent |
Provider logos appear beside recognized accounts, native API providers, and models. Quota responses remain in memory and are discarded when VS Code closes.
The activity dashboard combines account quota windows with estimated API list-price cost. Estimates are not invoices, and subscription-based OAuth plans may bill differently. For an unrecognized or private model, set aiProxyApi.modelPricing with inputPerMillion, outputPerMillion, and optionally cachedInputPerMillion.
Use the local API
AI Proxy API exposes the standard OpenAI-compatible /chat/completions route. Substitute the values copied from the Local Service and Models & Aliases panes.
curl http://127.0.0.1:8317/v1/chat/completions \
-H "Authorization: Bearer YOUR_LOCAL_CLIENT_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [{"role": "user", "content": "Reply with exactly OK."}],
"max_tokens": 8
}'
The client key authenticates only to the local service. The selected provider connection handles the upstream request.
Python example
The included example uses only the Python standard library:
AI_PROXY_API_URL="http://127.0.0.1:8317/v1" \
AI_PROXY_API_API_KEY="YOUR_LOCAL_CLIENT_KEY" \
AI_PROXY_API_MODEL="YOUR_MODEL_ID" \
python3 examples/test_oauth_proxy.py
This sends one real request, which may consume provider quota or incur provider charges.
VS Code panes
| Pane |
Purpose |
| Local Service |
Install, start, stop, restart, and copy local connection details. |
| API Key Providers |
Add and manage native or OpenAI-compatible API-key connections. |
| OAuth Accounts |
Connect, enable, disable, remove, and refresh quota for provider accounts. |
| Models & Aliases |
Discover models, copy IDs, run an explicit test, and create aliases. |
| Activity & Privacy |
Review request metadata, token totals, estimated cost, account quota, and run-scoped content logging. |
| Tools & Diagnostics |
Open logs, inspect redacted diagnostics, update or restore the engine, clear history, and reset local data. |
Privacy and security
- Management and client APIs bind to the loopback interface.
- Management and client secrets originate in VS Code Secret Storage.
- The engine receives only the credential copies required inside its permission-restricted isolated profile.
- Non-local provider endpoints must use HTTPS.
- OAuth destinations are validated before opening in the browser.
- Request metadata is retained locally for up to 30 days.
- Request and response content logging is off by default. When explicitly enabled, it lasts only for the current run and is capped at 7 days or 100 MiB.
- Provider quota checks are credential-scoped, read-only requests made when quotas are first shown or manually refreshed.
See PRIVACY.md and SECURITY.md for the complete policies.
Develop and test
Requirements:
- VS Code
1.90.0 or newer
- Node.js
22 or newer for the pinned VSCE 4 packaging tool
npm ci
npm run qa
Press F5 or run Run AI Proxy API Extension to open an Extension Development Host.
Release checks:
npm run release:check # QA, package, and independent VSIX inspection
npm run audit:release # npm vulnerability audit
npm run smoke:oauth # five-provider OAuth start/status/cancel contract
node scripts/smoke-engine.js
node scripts/verify-release-archives.js
The smoke and cross-platform archive checks require network access. Generated VSIX files and node_modules are intentionally ignored by Git.
Repository layout
src/ Extension, engine lifecycle, management API, UI, quota, and privacy code
test/ Node.js unit and contract tests
scripts/ Packaging, package verification, smoke tests, and release checks
media/ Extension and provider icons
examples/ Minimal client examples
Release and license
Current extension version: 1.0.1
Pinned engine version: CLIProxyAPI 8.0.44
Release notes are in CHANGELOG.md. This project is licensed under the MIT License; bundled logo attribution is listed in THIRD_PARTY_NOTICES.md.