Environment setup
Set your API key and prepare Python, Node.js, PowerShell, VS Code, or WSL before connecting a tool.
On this page
Use these instructions wherever a guide asks for a RouterPlex key. Create a dedicated key in guided setup or API Keys. Keep it on your own machine or server.
macOS and Linux #
Open Terminal using Bash or Zsh. Set the variable in the terminal that will launch your app:
export ROUTERPLEX_API_KEY="YOUR_ROUTERPLEX_API_KEY"
Replace the placeholder with your key. Check that it is set without printing the value:
if [ -n "$ROUTERPLEX_API_KEY" ]; then echo "Key is set"; else echo "Key is missing"; fi
The variable lasts for this terminal session. Set it again when you open a new terminal. Shell startup files differ: Zsh uses ~/.zshrc; interactive Bash uses ~/.bashrc. Do not assume a macOS Dock app or Linux desktop launcher reads either file.
Windows PowerShell #
Open PowerShell, not Command Prompt, and run:
$env:ROUTERPLEX_API_KEY = 'YOUR_ROUTERPLEX_API_KEY'if ($env:ROUTERPLEX_API_KEY) { 'Key is set' } else { 'Key is missing' }
This sets the variable for the current session. To make it available to future processes for your user account, optionally run:
[Environment]::SetEnvironmentVariable('ROUTERPLEX_API_KEY', $env:ROUTERPLEX_API_KEY, 'User')
Fully close and reopen the app after changing a persistent variable. setx also only affects future processes. If PowerShell blocks npm.ps1, use npm.cmd; for npm-installed CLIs, their .cmd launchers avoid the same script-policy issue.
VS Code, WSL, SSH, and containers #
For a VS Code extension that reads environment variables, fully quit all VS Code windows, set the key in a terminal, and launch code . from that terminal. On macOS, use Shell Command: Install 'code' command in PATH if needed.
Set the key where the extension or CLI actually runs. A WSL, SSH, or Dev Container session has its own environment and home directory. Windows variables and config files do not automatically configure the Linux process inside WSL. Use the Linux instructions inside that environment.
When a tool has an API key input, prefer that input and its credential store. Never put a real key in a browser app, committed config, screenshot, or support message.
Python and Node.js projects #
Use Python 3.12+ for the Python examples and a currently supported Node.js LTS release for JavaScript examples. Create a Python virtual environment to avoid package-manager and permission conflicts.
macOS/Linux:
python3 -m venv .venv.venv/bin/python -m pip install --upgrade pip
Windows PowerShell:
py -3 -m venv .venv.\.venv\Scripts\python.exe -m pip install --upgrade pip
The guides call the environment's Python directly, so PowerShell script activation is unnecessary. Save Node examples as .mjs files to use import and top-level await without changing your package configuration.