Docs npm Packages

npm Packages

Install and use Plexor Labs' npm packages for command-line AI chat, code analysis, and Claude MAX token synchronization directly from your terminal.

Available Packages

@plexor-dev/plexr v2.0.9

The primary Plexor Labs CLI tool. Chat with AI models through intelligent routing, analyze code files and directories, and sync Claude MAX OAuth tokens.

Installation

Install the plexr CLI globally using npm to access it from anywhere in your terminal.

Install globally
npm install -g @plexor-dev/plexr
Verify installation
plexr --version
# Output: plexr v2.0.9
Requirements
plexr requires Node.js 18.0.0 or higher. Check your version with node --version.

plexr CLI Reference

The plexr CLI provides several commands for interacting with Plexor Labs? Labs' AI gateway. Run plexr --help to see all available commands.

plexr --help
Usage: plexr [options] [command]

Options:
  -V, --version   output the version number
  -h, --help      display help for command

Commands:
  prompt          Send a prompt to Plexor Labs LLM gateway
  models          List available models
  usage           Show usage statistics
  sync            Sync Claude MAX token to Plexor Labs API
  status          Show current authentication status
  watch           Watch for token changes and sync automatically
  clear-cache     Clear stored credentials
  help [command]  display help for command

Quick Command Reference

Command Description
plexr prompt Interactive AI chat with intelligent routing
plexr models List all available AI models (Claude, GPT, DeepSeek, Gemini, Grok, Mistral)
plexr usage Display your API usage statistics and cost savings
plexr sync Sync Claude MAX OAuth token to Plexor Labs
plexr status Show current authentication and connection status
plexr watch Auto-sync tokens when they change
plexr clear-cache Clear stored credentials and cache

Prompt Command

The prompt command is the primary way to interact with AI models through Plexor Labs' intelligent routing gateway.

plexr prompt --help
Usage: plexr prompt [options] <text>

Send a prompt to Plexor Labs LLM gateway

Arguments:
  text                       The prompt message (required)

Options:
  -m, --model <model>        Model to use (e.g., claude-sonnet-4-20250514)
  -s, --stream               Stream the response
  -o, --optimize             Apply prompt optimization/compression
  --max-tokens <n>           Maximum tokens in response (default: 4096)
  -t, --temperature <n>      Temperature (0.0-1.0, default: 0.7)
  --system <prompt>          System prompt
  --json                     Output raw JSON response
  -f, --file <path>          Include file content in prompt for analysis
  -d, --dir <path>           Include directory contents (recursive, max 50 files)
  -h, --help                 display help for command

Basic Usage

Simple prompt
# Set your API key (one time)
export PLEXOR_API_KEY=plx_your_api_key

# Send a simple prompt
plexr prompt "What is the capital of France?"

# Output:
Model: deepseek-chat (DeepSeek) | Classification: FACTUAL
The capital of France is Paris.
With streaming
# Enable streaming for real-time output
plexr prompt --stream "Explain quantum computing in simple terms"
Specify model and mode
# Use a specific model
plexr prompt --model claude-sonnet-4-20250514 "Write a haiku about coding"

# Use prompt optimization for cost savings
plexr prompt --optimize "Explain the theory of relativity in detail"

# Add a system prompt for context
plexr prompt --system "You are a helpful coding assistant" "How do I sort an array in Python?"

Code Analysis

Use the --file and --dir options to include code in your prompts for code reviews, bug fixes, refactoring suggestions, and more.

Analyzing a Single File

File analysis
# Code review
plexr prompt --file ./src/utils.ts "Review this code for bugs and improvements"

# Find security issues
plexr prompt --file ./api/auth.py "Check for security vulnerabilities"

# Explain code
plexr prompt --file ./lib/parser.js "Explain what this code does"

# Suggest optimizations
plexr prompt --file ./services/db.go "How can I optimize this for performance?"

Analyzing a Directory

Directory analysis
# Analyze entire src directory
plexr prompt --dir ./src "Summarize the architecture of this codebase"

# Review a component folder
plexr prompt --dir ./components/auth "Review this authentication component"

# Find patterns
plexr prompt --dir ./tests "What testing patterns are used here?"
Directory Limits
When using --dir, files are read recursively up to a reasonable depth. Binary files, node_modules, and common build directories are automatically excluded. Very large directories may be truncated to fit within token limits.

Combining File and Prompt

Combined usage
# Use a powerful model for complex code review
plexr prompt --model claude-sonnet-4-20250514 --file ./core/engine.py \
  "This function is causing memory leaks. Help me find the issue."

# Stream code refactoring suggestions
plexr prompt --stream --file ./legacy/handler.js \
  "Refactor this to use modern async/await patterns"

Token Synchronization

If you have a Claude MAX subscription, you can sync your OAuth token to Plexor Labs to use your existing subscription through Plexor Labs' intelligent routing.

Token sync commands
# One-time sync of Claude MAX token
plexr sync

# Check current sync status
plexr status

# Watch for token changes and auto-sync
plexr watch

# Clear cached credentials
plexr clear-cache
Claude MAX Required
Token sync requires an active Claude MAX subscription. The sync command reads your local Claude credentials and securely stores them with Plexor Labs? Labs. Your credentials are encrypted and never shared with third parties.

Configuration

Configure plexr using environment variables or command-line options.

Environment Variables

Variable Description Default
PLEXOR_API_KEY Your Plexor Labs API key None (required)
PLEXOR_API_URL API endpoint URL https://api.plexor.dev
Shell configuration
# Add to ~/.bashrc or ~/.zshrc
export PLEXOR_API_KEY=plx_your_api_key_here

# Then reload your shell
source ~/.bashrc

Getting Your API Key

To get a Plexor Labs API key:

  1. Create an account at plexor.dev
  2. Go to the API Keys page in your dashboard
  3. Click "Create API Key" and copy the generated key
  4. Set it as PLEXOR_API_KEY environment variable
Free During Research Phase
Plexor Labs is currently free during the research phase. Create an account and get your API key to start using all features at no cost.

Next Steps