spectyra-proxy
v1.0.1
Published
Local proxy for Spectyra optimization - works with Copilot, Cursor, Claude Code, and other coding assistants
Maintainers
Readme
Spectyra Proxy
Local proxy server that provides an OpenAI-compatible endpoint, routing requests through Spectyra for automatic optimization. Works with GitHub Copilot, Cursor, Claude Code, and other coding assistants.
Features
- ✅ OpenAI-compatible API - Works with any tool that uses OpenAI API
- ✅ Automatic optimization - Routes through Spectyra for 40-65% token savings
- ✅ Real-time dashboard - Web UI showing savings and stats
- ✅ Configuration management - Easy setup via web dashboard
- ✅ BYOK support - Use your own API keys
- ✅ Multi-provider support - OpenAI, Anthropic, Gemini, Grok
Installation
Install via npm (Recommended)
npm install -g spectyra-proxyThen start with:
spectyra-proxyNote: The npm package contains only compiled JavaScript, not source code. Your code remains private.
Option 2: Install from Source (Development)
If you need to modify the code or the npm package isn't available:
Quick Start
Start the proxy:
If installed via npm:
spectyra-proxyConfigure via dashboard:
- Open http://localhost:3002 in your browser
- Enter your Spectyra API key
- Enter your provider API key (OpenAI, Anthropic, etc.)
- Select provider and optimization settings
- Click "Save Configuration"
Configure your coding tool:
- Set
OPENAI_API_BASE=http://localhost:3001/v1 - Or configure in your tool's settings
- Set
Usage
With GitHub Copilot
- Set environment variable:
export OPENAI_API_BASE=http://localhost:3001/v1- Restart VS Code/Copilot
With Cursor
- Open Cursor Settings
- Set API base URL to:
http://localhost:3001/v1 - Restart Cursor
With Claude Code
- Configure Claude Code to use custom API endpoint
- Set endpoint to:
http://localhost:3001/v1
Dashboard
Access the dashboard at: http://localhost:3002
Features:
- Real-time savings statistics
- Recent request history
- Configuration management
- Live updates every 2 seconds
Configuration
Environment Variables
PROXY_PORT- Proxy server port (default: 3001)DASHBOARD_PORT- Dashboard port (default: 3002)SPECTYRA_API_URL- Spectyra API URL (default: https://spectyra.up.railway.app/v1)
Configuration File
Configuration is saved to .spectyra-proxy-config.json in the proxy directory.
Fields:
spectyraKey- Your Spectyra API keyproviderKey- Your provider API key (BYOK)provider- Provider name (openai, anthropic, gemini, grok)path- Optimization path (code, talk)optimizationLevel- Optimization level (0-4)
API Endpoints
Proxy Endpoint
POST /v1/chat/completions- OpenAI-compatible chat endpointPOST /v1/messages- Anthropic-compatible messages endpoint
Configuration
GET /config- Get current configuration (without keys)POST /config- Update configuration
Statistics
GET /stats- Get usage statistics and savings
Health Check
GET /health- Check proxy status
How It Works
Your Coding Tool (Copilot/Cursor/etc)
→ Local Proxy (localhost:3001)
→ Spectyra API (optimization)
→ Provider API (OpenAI/Anthropic)
→ Optimized Response
→ Your ToolBenefits:
- Transparent optimization
- No code changes needed
- Real-time savings tracking
- Works with any OpenAI-compatible tool
Troubleshooting
Proxy not starting
- Check if ports 3001 and 3002 are available
- Try different ports via environment variables
Configuration not saving
- Check file permissions in proxy directory
- Ensure
.spectyra-proxy-config.jsonis writable
Tool not connecting
- Verify proxy is running:
curl http://localhost:3001/health - Check tool's API base URL setting
- Ensure tool supports custom API endpoints
No savings showing
- Verify configuration is correct
- Check Spectyra API key is valid
- Check provider API key is valid
- Look at proxy console for errors
Development
# Watch mode (auto-restart on changes)
npm run dev
# Build for distribution
npm run buildLicense
MIT
