Skip to content
| Marketplace
Sign in
Visual Studio Code>AI>NewLife AI ProviderNew to Visual Studio Code? Get it now.
NewLife AI Provider

NewLife AI Provider

NewLife

| (0) | Free
新生命AI多模型:在 VS Code Chat 中接入多家 OpenAI 兼容模型服务商,并查看请求级用量与成本。
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

NewLife AI Provider

简体中文 | English

Multi-provider AI for VS Code Chat: bring DeepSeek, Alibaba Cloud Bailian, Tencent Hunyuan, Volcengine Ark, SiliconFlow, Moonshot, Zhipu, a NewLife AI Gateway and 3 custom OpenAI-compatible endpoints into VS Code Chat, and review request-level usage and estimated cost on your machine.

Extension ID: NewLife.newlife-ai-provider.

Upgrading from 0.1.1: the old publisher was NewLifeX (NewLifeX.newlife-ai-provider); since 0.1.5 it is NewLife.newlife-ai-provider. VS Code treats them as two extensions — uninstall the old one first. Later versions under the same ID upgrade in place.

Screenshots

Usage dashboard

Model provider management

Quick start

  1. Install the extension (VSIX or Marketplace).
  2. Open the command palette (Ctrl+Shift+P) and run NewLife AI: Manage Model Providers.
  3. Pick a provider on the left, enter the API key, click Save & fetch, then tick the models you need.
  4. Open Copilot Chat and pick a model from the picker, e.g. "DeepSeek V4 Pro (DeepSeek Official)".

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.

Features

Multi-provider (6)
Feature In one line
Eight built-in providers One OpenAI-compatible protocol; configure a key once (includes the NewLife.ChatAI gateway)
Three custom endpoints Any compatible endpoint with editable name and base URL
Grouped by provider The picker shows which provider a model comes from
Hot reload Change config or key without restarting VS Code
DeepSeek web tools Optional server-side web search and URL reading for DeepSeek
One-click reset Clear config and keys back to factory defaults
Discovery & metadata (6)
Feature In one line
Auto model discovery GET /models; supports OpenAI, bare-array and Ollama shapes
Tick to enable Ticked models appear in the Copilot model picker
Three-source merge User override > provider response > built-in catalog > unknown
No guessing Models with unknown context/output are flagged "needs params" until filled in
Param & price override Edit display name, context, output, capabilities and price per model
DeepSeek reasoning levels Off / low / high / max, applied to normal chat
Usage & cost (5)
Feature In one line
Request-level ledger One JSONL row per upstream request, split by month and window
Real usage first Record what the provider returns; show unknown instead of 0
Cache pricing Hit / miss / output priced separately; supports DeepSeek cache fields
Per-currency totals CNY and USD are never summed together
Budget alerts Daily/monthly budgets warn at 80% and 100% without blocking requests
UI (5)
Feature In one line
Status bar summary Today's cost, tokens and cache hit rate; flashes the latest request
Usage dashboard Summary cards, 30-day trend, per-provider / per-model groups, session cards, request detail
@usage in chat Type @usage /today in Chat to read the ledger
CSV export UTF-8 BOM so Excel opens it cleanly, with formula-injection protection
Feedback & website Footer links to GitHub new-issue and newlifex.com; the @usage feedback button opens a prefilled issue
Reliability (6)
Feature In one line
Strict SSE parsing Chunking, CRLF, multi-line data, heartbeat and [DONE] all covered by tests
Tool-call validation Aborts the request when tool args are not valid JSON, never silently replaces with {}
Error classification Readable messages for 401/403/429/5xx/timeout
Bounded retry Retries once on 429 only, honoring Retry-After, and only before any output
Active timeouts 30s connect, 60s idle, with a clear reason
Feature degradation Non-public capabilities are probed at runtime; failure never breaks basic chat

Supported endpoints

Provider Default base URL Notes
DeepSeek Official https://api.deepseek.com Cache-hit pricing; selectable reasoning levels
Alibaba Cloud Bailian https://dashscope.aliyuncs.com/compatible-mode/v1 Hosts Qwen, DeepSeek, GLM, Kimi, etc.
Tencent Hunyuan https://api.hunyuan.cloud.tencent.com/v1 Hunyuan Hy4 / Hy3 series
Volcengine Ark https://ark.cn-beijing.volces.com/api/v3 Some models use ep- endpoint IDs
SiliconFlow https://api.siliconflow.cn/v1 Aggregates many open models
Moonshot https://api.moonshot.cn/v1 Kimi series
Zhipu https://open.bigmodel.cn/api/paas/v4 GLM series
NewLife AI Gateway http://localhost:5080 Self-hosted NewLife.ChatAI gateway, OpenAI-compatible; AppKey optional; model list carries context and vision/tool capabilities
Custom 1/2/3 empty, filled by user Any OpenAI-compatible endpoint; key optional for local services

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.

Usage

Manage model providers

  • The left list shows providers: a solid dot means configured; the number is how many models are ticked.
  • Save & fetch: saves base URL, key and display name, then fetches the model list immediately.
  • Refetch: refreshes only the model list; on failure it keeps your ticked models and shows why.
  • Test inference: makes one real call that may incur cost, with a confirmation first.
  • Delete key: clears only the SecretStorage key; Restore defaults clears everything for that provider.
  • Ticking persists immediately; there is no "Apply" button. The search box filters the current list only.
  • Add a model manually: type the model id and press Enter; Volcengine ep-xxx also goes here.
  • Models missing context/output show "needs params" and are registered only after you fill them in under "Metadata and price override".

Metadata and price override

Per 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 globalStorage/state.json, not settings.json.

Reasoning effort

DeepSeek 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 reasoning_content, which VS Code does not provide).

DeepSeek web search & fetch

deepseek-flash offers two server-side tools executed by DeepSeek; the extension only declares them:

Setting Tool Purpose
newlife-ai-provider.deepseekWebSearch deepseek_web_search Web search with citations in the answer
newlife-ai-provider.deepseekWebFetch deepseek_read_url Reads the body of cited pages

Both default off and can be enabled alone or together. When on, the request uses tool_choice=auto and drops sampling params (DeepSeek's requirement) and turns thinking off. Search and fetch are billed by DeepSeek's rules; only deepseek-flash is affected.

Status bar, dashboard and @usage

  • The status bar shows today's cost, today's tokens and today's cache hit rate, refreshing every minute; click to open the dashboard.
  • The dashboard has today/week/month/all summaries (with real date ranges), per-provider/model groups, a 30-day trend, recent sessions and recent requests.
  • Recent sessions read the local Copilot session store (agent-host.db, read-only) to show real session titles, code changes (+/-/files) and thinking level. Requests are attributed by session id when available, otherwise by time window (overlaps are labeled "approx"). If the store is unavailable it falls back to window+model segments, without breaking the dashboard.
  • Recent requests include model, input/output, cache hit/miss, cache hit rate (one decimal), cost, latency and TTFT.
  • In chat, @usage /today shows today's summary, @usage /export exports CSV, @usage /help shows help.

Budget

Daily and monthly budgets, each with a currency. Warnings fire at 80% and 100% and never block requests. Rules with a different currency are ignored.

Commands

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 in settings.json, logs or exports; logs are redacted.
  • No request content is written to disk by default; only debug logs request snapshots (the setting warns about this).
  • HTTPS only by default; local localhost/127.0.0.1 may use HTTP; other plaintext endpoints require allowInsecureHttp.
  • 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_content as DeepSeek requires.
  • Web tools: deepseek_web_search / deepseek_read_url only affect deepseek-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)

  1. Open the NewLife.AI.VSCode folder in VS Code.
  2. Run pnpm install, then pnpm run compile after changes.
  3. Press F5 to launch the Extension Development Host.
  4. In the host, run NewLife AI: Manage Model Providers, enter a key and Save & fetch.
  5. 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.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft