Repository navigation
feat(account): balance says what is left on fal too - #85
Merged
Merged
Conversation
`balance` asked PixelLab and stopped there, which was the whole answer while PixelLab was the only provider that could say. The question a person asks before a paid run is about the account they are about to spend from, and there are two. Where a fal key is configured the command now prints `fal credits: $7.37` beside the generations and the PixelLab credits. Where there is no fal key it prints nothing about fal and sends no request: fal is optional, and a line about a provider an account does not have reads as a fault. Not the documented route. `GET /v1/account/billing?expand=credits` on api.fal.ai answers 403 authorization_error to the key this tool holds — that key is API scope and billing is admin scope, and asking for a second, wider key so a free line can be printed is the worse trade. What fal's own dashboard reads takes the key we already have: GET https://rest.alpha.fal.ai/billing/user_balance Authorization: Key <FAL_KEY> -> 200 7.3747928 Undocumented, and the host says `alpha`, so the code treats it as a ceiling rather than a contract: no key, an HTTP error, a body that is not a number, and a number that is not finite all come back as `fal: not reported`, and none of them can cost the PixelLab half of the answer. `inf` and `nan` parse, and a balance shown as `$nan` reads as a figure the account holds. In `--json` the PixelLab keys stay at the top level and fal goes under `fal`, so nothing reading the existing shape by name has to change; configured-and-silent is `{"credits_usd": null}` rather than an absent key, which is how a parser tells it from an account with no fal at all. specs/provider-core R5.4, R5.5. Note n-0062. Verified with scc validate --checks --pr: 1836 passed, 58 skipped, coverage 95.32%, ruff check and format clean, artifacts clean. Confirmed live against the account: three lines, the fal one reading $7.37.
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.
No description provided.