Add Fireworks balance usage panel - #6488
Open
dhh wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Fireworks prepaid usage and estimated-balance support to the model-usage panel.
Changes:
- Adds Fireworks billing scanning, credentials, and tests.
- Adds balance UI and three-provider navigation.
- Documents Fireworks funding configuration.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
test/shell.d/model-usage-fireworks-scanner-test.sh |
Tests Fireworks parsing and failures. |
shell/plugins/model-usage/scripts/fireworks_usage_scanner.py |
Fetches usage and estimates balance. |
shell/plugins/model-usage/README.md |
Documents Fireworks configuration. |
shell/plugins/model-usage/providers/Fireworks.qml |
Adds the Fireworks provider adapter. |
shell/plugins/model-usage/providers/Codex.qml |
Adds shared provider properties. |
shell/plugins/model-usage/providers/Claude.qml |
Adds shared provider properties. |
shell/plugins/model-usage/Panel.qml |
Renders prepaid balance information. |
shell/plugins/model-usage/manifest.json |
Registers Fireworks defaults. |
shell/plugins/model-usage/Main.qml |
Integrates Fireworks and synchronization. |
shell/plugins/model-usage/assets/fireworks.svg |
Adds the provider icon. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+240
to
+249
| def usage(self, account_id: str, start_day: date, end_day: date) -> dict[str, Any]: | ||
| quoted = urllib.parse.quote(normalize_account_id(account_id), safe="") | ||
| query = { | ||
| "startTime": start_day.isoformat() + "T00:00:00Z", | ||
| "endTime": end_day.isoformat() + "T00:00:00Z", | ||
| "usageType": "SERVERLESS", | ||
| "timezone": timezone_name(), | ||
| "groupBy": ["model_name"], | ||
| } | ||
| return self.request(f"/v1/accounts/{quoted}/billingUsage", query=query) |
Comment on lines
+243
to
+246
| "startTime": start_day.isoformat() + "T00:00:00Z", | ||
| "endTime": end_day.isoformat() + "T00:00:00Z", | ||
| "usageType": "SERVERLESS", | ||
| "timezone": timezone_name(), |
| onReadyChanged: root.scheduleSync() | ||
| } | ||
|
|
||
| property var providers: [claudeProvider, codexProvider, fireworksProvider] |
Comment on lines
+239
to
+247
| if (root.hasBalance) { | ||
| var parts = [] | ||
| if (provider.balanceEstimated === true) parts.push("Estimated balance") | ||
| var refreshedAt = Number(provider.lastRefreshedAtMs || 0) | ||
| if (refreshedAt > 0) { | ||
| var ageMs = Math.max(0, root.nowMs - refreshedAt) | ||
| parts.push(ageMs < 60000 ? "Updated now" : "Updated " + formatDuration(ageMs) + " ago") | ||
| } | ||
| return parts.join(" · ") |
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
Testing
Notes
Fireworks does not expose its live prepaid ledger through the documented API. The displayed balance is explicitly labeled estimated and is calculated from configured funded credit minus rated account costs.