Skip to content

feat: Add DeepSeek provider support - #31

Merged
DimazzzZ merged 3 commits into
mainfrom
feature/deepseek-provider
Aug 18, 2026
Merged

DimazzzZ merged 3 commits into
mainfrom
feature/deepseek-provider

Conversation

@DimazzzZ

Copy link
Copy Markdown
Owner

Summary

Adds DeepSeek as a new provider in TokenPulse. DeepSeek exposes a dedicated GET /user/balance endpoint authenticated with a simple Bearer API key — making it the lowest-effort, highest-value new provider to add.

What's Included

Core Implementation

  • Provider enum: DEEPSEEK with display name "DeepSeek" and abbreviation "DS"
  • ConnectionType: DEEPSEEK_API with REMAINING_ONLY balance format
  • DeepSeekProviderClient: Full provider client (~150 LOC) that:
    • Calls GET https://api.deepseek.com/user/balance
    • Parses total_balance and currency from balance_infos[]
    • Maps HTTP errors to appropriate failure types (AuthError, RateLimited, NetworkError)
    • Stores currency (CNY/USD) in metadata for future display enhancements
  • DeepSeekConnectDialog: Simple API key input with link to platform keys page
  • Registry & wiring: Registered in DefaultProviderRegistry, wired into AccountEditDialog

Tests

  • 11 unit tests covering success paths (CNY/USD), auth errors, rate limits, network errors, and parse errors
  • All 752+ existing tests continue to pass
  • Detekt linting passes

Documentation

  • README updated (provider count, auth table, error handling section)
  • plugin.xml updated with DeepSeek in supported providers list

Testing

./gradlew compileKotlin test detekt  # All pass

Architecture Notes

Follows the same pattern as Cline/OpenRouter: static API key, single JSON endpoint, no refresh logic. This is the simplest category of provider integration in the existing architecture.

- Add DEEPSEEK to Provider enum with display name and abbreviation
- Add DEEPSEEK_API ConnectionType with dedicated balance endpoint
- Implement DeepSeekProviderClient for GET /user/balance integration
  - Parses total_balance and currency from balance_infos array
  - Handles auth errors (401/403), rate limits (429), and network errors
  - Stores currency in metadata for future UI enhancements
- Add DeepSeekConnectDialog for simple API key input
- Wire DeepSeek into AccountEditDialog with provider URL and hint text
- Register DeepSeekProviderClient in DefaultProviderRegistry
- Add comprehensive unit tests (11 test cases covering success/error paths)
- Update README.md with DeepSeek in provider list and auth table
- Update plugin.xml to list DeepSeek as supported provider

Closes #<issue-number-if-any>
The is_available field indicates whether the account has enough balance to make
API calls, not whether the API key is valid. A brand-new key with $0.00 balance
returns is_available=false but is perfectly valid.

Remove the is_available gate and always parse balance_infos when present. This
allows users with fresh, unloaded keys to see $0.00 in the status bar instead
of an error.

Also fix the test that locked in the wrong behavior.
@DimazzzZ DimazzzZ added type: feature New feature or enhancement domain: provider AI provider integrations labels Aug 17, 2026
@DimazzzZ DimazzzZ self-assigned this Aug 17, 2026
Commit 60ed88b accidentally committed an unrelated dirty-worktree change to
build.gradle.kts (platform plugin 2.3.0->2.18.1 + broken create(it,it) call)
and a .salive compiler artifact via 'git add -A'. Both broke CI:
- Plugin Verifier: 'Specified type IU-2026.2.1 is unknown' (create() misparse)
- platformTest: NoSuchMethodError (platform binary mismatch from version bump)

Restore build.gradle.kts to match main; add .kotlin/ to .gitignore.
@DimazzzZ
DimazzzZ merged commit c02bf05 into main Aug 18, 2026
4 checks passed
@DimazzzZ
DimazzzZ deleted the feature/deepseek-provider branch August 18, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: provider AI provider integrations type: feature New feature or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant