feat: add /usage slash command for DeepSeek API balance#216
Open
al4xdev wants to merge 2 commits into
Open
Conversation
- Add 'usage' to SlashCommandKind type and BUILTIN_SLASH_COMMANDS - Handle /usage in PromptInput (command type + handleSlashSelection) - Create handleUsage callback in App: detects DeepSeek via baseURL, fetches GET /user/balance, displays result as system message - Detect slash commands in -p/--prompt startup path - Show provider mismatch error when baseURL is not api.deepseek.com
…m message Replace inline system message with a UsageView component (bordered box, Esc to close), matching the MCP status pattern. This avoids render issues with addSessionSystemMessage and provides a cleaner UX.
Contributor
Contributor
上面是 /.deepcode/plugins/deepseek-balance.mjs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Add a
/usageslash command that queries the DeepSeek API (GET /user/balance) and displays the user's credit balance and availability status in a dedicated bordered view.Motivation
DeepSeek API users with prepaid credits have to visit the DeepSeek website to check their balance. This command brings that information directly into the CLI.
Design
The command opens a bordered view (same pattern as
/mcpstatus). PressEscto return to chat.Provider detection
baseURL.includes("api.deepseek.com")→ callsGET https://api.deepseek.com/user/balanceError handling
setErrorLinewith base URLsetErrorLinesetErrorLinewith statussetErrorLinewith messageFiles Changed
packages/cli/src/ui/views/UsageView.tsxpackages/cli/src/ui/core/slash-commands.ts"usage"kind + built-in entrypackages/cli/src/ui/views/App.tsxhandleUsagecallback + view routingpackages/cli/src/ui/views/PromptInput.tsxpackages/cli/src/tests/slash-commands.test.tsVerification