🚀 feat: Admin balance management API endpoints#11754
Open
olivierbossel wants to merge 4 commits intodanny-avila:mainfrom
Open
🚀 feat: Admin balance management API endpoints#11754olivierbossel wants to merge 4 commits intodanny-avila:mainfrom
olivierbossel wants to merge 4 commits intodanny-avila:mainfrom
Conversation
…-model-specs-balance
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.
🚀 feat: Admin balance management API endpoints
Manage balances through some API-Key protected API endpoints:
GET/api/balance/admin/get-balancePOST/api/balance/admin/set-balancePOST/api/balance/admin/add-balanceGET/api/balance/admin/get-balanceGet the balance for a specific user.
Query params:
email: The user email wantedJSON response:
{ "email": "...", "balance": 1009, "perSpecTokenCredits": { "buzz-gpt-4-1": 1009 } }POST/api/balance/admin/set-balanceSet the balance of a specific user:
JSON payload:
{ "email": "...", "amount": 1000, # Optional spec (see related pull request) # "spec": "Buzz GPT-4.1" }JSON response:
{ "message": "Balance set successfully to 1000 for user ... and spec ...", "email": "...", "balance": 1009, "perSpecTokenCredits": { "buzz-gpt-4-1": 1000 } }POST/api/balance/admin/add-balanceAdd some credits to a specific user.
JSON payload
{ "email": "ob@buzzbrothers.ch", "amount": 9, # Optional spec (see related pull request) # "spec": "Buzz GPT-4.1" }### JSON response
{ "message": "9 added successfully for user ... and spec ...", "email": "...", "balance": 1009, "perSpecTokenCredits": { "buzz-gpt-4-1": 1009 } }API Key authentication
To access these endpoints, you need to configure some api-key(s) to your installation in your
librechat.ymlfile like so:You will then add the
x-api-keyheader to your requests in order to be authorized to execute these actions.Change Type
Checklist
Please delete any irrelevant options.
@todo
If this pull request is accepted, I will make the documentation update accordingly.