Docs Claude Code

Claude Code Integration

Use Plexor as an intelligent proxy for Claude Code CLI to get automatic cost optimization, smart provider routing, and detailed usage analytics for all your AI-assisted development work.

What is Claude Code + Plexor?

Claude Code is Anthropic's official command-line interface for AI-assisted software development. It provides a powerful terminal-based experience for code generation, debugging, refactoring, and more.

Plexor is an intelligent LLM routing proxy that sits between Claude Code and various AI providers. When you route Claude Code through Plexor, your requests are automatically analyzed and sent to the most cost-effective provider capable of handling them, without sacrificing quality for complex tasks.

Key Benefits

  • Cost Savings - Save 60-80% on typical Claude Code usage by routing simple queries to cheaper models
  • Quality Preservation - Complex reasoning, multi-file edits, and architecture decisions still go to Claude
  • Seamless Integration - Works transparently with your existing Claude Code workflow
  • Real-time Analytics - Track your savings and usage patterns in real-time
  • Provider Flexibility - Access to multiple providers (Claude, DeepSeek, OpenAI, Mistral, Gemini) through one interface
Typical Savings
60-80%
Average cost reduction for Claude Code users in balanced mode

Installation and Setup

Setting up Plexor with Claude Code takes just a few minutes. The Plexor skill is built into Claude Code and provides slash commands for authentication and configuration.

Create a Plexor Account

Visit plexor.dev and create a free account. During the research phase, all features are completely free with no credit card required.

Get Your API Key

Log in to your Plexor dashboard and navigate to the API Keys section. Click "Create API Key" to generate a new key. Copy it to your clipboard - you'll need it in the next step.

Authenticate in Claude Code

Open Claude Code in your terminal and run the /plexor-login command. When prompted, paste your API key. This configures Plexor as your API proxy.

Verify Connection

Run /plexor-status to verify your connection is active. You should see your account information and current routing mode displayed.

Quick Setup Example
# In Claude Code terminal
/plexor-login
# Enter your API key when prompted: plx_xxxxxxxxxxxxxxxx

# Verify connection
/plexor-status

# Optionally set your preferred mode
/plexor-mode balanced
Pro Tip
Your Plexor configuration is stored locally and persists across Claude Code sessions. You only need to run /plexor-login once unless you want to change accounts.

Slash Commands Reference

Plexor adds the following slash commands to Claude Code for authentication, configuration, and monitoring. All commands are prefixed with /plexor- for easy discovery.

Authentication Commands

/plexor-login

Authenticate with Plexor using your API key. This command prompts you to enter your API key and configures Claude Code to route all requests through the Plexor proxy. Your credentials are stored securely in your local Claude Code configuration.

/plexor-login
What happens: You'll be prompted to enter your API key. After successful authentication, all Claude Code requests will automatically route through Plexor for intelligent optimization.
/plexor-logout

Log out from Plexor and clear your stored credentials. After logging out, Claude Code will send requests directly to Anthropic's API (requires a valid Anthropic API key).

/plexor-logout
Note: This removes all Plexor configuration from your local Claude Code settings. You can re-authenticate at any time with /plexor-login.

Monitoring Commands

/plexor-status

Display your current Plexor optimization statistics and session information. Shows total requests, tokens used, cost savings, provider breakdown, and current configuration settings.

/plexor-status
Output includes:
  • Connection status and account info
  • Current routing mode and provider settings
  • Session statistics (requests, tokens, cost)
  • Savings vs. direct Anthropic API usage
  • Provider usage breakdown

Configuration Commands

/plexor-mode

Set your preferred routing mode to control the balance between cost savings and response quality. The mode determines how aggressively Plexor routes requests to cheaper providers.

/plexor-mode <eco|balanced|quality|passthrough>
Available modes:
  • eco - Maximum cost savings. Routes most requests to cheapest capable providers.
  • balanced - Default. Balances cost and quality for general development work.
  • quality - Prioritizes response quality. Uses premium models more frequently.
  • passthrough - No optimization. Routes directly to requested model (Claude).
/plexor-provider

Force all requests to use a specific LLM provider, bypassing intelligent routing. Useful for testing, benchmarking, or when you have specific provider requirements.

/plexor-provider <claude|openai|deepseek|mistral|gemini|auto>
Available providers:
  • auto - Default. Use intelligent routing to select the best provider.
  • claude - Force all requests to Anthropic Claude models.
  • openai - Force all requests to OpenAI GPT models.
  • deepseek - Force all requests to DeepSeek models.
  • mistral - Force all requests to Mistral AI models.
  • gemini - Force all requests to Google Gemini models.
/plexor-enabled

Enable or disable the Plexor proxy. When disabled, requests go directly to Anthropic's API. Useful for quick A/B testing or temporarily bypassing Plexor without logging out.

/plexor-enabled <true|false>
Usage:
  • true - Enable Plexor proxy (all traffic routes through Plexor)
  • false - Disable Plexor proxy (traffic goes directly to Anthropic)
/plexor-settings

Open the interactive settings configuration menu. Allows you to configure advanced options including custom API URL, mode preferences, and provider settings in one place.

/plexor-settings
Configurable options:
  • API URL (default: https://api.plexor.dev)
  • Default routing mode
  • Default provider preference
  • Proxy enabled/disabled state

Quick Reference

All Commands
# Authentication
/plexor-login              # Authenticate with your API key
/plexor-logout             # Log out and clear credentials

# Monitoring
/plexor-status             # Show stats, savings, and config

# Routing Mode
/plexor-mode eco           # Maximum cost savings
/plexor-mode balanced      # Balance cost and quality (default)
/plexor-mode quality       # Prioritize response quality
/plexor-mode passthrough   # Direct to Claude, no routing

# Provider Override
/plexor-provider auto      # Intelligent routing (default)
/plexor-provider claude    # Force Anthropic Claude
/plexor-provider deepseek  # Force DeepSeek
/plexor-provider openai    # Force OpenAI GPT
/plexor-provider mistral   # Force Mistral AI
/plexor-provider gemini    # Force Google Gemini

# Enable/Disable
/plexor-enabled true       # Enable Plexor proxy
/plexor-enabled false      # Bypass Plexor, direct to Anthropic

# Settings
/plexor-settings           # Open settings menu

How Proxy Routing Works

When you use Claude Code with Plexor enabled, every request passes through Plexor's intelligent routing engine before reaching an LLM provider. Here's how the routing decision is made:

Request Analysis

Each request is analyzed in real-time to determine its complexity and requirements. The analysis considers:

  • Query complexity - Simple questions vs. complex reasoning tasks
  • Code context - Single file operations vs. multi-file architectural changes
  • Token requirements - Short responses vs. lengthy code generation
  • Historical patterns - Your usage patterns and preferences
  • Current mode - Your selected routing mode (eco, balanced, quality)

Routing Decision Matrix

Request Type Eco Mode Balanced Mode Quality Mode
Simple questions, formatting DeepSeek / Mistral DeepSeek / Mistral Claude Haiku
Basic code generation DeepSeek DeepSeek / Claude Haiku Claude Sonnet
Code review, debugging DeepSeek Claude Sonnet Claude Sonnet
Complex reasoning, architecture Claude Sonnet Claude Sonnet / Opus Claude Opus
Multi-file refactoring Claude Sonnet Claude Opus Claude Opus

Response Handling

Regardless of which provider handles your request, responses are returned in a consistent format compatible with the Anthropic Messages API. Plexor adds metadata to each response showing:

  • Which provider actually handled the request
  • The specific model used
  • Actual cost for this request
  • Latency information
  • The routing mode that was active
Transparent Routing
The routing process is completely transparent to your workflow. Claude Code continues to work exactly as before - you simply get lower costs and access to multiple providers automatically.

Cost Savings and Examples

Real-world savings depend on your usage patterns. Here are typical examples showing cost differences between direct Anthropic API usage and Plexor-routed requests.

Example: Typical Development Session

A 4-hour development session with Claude Code might include:

Sample Session Breakdown
# Request distribution in a typical session:
Simple questions, explanations:        40%  -> Routed to DeepSeek
Basic code generation:                 25%  -> Routed to DeepSeek
Code review, debugging:                20%  -> Routed to Claude Sonnet
Complex reasoning, architecture:       15%  -> Routed to Claude Opus

# Cost comparison (estimated):
Direct Anthropic API:                  $12.50
Plexor (balanced mode):                $3.75
Savings:                               $8.75 (70%)

Savings by Mode

Mode Typical Savings Best For
eco 70-85% Learning, exploration, prototyping, simple tasks
balanced 60-75% General development, most production work
quality 30-50% Critical code, complex architecture, sensitive work
passthrough 0% Benchmarking, when you specifically need Claude

Tracking Your Savings

Use /plexor-status regularly to monitor your actual savings. The command shows:

Example /plexor-status Output
Plexor Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Connection:     Connected
Account:        warren@example.com
Mode:           balanced
Provider:       auto
Proxy:          enabled

Session Statistics
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Requests:       127
Input tokens:   245,832
Output tokens:  89,421

Cost Analysis
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Actual cost:    $2.34
Anthropic cost: $8.91
Savings:        $6.57 (74%)

Provider Breakdown
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
DeepSeek:       68 requests (54%)
Claude Sonnet:  42 requests (33%)
Claude Opus:    17 requests (13%)
Real Savings Example
One development team using Claude Code for 8 hours daily reduced their monthly LLM costs from $1,200 to $320 using Plexor in balanced mode - a 73% reduction with no perceived quality difference in their workflow.

Troubleshooting

Common issues and solutions when using Plexor with Claude Code.

Authentication Issues

API Key Not Accepted

If your API key is rejected during /plexor-login:

  • Verify you're using a Plexor API key (starts with plx_), not an Anthropic key
  • Check the key hasn't been revoked in your API Keys dashboard
  • Ensure you copied the complete key without extra spaces
  • Try generating a new API key if the issue persists

Connection Timeouts

If you're experiencing connection issues:

  • Check your internet connection
  • Verify that api.plexor.dev is accessible from your network
  • Check if a corporate firewall might be blocking the connection
  • Try using /plexor-settings to verify the API URL is correct

Routing Issues

Requests Not Being Optimized

If all requests seem to go to Claude:

  • Run /plexor-status to verify proxy is enabled
  • Check your mode isn't set to passthrough
  • Verify provider isn't forced to claude
Reset to Default Settings
# Reset to balanced mode with auto routing
/plexor-mode balanced
/plexor-provider auto
/plexor-enabled true

Quality Concerns

If you notice reduced quality in responses:

  • Switch from eco to balanced mode
  • For critical work, use quality or passthrough mode
  • Force a specific provider with /plexor-provider claude for important tasks

Performance Issues

Increased Latency

Plexor adds minimal latency (typically <100ms) for routing decisions. If you notice significant delays:

  • Check your network connection to api.plexor.dev
  • The selected provider might be experiencing issues - try a different provider
  • Use /plexor-status to see latency statistics

Getting Help

If you continue to experience issues:

  • Check the Dashboard for service status
  • Review your usage logs for error details
  • Contact support through the dashboard with your session ID
Sensitive Work
For sensitive code or critical reasoning tasks where quality is paramount, use /plexor-mode quality or /plexor-mode passthrough to ensure Claude handles the request directly.

Next Steps