#user token
1 messages · Page 1 of 1 (latest)
This doc covers how to track and control your token usage for the OpenAI/Plugins endpoints in LibreChat. You will learn how to view your transactions, enable user balances, and add credits to your account.
@keen arch I am unable to add or edit token per user on the Railway server, can you tell me what to do exactly
Did you try these commands?
npm run add-balance
You can also specify the email and token credit amount to add, e.g.:
npm run add-balance [email protected] 1000
This works well to track your own usage for personal use; 1000 credits = $0.001 (1 mill USD)```
I need to know how to enter these commands on railway hosted version
@keen arch can you tell me how to enter these commands on a deployed version of Railway hosting?
Sorry, I'm not familiar with what railway is specifically. But in general, you would want to connect to the host that is running librechat and (if deployed via docker, connect to the docker container) and then run the npm commands
let me ask an AI for you 😄
To run custom commands like npm run add-balance on a deployed version of your application hosted on Railway, you usually need to access the server or container where your app is running. Railway, like other platform-as-a-service (PaaS) providers, simplifies deployment and management but might limit direct access to the underlying server for running such commands directly as you would on your local machine. However, there are several strategies you can employ to execute these commands within your Railway-hosted environment:
1. Use Railway's Web Console
Railway provides a web-based console for executing commands in the environment where your app is deployed. To use it:
- Go to the Railway dashboard and select your project.
- Find and click on the service where your application is running.
- Look for the "Console" tab or button in the dashboard to open a command-line interface.
- Type your command (e.g.,
npm run add-balance [email protected] 1000) and press Enter.
This method simulates running the command in a local terminal and is the easiest way to execute one-off commands.
@keen arch Thank you for your help, tried using AI as well but couldnt get it fixed, Railway is a hosting platform for github projects
You might need to install the "the Railway CLI" and access it from your computer
- Install the Railway CLI:
- If you haven't already, install the Railway CLI using one of the following methods:
- On macOS, use Homebrew:
brew install railway - For macOS, Linux, or Windows, use npm:
npm i -g @railway/cli - On Windows, consider using Windows Subsystem for Linux (WSL) with a Bash shell:
bash <(curl -fsSL cli.new)
- On macOS, use Homebrew:
- If you haven't already, install the Railway CLI using one of the following methods:
-
Authenticate with Railway:
- Open your terminal or command prompt.
- Run the following command to authenticate the CLI to your Railway account:
railway login - This will open a new tab in your default browser, where you can complete the authentication process.
- If you need to authenticate manually (e.g., in an environment without a browser), use the
--browserlessflag:
Follow the instructions to authenticate using a Pairing Code.railway login --browserless
-
Link Your Current Directory to a Project:
- Navigate to the directory where your Railway project is located.
- Run the following command to link your current directory to the project:
railway link
-
Find the Container ID or Name:
- Identify the Docker container you want to access. You'll need either the container ID or its name.
-
Access the Container Shell:
- Run the following command, replacing
<container_id_or_name>with the actual ID or name of your container:docker exec -it <container_id_or_name> /bin/bash- The
-itflag allows you to interact with the container. /bin/bashspecifies the shell you want to use (you can replace it with/bin/sh,/bin/zsh, etc., depending on the container's configuration).
- The
- Run the following command, replacing
-
You're In!:
- You should now be inside the container's shell, where you can run commands, explore files, and perform other tasks.
Remember that the container must be running for this to work. If the container is stopped, start it first using docker start <container_id_or_name> before executing the docker exec command. Happy container tinkering! 🐳🔍