Skip to content

feat: add Synthetic provider plugin#329

Open
ben-vargas wants to merge 2 commits intorobinebers:mainfrom
ben-vargas:synthetic-provider-plugin
Open

feat: add Synthetic provider plugin#329
ben-vargas wants to merge 2 commits intorobinebers:mainfrom
ben-vargas:synthetic-provider-plugin

Conversation

@ben-vargas
Copy link
Copy Markdown

@ben-vargas ben-vargas commented Mar 30, 2026

Description

Adds a new provider plugin for Synthetic that displays quota usage from their /v2/quotas API endpoint.

Synthetic is currently rolling out a new rate limit system (v3) alongside the legacy subscription model. This plugin supports both:

  • v3 users see a rolling 5h request limit, weekly mana bar, and hourly search quota
  • Legacy users see subscription request count, free tool calls, and hourly search quota

The plugin auto-detects which system the user is on based on whether the API response contains usable v3 quota fields for rollingFiveHourLimit or weeklyTokenLimit.

API key discovery checks multiple sources in order:

  1. Pi auth.json
  2. Pi models.json
  3. Factory/Droid settings.json (matches customModels entries with synthetic.new in the baseUrl)
  4. OpenCode auth.json
  5. SYNTHETIC_API_KEY env var

Related Issue

N/A — no existing issue for this provider.

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 (991 tests, 59 files, including 52 new tests for this plugin)
  • I tested the change locally with bun tauri dev

Screenshots

Overview — Synthetic in the main plugin list

1-overview

Detail view — 5h Rate Limit, Mana Bar, and Search

2-detail-view

Settings — Synthetic as a toggleable plugin

3-config

API response — raw /v2/quotas output matching the displayed values

4-direct-quota-endpoint-call

Synthetic billing page — their own dashboard for comparison

5-synthetic-billing-use-page

Files

Added:

  • plugins/synthetic/plugin.json — manifest with 6 line declarations
  • plugins/synthetic/plugin.js — probe implementation with multi-source auth discovery
  • plugins/synthetic/plugin.test.js — 52 tests covering auth, errors, all line types, v3/legacy detection
  • plugins/synthetic/icon.svg — sourced from synthetic.new/favicon.svg
  • docs/providers/synthetic.md — provider documentation

Modified:

  • src-tauri/src/plugin_engine/host_api.rs — added SYNTHETIC_API_KEY and PI_CODING_AGENT_DIR to env var whitelist

Checklist

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

Add a new provider plugin for Synthetic (synthetic.new) that displays
quota usage from their /v2/quotas API endpoint.

Supports both the new v3 rate limit system (rolling 5h request limit
and weekly mana bar) and the legacy subscription based quota, showing
whichever is relevant to the user's account. Search quota is shown
for all users.

API key discovery checks multiple sources in order: Pi auth.json,
Pi models.json, Factory/Droid settings.json, OpenCode auth.json,
and the SYNTHETIC_API_KEY env var. Two new env vars are whitelisted
in the Rust host (SYNTHETIC_API_KEY and PI_CODING_AGENT_DIR).

Icon sourced from synthetic.new/favicon.svg. Brand color is black
to match their branding.

Files added:
- plugins/synthetic/plugin.json
- plugins/synthetic/plugin.js
- plugins/synthetic/plugin.test.js (52 tests)
- plugins/synthetic/icon.svg
- docs/providers/synthetic.md

Files modified:
- src-tauri/src/plugin_engine/host_api.rs (env var whitelist)
Copilot AI review requested due to automatic review settings March 30, 2026 18:28
@github-actions github-actions bot added rust Pull requests that update rust code plugin docs labels Mar 30, 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 6 files

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: 54e15dd895

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

Adds a new “Synthetic” provider plugin that fetches and displays quota usage from Synthetic’s /v2/quotas endpoint, including support for both the new v3 rate-limit system and the legacy subscription model.

Changes:

  • Added synthetic provider plugin (manifest, implementation, icon) and comprehensive Vitest coverage.
  • Added provider documentation for Synthetic (auth discovery, endpoint details, displayed metrics).
  • Whitelisted SYNTHETIC_API_KEY and PI_CODING_AGENT_DIR for plugin env access in the Tauri host API.

Reviewed changes

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

Show a summary per file
File Description
src-tauri/src/plugin_engine/host_api.rs Extends env-var allowlist to support Synthetic plugin auth/discovery.
plugins/synthetic/plugin.json Declares Synthetic plugin metadata and line definitions (scopes/orders).
plugins/synthetic/plugin.js Implements API key discovery and /v2/quotas probing + line rendering.
plugins/synthetic/plugin.test.js Adds extensive tests covering auth resolution, errors, and v3/legacy outputs.
plugins/synthetic/icon.svg Adds Synthetic icon used in UI.
docs/providers/synthetic.md Documents auth sources, API shape, and displayed lines for Synthetic.

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

@validatedev
Copy link
Copy Markdown
Collaborator

@ben-vargas if you can resolve the conversation we can continue with merging process, thank you for your contribution!

@ben-vargas
Copy link
Copy Markdown
Author

@validatedev addressed the actionable bot feedback, pushed the fixes (5225bd4), updated the PR description wording for v3 detection, and replied on each review thread. I also resolved the addressed conversations, so this should be ready for another pass.

Copy link
Copy Markdown
Collaborator

@validatedev validatedev left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes, current code looks good to be merged!

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