SmarterCode DeepSeekVersion: 0.0.50
SmarterCode DeepSeek extension is heavily focusing on reducing token usage and includes detailed usage profiling capabilities:
Quick Start
Table of Contents1. OverviewSmarterCode DeepSeek is a VS Code extension that brings DeepSeek's language models (V4 Flash & V4 Pro) directly into your editor. It goes beyond a simple chat wrapper by providing:
2. UsageConfiguration — Copilot Integration ModeAPI routing is handled automatically via the DeepSeek Copilot provider. Configure a DeepSeek API key, or sign in for the hosted allowance, as described in Quick Start; no endpoint configuration is needed unless you use a proxy. To point to a different API endpoint (e.g., a self-hosted proxy), set Hosted Tokens (optional)Instead of a DeepSeek key, you can sign in with GitHub and use a monthly token allowance served by
the quota proxy in
Sign-in uses the GitHub OAuth device flow (no redirect URI, no client secret) and requests only
Using with CopilotAfter configuring your API key, the quickest way to start is through VS Code's built-in chat:
What you can do in Copilot:
DeepSeek Request Logs, Failures & Token CostsThe extension logs all DeepSeek API activity to the DeepSeek output channel, with timestamped entries for each request and token/cost summaries. Failed requests: A request that fails — an HTTP error such as 502, or a network error — is written as one JSON file to Run DeepSeek: Browse Failed Requests from the command palette to list them. Selecting a row opens the request body, the response body, or the full dump. Prompt-cache diagnostics: A request that misses most of the prompt cache is recorded as Tool definitions are also sorted by name before they are sent, so MCP registration timing or a subagent selection cannot reorder the prompt and invalidate the cache on every resume. Understanding token usage: The output channel reports each turn's cache-miss ( Token usage graph: run DeepSeek: Show Token Usage Graph (or press the graph icon in the Zero view's title bar) to open a live chart with one thin bar per API call. The bar's height is the call's total tokens; the stacked slices are output at the top, uncached input — the cache miss — in the middle, and cache-hit input at the bottom. Hover a bar for its exact counts, model, source and time. Each bar also carries a dollar cost, priced from its own model and hour: the built-in off-peak DeepSeek prices, doubled inside the peak windows (01:00–04:00 and 06:00–10:00 UTC, Monday–Friday) — a peak bar's tooltip says so. The chart updates as each request completes, for both Copilot turns and Zero turns. Samples are shared across VS Code windows and kept for the running VS Code session, and Clear empties them. The API itself is stateless, so a bar means one request, not one conversation total. For deeper diagnostics, set
A hit percentage far below About prompt caching: DeepSeek caches an exact prompt prefix in 64-token blocks. Tool definitions render after the system message, so any change in the system prompt invalidates every tool schema behind it. VS Code puts a fresh session UUID in the system prompt on each new conversation, which used to cost roughly 30k cached tokens per new chat; Zero Panel (WASM harness)The Zero icon in the Activity Bar opens a panel whose interface and agent loop are the
bundled
The module runs on a worker thread, so a long build it starts cannot freeze the editor. File writes
and command execution are governed by The panel is multi-surface. The bar along its top switches between Agent (the conversation),
History, Tasks, Tools (the calls the agent may make under the current grant), Workflows
and Settings. Settings is a destination in that bar rather than a separate button beside it.
Workflows are the documents in History is the saved conversations. The module draws the list, but it has no disk of its own, so
the extension host stores each finished turn in DeepSeek: Run Workflow... and DeepSeek: Show Workflow... open the chosen workflow in a
WASM-rendered tab showing that form. Filling the fields and pressing a script's Run runs that
script's steps in order: commands in the workspace under DeepSeek: Open Workflow Document... opens the source, where you can review or edit the steps. Tools is the surface that decides what the agent may call. It lists the built-in tools the grant
allows, the custom tools from the extension's global tools folder, and the workspace's single-script
workflows. Every row has a checkbox: built-in tools start allowed, while a custom tool or a workflow
the agent creates starts disabled and stays off until the user ticks it. A ticked item runs its own
A custom tool is a document in the extension's global tools folder, not in the current project.
A tool the agent creates is
The script accepts The Zero gallery is a public repository of tools, cloned automatically into
Publishing needs push access. DeepSeek: Sign In to GitHub uses VS Code's built-in GitHub
authentication with the Tasks is a queue of discrete jobs. + Add task opens an inline form with a title and an
optional description; each card shows both, its checkbox marks it done, and The panel follows the active VS Code colour theme (dark, light, and high contrast). It reads the
workbench's The bundled host and module come from the MIT-licensed
Advance project; see
3. Configuration ReferenceExtension settings are under the Core Settings (
|
| Setting | Type | Default | Description |
|---|---|---|---|
deepseek.apiKey |
string | "" |
DeepSeek API key. Prefer secret storage (for example via DeepSeek: Set API Key). |
deepseek.apiEndpoint |
string | https://api.deepseek.com/chat/completions |
API endpoint override. |
deepseek.model |
string | "deepseek-v4-flash" |
Model used by the Zero panel. The Copilot provider uses the model selected in VS Code's picker. |
Provider key in Manage Models: the DeepSeek provider also declares an
apiKeyfield in VS Code's model-provider settings. VS Code prompts for it when you add DeepSeek in Manage Models... and stores it in VS Code secret storage. It is used only by the Copilot provider; the Zero panel uses thedeepseek.*key described above.
Making DeepSeek the default: run DeepSeek: Use as Default Chat Model, or set the built-in
chat.defaultModelsetting to"deepseek-v4-flash"or"deepseek-v4-pro". VS Code also accepts the family name"deepseek". This is a VS Code setting, not an extension setting.
Hosted Token Allowance (deepseek.account.*)
Optional. Requires the quota proxy in server/.
| Setting | Type | Default | Description |
|---|---|---|---|
deepseek.account.githubClientId |
string | "" |
Client ID of a GitHub OAuth app with Device Flow enabled. Used only for device-flow sign-in. |
deepseek.account.proxyUrl |
string | http://localhost:8787 |
Base URL of the quota proxy (POST /v1/session, GET /v1/usage, POST /v1/chat/completions). |
Copilot Debug Settings (deepseek-copilot.*)
| Setting | Type | Default | Description |
|---|---|---|---|
deepseek-copilot.debugMode |
"minimal" | "metadata" | "verbose" |
"minimal" |
Controls request diagnostics; "minimal" hides request summaries, while "metadata" and "verbose" log them. |
deepseek-copilot.stabilizePromptCache |
boolean | true |
Replaces the per-session identifiers VS Code embeds in the system prompt (<session_context> folder and the VSCODE_TARGET_SESSION_LOG path) with a stable placeholder. DeepSeek caches an exact prefix, so a new session UUID would otherwise invalidate the rest of the prompt and every tool definition. Disable to send the prompt unchanged. |
Zero Panel Settings (deepseek.advance.*)
| Setting | Type | Default | Description |
|---|---|---|---|
deepseek.advance.harnessWasm |
string | "" |
Path to advance_harness.wasm. Empty uses the bundled copy, then a workspace target/wasm32-unknown-unknown/{release,debug} build. |
deepseek.advance.galleryUrl |
string | https://github.com/zikalino/zero-gallery.git |
Git URL of the tool gallery, cloned into <globalStorage>/zero-gallery. Point it at a fork to publish there. |
deepseek.advance.allowWrite |
boolean | true |
Let the Zero agent's built-in file tools create, edit, move and delete files in the first workspace folder. A custom tool or workflow the user has allowed runs its own write steps regardless; those writes stay inside the workspace. |
deepseek.advance.allowedCommands |
string[] | [] |
Programs the built-in shell tool may run. Empty removes the shell tool entirely. A custom tool or workflow the user has allowed runs its own command steps regardless. |
deepseek.advance.commandTimeoutSeconds |
number (1–3600) | 120 |
How long a Zero command may run before it is killed. |
deepseek.advance.pricing.models |
object | {} |
Off-peak dollars per million tokens per model id, for example { "deepseek-v4-pro": { "inputPerMillion": 0.66 } }. Models left out use the built-in DeepSeek prices (V4 Flash and V4 Pro). |
deepseek.advance.pricing.peakMultiplier |
number | 2 |
Multiple of the off-peak prices charged in peak hours (01:00–04:00 and 06:00–10:00 UTC, Monday–Friday). 1 bills every hour at the off-peak rate. |
deepseek.advance.pricing.holidays |
string[] | [] |
UTC dates (YYYY-MM-DD) billed at the off-peak rate all day, such as Chinese public holidays. |
deepseek.advance.pricing.inputPerMillion, .cachedPerMillion, .outputPerMillion |
number | 0 |
Flat per-million rates for every model, for the panel's cost divider. Non-zero replaces the built-in per-model table. |
Internal Copilot Settings (advanced)
| Setting | Namespace | Description |
|---|---|---|
baseUrl |
deepseek-copilot |
API base URL for the deepseek-copilot provider. |
maxTokens |
deepseek-copilot |
Max output tokens (0 = model default). |
experimental.stabilizeToolList |
deepseek-copilot |
Enable tool list stabilization across turns. |
visionModel |
deepseek-copilot |
Model used for vision proxy image descriptions. |
4. Commands Reference
Commands marked with 🔍 are accessible from the F1 command palette.
F1-Accessible Commands
| Command ID | Title | Description |
|---|---|---|
🔍 deepseek.setApiKey |
DeepSeek: Set API Key | Store or replace the DeepSeek API key shared by the Zero panel and the Copilot provider; the dialog pre-fills an existing key, and an empty value clears it. |
🔍 deepseek.clearApiKey |
DeepSeek: Clear API Key | Remove the stored DeepSeek API key. |
🔍 deepseek.useAsDefaultModel |
DeepSeek: Use as Default Chat Model | Pick a DeepSeek model and set VS Code's chat.defaultModel so new chat conversations start with it. |
🔍 deepseek.showLogs |
DeepSeek: Browse Failed Requests | Browse the failed-request dumps in .smartercode/deepseek-failures/. |
🔍 deepseek.showUsageGraph |
DeepSeek: Show Token Usage Graph | Open a live per-request token chart: cache hit, input miss and output for every API call. |
🔍 deepseek.advance.newChat |
DeepSeek: New Zero Chat | Start a fresh conversation in the Zero panel. |
🔍 deepseek.advance.abort |
DeepSeek: Stop the Zero Turn | Cancel the current Zero turn. |
🔍 deepseek.advance.runWorkflow |
DeepSeek: Run Workflow... | List the workspace's workflows and open the chosen one's WASM form; its Run starts the script. |
🔍 deepseek.advance.showWorkflow |
DeepSeek: Show Workflow... | Open the chosen workflow's WASM form in a tab. |
🔍 deepseek.advance.openWorkflowDocument |
DeepSeek: Open Workflow Document... | Open the chosen workflow's markdown source to review or edit. |
🔍 deepseek.advance.githubSignIn |
DeepSeek: Sign In to GitHub | Sign in with VS Code's GitHub authentication provider; if already signed in, asks whether to sign out. |
🔍 deepseek.advance.githubSignOut |
DeepSeek: Sign Out of GitHub | Forget the GitHub session. |
🔍 deepseek.advance.openSettings |
DeepSeek: Configure Zero | Open the deepseek.advance.* settings in VS Code. |
🔍 deepseek.account.signIn |
DeepSeek: Sign In for Free Tokens | GitHub device-flow sign-in; unlocks the hosted monthly allowance. |
🔍 deepseek.account.showUsage |
DeepSeek: Show Token Allowance | Show the tier, tokens used and reset date for the signed-in account. |
🔍 deepseek.account.signOut |
DeepSeek: Sign Out of Token Allowance | Forget the stored GitHub token and session. |
5. Architecture Overview
extension.ts (activate)
├── copilot.ts ─────────────► provider/index.ts ──► client/core.ts ──► DeepSeek API
│ └── debug / replay / tools / vision helpers
│
├── advance/panel.ts ───────► advance/engine-worker.ts ──► advance_harness.wasm
│ └── Router / Guest / NetPumps (fs, commands, HTTP)
│
└── deepseekLogBrowser.ts ──► .smartercode/deepseek-failures/*.json
Key Design Decisions
Copilot-native provider — DeepSeek is registered as a
LanguageModelChatProvider, so the model picker, tools, and chat UI stay in VS Code.client/core.tsis the HTTP/streaming boundary; theprovider/helpers handle conversion, debugging, replay, tool limits, and vision proxying.WASM-isolated Zero agent — The Zero panel's UI and agent loop are the bundled
advance_harness.wasm. It runs on a worker thread so long commands cannot block the editor, and the host supplies only the capabilities defined inadvance/protocol.ts.Failure dumps, not a request log — Every failed request is written to
.smartercode/deepseek-failures/with its exact request and response bodies. The failure browser reads those dumps, and only the newest 50 are retained.One configuration surface — Copilot and Zero both read
deepseek.apiEndpointanddeepseek.model, and both resolve the key from secret storage or thedeepseek.apiKeysetting.
6. Build & Install
Prerequisites
- Node.js 18+
- VS Code 1.85+
Build
cd vscode-extensions/vscode-deepseek
npm install
npm run compile
Package & Install
Run buin.bat from the extension folder:
buin.bat
This runs vsce package (which triggers vscode:prepublish → precompile → compile), then code --install-extension on the resulting .vsix.
If shared components have changed (shared/vscode-components/), vsce package automatically runs prepare:shared-components to materialize the latest build.
After install, reload VS Code:
Ctrl+Shift+P → Developer: Reload Window
Extension Structure
vscode-deepseek/
├── src/
│ ├── extension.ts # Activation: Copilot provider, Zero panel, failure browser, usage graph
│ ├── auth.ts # API key management via SecretStorage
│ ├── consts.ts # Constants & model definitions
│ ├── types.ts # TypeScript types
│ ├── logger.ts # Output channel logger
│ ├── i18n.ts # Internationalization (Chinese/English)
│ ├── copilot.ts # Registers the LanguageModelChatProvider
│ ├── deepseekFailures.ts # Writes failed-request dumps
│ ├── deepseekLogBrowser.ts # Webview for browsing failure dumps
│ ├── usage.ts # Per-request token samples for the graph
│ ├── usageGraph.ts # Live token-usage webview
│ ├── advance/ # WASM harness host + Zero panel provider
│ │ ├── customTools.ts # Global tools folder discovery/parsing
│ │ ├── toolCatalogue.ts # Tool-definition wire types + name sanitising
│ ├── client/
│ │ ├── core.ts # Copilot provider HTTP client
│ │ └── error.ts # Error handling utilities
│ └── provider/
│ ├── index.ts # DeepSeekChatProvider (Copilot integration)
│ ├── convert.ts # Message/tool format conversion
│ ├── schema.ts # Schema validation
│ ├── debug/ # Request classification & diagnostics
│ ├── replay/ # Conversation replay engine
│ ├── tools/ # Tool stabilization & limits
│ └── vision/ # Vision proxy for image input
├── vendor/ # Materialized common-webviews (failure browser)
├── media/ # Zero panel canvas, styles, and WASM harness
├── imgs/ # Extension icons
├── scripts/ # Build scripts
├── package.json
├── tsconfig.json
└── buin.bat
