NewLife AI Provider简体中文 | English
Extension ID:
Screenshots
Quick start
Requirements: desktop VS Code 1.104+; uses Copilot Chat BYOK (bring your own key). Remote SSH, containers and the browser build are out of scope for this version. FeaturesMulti-provider (6)
Discovery & metadata (6)
Usage & cost (5)
UI (5)
Reliability (6)
Supported endpoints
Presets are not a support guarantee: base URL, auth, discovery and pricing follow what the provider actually returns; unlisted models are treated as unknown. The picker's context length is "max input + max output". DeepSeek Flash, V4 Pro and others register at 1,048,576 total context, so they show 1M, not 1.4M. UsageManage model providers
Metadata and price overridePer model you can override display name, context, max output, image input, tool calling, currency and three unit prices. Price is "per million tokens", only when you need to correct the built-in table. Overrides live in Reasoning effortDeepSeek official models (Flash, V4 Pro, V4 Flash, Vision, Chat) let you pick reasoning effort in the model config: off, low, high, max. Normal chat requests use the chosen level; tool requests (including the web tools below) force thinking off (DeepSeek requires replaying historical DeepSeek web search & fetch
Both default off and can be enabled alone or together. When on, the request uses Status bar, dashboard and
|
| Command | Description |
|---|---|
NewLife AI: Manage Model Providers |
Open the management page |
NewLife AI: Open Usage Dashboard |
Open the dashboard |
NewLife AI: Show Provider Status |
Quick view of each provider's status |
NewLife AI: Export Usage CSV |
Export all records |
NewLife AI: Clear This Month |
Clear the current month's ledger after confirmation |
NewLife AI: Set Usage Budget |
Set daily/monthly budgets |
NewLife AI: Set Provider Headers |
Set custom request headers (stored in SecretStorage only) |
Settings
| Setting | Default | Description |
|---|---|---|
newlife-ai-provider.showStatusBar |
true |
Show the status-bar summary |
newlife-ai-provider.logLevel |
info |
off/error/warn/info/debug; debug logs request snapshots that may include prompts |
newlife-ai-provider.language |
auto |
auto follows VS Code; or fix zh-cn / en |
newlife-ai-provider.allowInsecureHttp |
false |
Allow plain HTTP to non-local endpoints; localhost is always allowed |
newlife-ai-provider.experimentalPriceHints |
false |
Experimental: attach price hints to the model picker (non-public field) |
newlife-ai-provider.deepseekWebSearch |
false |
DeepSeek web search (only deepseek-flash, server-side) |
newlife-ai-provider.deepseekWebFetch |
false |
DeepSeek web fetch (only deepseek-flash, reads cited pages) |
Privacy & security
- Prompts and code context are sent only to the providers you configure; the extension does not proxy, relay or report anywhere and ships no keys.
- Keys live only in VS Code
SecretStorage, never insettings.json, logs or exports; logs are redacted. - No request content is written to disk by default; only
debuglogs request snapshots (the setting warns about this). - HTTPS only by default; local
localhost/127.0.0.1may use HTTP; other plaintext endpoints requireallowInsecureHttp. - CSV export contains no prompts and guards against spreadsheet formula injection.
Pricing
- Cost is an estimate, not the provider invoice. Built-in prices are CNY per million tokens; the pricing table version shows on the dashboard.
- Formula:
cacheHit × hitPrice + cacheMiss × missPrice + completion × outputPrice. - DeepSeek busy/off-peak pricing: Beijing-time weekdays (Mon–Fri, excluding Chinese public holidays) 09:00–12:00 and 14:00–18:00 are peak; all other times, including weekends/holidays, are off-peak at half price. The extension picks the price at each request's start time on new records; historical price snapshots are not recalculated.
- Missing cache detail is estimated at the miss price and marked
estimated; missing price or usage shows unknown, never 0. - Currencies are summarized separately; no automatic FX.
Known limitations
- Reasoning: DeepSeek official models offer selectable reasoning effort. Tool requests force thinking off because VS Code cannot replay
reasoning_contentas DeepSeek requires. - Web tools:
deepseek_web_search/deepseek_read_urlonly affectdeepseek-flash, run server-side and are billed separately; enabling them disables "required" tool mode for that request. - Remote / browser build: unverified, not promised.
- Multi-window: each window writes its own JSONL file, de-duplicated by request id on read; clearing a month may remove records other windows are writing.
- Proxy: uses Node's built-in
fetch; proxy behavior follows the host. - Non-public fields: price hints and similar are off by default and may break after VS Code upgrades without affecting basic chat.
- Formal Copilot sessions (agent-host): models reach the picker via VS Code's BYOK bridge, which reads the resolved model cache; the extension warms all providers on startup. Reload the window once after install/upgrade.
Development
pnpm install
pnpm run check # type check (src + tests)
pnpm test # unit + integration tests
pnpm run test:e2e # real VS Code extension-host E2E (run pnpm run compile first)
pnpm run test:e2e:real # isolated instance + real DeepSeek key full-loop test
pnpm run compile # dev build
pnpm run package # production build (esbuild, minified)
Debug locally (F5)
- Open the
NewLife.AI.VSCodefolder in VS Code. - Run
pnpm install, thenpnpm run compileafter changes. - Press
F5to launch the Extension Development Host. - In the host, run NewLife AI: Manage Model Providers, enter a key and Save & fetch.
- Pick a model in Copilot Chat and chat; the status bar and dashboard show usage.
The host needs a signed-in GitHub Copilot Chat; you do not need to install the extension into your daily VS Code.
Packaging and installing the VSIX
pnpm run package:vsix
code --install-extension newlife-ai-provider-0.2.0.vsix --force
Restart VS Code and run NewLife AI: Manage Model Providers for a manual walkthrough.
Publishing to the Marketplace
Extension ID: NewLife.newlife-ai-provider, publisher NewLife. CI lives in .github/workflows/vscode.yml and uses GitHub OIDC (no PAT). The Marketplace only accepts major.minor.patch; pre-release and stable must use different versions. Convention: even minor = stable, odd minor = pre-release.
| Channel | Trigger | Version | Visibility |
|---|---|---|---|
| Pre-release | push to master, auto-published | 0.3.<run>, --pre-release |
Only users who switch to pre-release |
| Stable | tag vscode-x.y.z or manual dispatch with publish |
package.json version, e.g. 0.2.0 |
All users |
Troubleshooting
| Symptom | Fix |
|---|---|
| Auth failed (401) | Check the key is correct and not expired; Save & fetch again |
| Forbidden (403) | Check the account has access to the model |
| Too many requests (429) | The extension retries once before output; otherwise retry later |
| Endpoint/model not found (404) | Check the base URL has the right version segment and the model id is correct |
| Model missing | Confirm it is ticked and params filled in; check the NewLife AI Provider output log |
| No group in formal Copilot sessions | Reload the window to re-warm; check the extension is enabled and hidden ticks |
| Tool call reports "args are not valid JSON" | The model returned bad args; the request is aborted and logged |
License
MIT.

