Skip to content

feat(neuralwatt): add Neuralwatt provider plugin#410

Open
hungps wants to merge 5 commits intorobinebers:mainfrom
hungps:feat/neuralwatt-plugin
Open

feat(neuralwatt): add Neuralwatt provider plugin#410
hungps wants to merge 5 commits intorobinebers:mainfrom
hungps:feat/neuralwatt-plugin

Conversation

@hungps
Copy link
Copy Markdown

@hungps hungps commented Apr 26, 2026

Description

Adds a new provider plugin for Neuralwatt, an energy-based AI inference provider. The plugin calls GET /v1/quota using a NEURALWATT_API_KEY bearer token and surfaces:

  • Subscription — kWh used vs. included in the current billing period, with reset date and period duration
  • Balance — USD credits used vs. total
  • Method badge — accounting method (e.g. "Energy")

Also adds NEURALWATT_API_KEY to the host API env var allowlist so the plugin sandbox can read it.

Related Issue

Fixes #409

Type of Change

  • New provider plugin

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

image

Checklist

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

Summary by cubic

Adds a neuralwatt provider plugin that calls GET https://api.neuralwatt.com/v1/quota using NEURALWATT_API_KEY to show subscription energy, credits balance, and accounting method. Adds docs and allowlists the env var so the plugin can run.

  • New Features

    • Fetches quota with bearer NEURALWATT_API_KEY.
    • Shows Subscription (kWh used vs included) with resetsAt and periodDurationMs; only for Subscription.
    • Shows Balance (USD used vs total); hidden when total is 0; adds Method badge.
    • Displays Plan (capitalized) and a “No usage data” Status badge when nothing else is available.
  • Bug Fixes

    • Set Method line to badge in plugins/neuralwatt/plugin.json to match probe() and fix UI skeleton and tray ordering.
    • Aligned manifest line order, scopes, and the Status overview badge with probe() and docs.

Written for commit fd78d3f. Summary will update on new commits.

@github-actions github-actions Bot added rust Pull requests that update rust code plugin labels Apr 26, 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 5 files

Copy link
Copy Markdown
Owner

@robinebers robinebers left a comment

Choose a reason for hiding this comment

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

Hey! This is Rob's AI reviewer. Thanks for the contribution.

Clean plugin overall. The structure, icon, API call, env allowlist, and tests look solid. Two things to fix before merge:

  1. Fix number parsingreadNumber() currently turns null, "", and false into 0. That can show fake “0 used” usage if Neuralwatt leaves a field out. Please only accept real numbers or non-empty numeric strings.

  2. Add the provider docs — new bundled providers should be added to README.md and have a docs/providers/neuralwatt.md page, matching the other providers.

Small extra: new plugins usually start at version 0.0.1, but this one starts at 0.0.2.

Everything else looks good.

@github-actions github-actions Bot added the docs label Apr 28, 2026
@hungps hungps force-pushed the feat/neuralwatt-plugin branch from 886cc41 to d6c0b57 Compare April 28, 2026 10:07
@hungps hungps requested a review from robinebers April 28, 2026 10:11
@hungps
Copy link
Copy Markdown
Author

hungps commented Apr 29, 2026

@robinebers done and done!

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 Neuralwatt provider plugin to the OpenUsage plugin ecosystem, including sandbox env-var allowlisting so the plugin can authenticate via NEURALWATT_API_KEY, plus documentation and README discovery.

Changes:

  • Added a new plugins/neuralwatt provider plugin that calls GET https://api.neuralwatt.com/v1/quota and renders subscription energy, balance credits, and an accounting method badge.
  • Added vitest coverage for key success/error cases for the new plugin.
  • Allowlisted NEURALWATT_API_KEY in the Tauri host API and added provider docs + README link.

Reviewed changes

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

Show a summary per file
File Description
src-tauri/src/plugin_engine/host_api.rs Allowlists NEURALWATT_API_KEY for plugin sandbox env access
plugins/neuralwatt/plugin.js Implements Neuralwatt quota fetch + parsing into OpenUsage metric lines
plugins/neuralwatt/plugin.json Declares plugin manifest (id/name/icon/line definitions)
plugins/neuralwatt/plugin.test.js Adds automated tests for Neuralwatt plugin behavior
plugins/neuralwatt/icon.svg Adds provider icon
docs/providers/neuralwatt.md Adds provider documentation and expected mapping/errors
README.md Links Neuralwatt provider docs from the provider list

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

Comment thread plugins/neuralwatt/plugin.json Outdated
Comment thread docs/providers/neuralwatt.md Outdated
@hungps hungps force-pushed the feat/neuralwatt-plugin branch from 792a051 to ae724b8 Compare May 1, 2026 11:19
@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: ae724b84f1

ℹ️ 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 thread plugins/neuralwatt/plugin.json Outdated
@hungps hungps force-pushed the feat/neuralwatt-plugin branch 2 times, most recently from f1961ee to 575ba66 Compare May 3, 2026 07:56
@validatedev
Copy link
Copy Markdown
Collaborator

@codex review again

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ 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".

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

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


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

Comment thread plugins/neuralwatt/plugin.js
Comment thread docs/providers/neuralwatt.md Outdated
Comment thread plugins/neuralwatt/plugin.json Outdated
hungps and others added 5 commits May 7, 2026 20:58
…tion

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
plugin.json declared Method as a progress line with primaryOrder, but
probe() emits it as ctx.line.badge(). This mismatch caused wrong UI
skeleton rendering and incorrect tray primary-candidate ordering.
@hungps hungps force-pushed the feat/neuralwatt-plugin branch from 71712b7 to fd78d3f Compare May 7, 2026 13:59
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.

Add Neuralwatt Cloud provider plugin

4 participants