Skip to content

Deekseek integration#468

Open
Drvolks wants to merge 1 commit into
robinebers:mainfrom
Drvolks:feature/deekseek-api-integration
Open

Deekseek integration#468
Drvolks wants to merge 1 commit into
robinebers:mainfrom
Drvolks:feature/deekseek-api-integration

Conversation

@Drvolks
Copy link
Copy Markdown

@Drvolks Drvolks commented May 14, 2026

Description

Add Deepseek as a provider

Related Issue

Address #467

Type of Change

  • Bug fix
  • New feature
  • New provider plugin
  • Documentation
  • Performance improvement
  • Other (describe below)

Testing

  • I ran bun run build and it succeeded
  • I ran bun run test and all tests pass
  • I tested the change locally with bun tauri dev

Screenshots

Capture d’écran, le 2026-05-14 à 15 07 06

Checklist

  • I read CONTRIBUTING.md
  • My PR targets the main branch
  • I did not introduce new dependencies without justification

Summary by cubic

Adds the deepseek provider plugin to fetch account balance from DeepSeek’s API and show it as a dollar progress line. Includes docs, tests, icon, and env var whitelist support for seamless setup.

  • New Features

    • New deepseek provider plugin (GET https://api.deepseek.com/user/balance) showing Balance as dollars (used = DEEPSEEK_INITIAL_BALANCE − remaining).
    • Currency handling: prefer USD, fall back to CNY.
    • Added docs (docs/providers/deepseek.md), README entry, icon, and tests.
    • Whitelisted DEEPSEEK_API_KEY and DEEPSEEK_INITIAL_BALANCE in the Tauri host.
  • Migration

    • Set DEEPSEEK_API_KEY.
    • Set DEEPSEEK_INITIAL_BALANCE to your starting balance (e.g., 10.00).

Written for commit 30e4d02. Summary will update on new commits.

@github-actions github-actions Bot added rust Pull requests that update rust code plugin docs labels May 14, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

@validatedev validatedev requested a review from Copilot May 14, 2026 21:16
@validatedev
Copy link
Copy Markdown
Collaborator

@codex review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new DeepSeek provider plugin to OpenUsage, enabling users to display their DeepSeek account balance as a progress line (using a user-supplied starting balance) and wiring up the necessary docs and host env-var access.

Changes:

  • Added a new deepseek plugin (manifest, JS probe, icon) and accompanying Vitest coverage.
  • Documented the provider and linked it from the main README.
  • Whitelisted DEEPSEEK_API_KEY and DEEPSEEK_INITIAL_BALANCE for the Tauri host env API.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src-tauri/src/plugin_engine/host_api.rs Whitelists DeepSeek-related env vars for plugin access.
README.md Adds DeepSeek to the providers list.
plugins/deepseek/plugin.test.js Introduces unit tests for DeepSeek probe behavior and error handling.
plugins/deepseek/plugin.json Adds the DeepSeek plugin manifest and declares the output line(s).
plugins/deepseek/plugin.js Implements the DeepSeek balance probe against /user/balance.
plugins/deepseek/icon.svg Adds the provider icon.
docs/providers/deepseek.md Adds provider documentation (auth, endpoint, mapping, errors).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +100 to +112
const remainingBalance = findBalance(json.balance_infos)
if (remainingBalance === null) {
throw "Could not find balance in response."
}

const used = Math.max(0, initialBalance - remainingBalance)

const line = {
label: "Balance",
used: used,
limit: initialBalance,
format: { kind: "dollars" },
}
Comment on lines +4 to +5
const USAGE_URL = "https://api.deepseek.com/user/balance"

const plugin = await loadPlugin()
const result = plugin.probe(ctx)

// remaining = 55.00, initial = 100, used = 45.00
Comment on lines +205 to +217
it("reads key from all env vars", async () => {
const ctx = makeCtx()
setEnv(ctx, { DEEPSEEK_API_KEY: "sk-from-key", DEEPSEEK_INITIAL_BALANCE: "10" })

const payload = successPayload()
ctx.util.request = vi.fn(() => ({
status: 200,
bodyText: JSON.stringify(payload),
}))

const plugin = await loadPlugin()
expect(() => plugin.probe(ctx)).not.toThrow()
})
Comment on lines +16 to +20
| Variable | Required | Description |
|---|---|---|
| `DEEPSEEK_API_KEY` | yes | DeepSeek API key from [platform.deepseek.com](https://platform.deepseek.com/) |
| `DEEPSEEK_INITIAL_BALANCE` | yes | Your starting balance (e.g. `10.00`). Must be > 0. |

Comment thread README.md
- [**Codex**](docs/providers/codex.md) / session, weekly, reviews, credits
- [**Copilot**](docs/providers/copilot.md) / premium, chat, completions
- [**Cursor**](docs/providers/cursor.md) / credits, total usage, auto usage, API usage, on-demand, CLI auth
- [**DeepSeek**](docs/providers/deepseek.md) / balance (USD)
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

We were unable to download your code in a timely manner.
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@validatedev
Copy link
Copy Markdown
Collaborator

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30e4d020c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +56 to +59
if (info.currency === "USD") return balance
if (info.currency === "CNY") cnyBalance = balance
}
return cnyBalance
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject or convert CNY before reporting dollar usage

DeepSeek’s /user/balance can return CNY balances, but findBalance falls back to CNY and the plugin still reports the metric with format: { kind: "dollars" }. In that case, the app subtracts a CNY amount from DEEPSEEK_INITIAL_BALANCE and presents the result as USD, which produces incorrect spend values for CNY-only accounts. Handle non-USD explicitly (convert with a reliable rate or fail with a clear error) before emitting a dollars-formatted progress line.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs plugin rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants