JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 80
  • Score
    100M100P100Q104725F
  • License MIT

Setup tool for configuring Claude Code and Codex to use MegaLLM AI service

Package Exports

  • megallm
  • megallm/src/cli.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (megallm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

MegaLLM Setup Tool

🚀 Configure Claude Code & Codex for MegaLLM with One Command

NPM Version License Platform Support

Quick StartFeaturesHow It WorksDocumentationSupport


🎯 Quick Start

npx megallm@latest

That's it! The interactive CLI will guide you through the entire setup process.

✨ Features

🔍 Smart Detection

  • Auto-detects installed AI tools
  • Identifies your OS and shell
  • Checks existing configurations

🔧 Automated Setup

  • Interactive configuration wizard
  • API key creation guidance
  • Environment variable management

🔐 Secure & Safe

  • Automatic configuration backups
  • Secure API key storage
  • Project-level isolation support

🌍 Universal Support

  • Works on macOS, Linux, Windows
  • Supports bash, zsh, fish, PowerShell
  • System or project-level configs

📊 How It Works

🔄 Setup Process Flow

┌─────────────────┐
│  npx megallm    │
└────────┬────────┘
         ▼
┌─────────────────────────────────────┐
│     🔍 Environment Detection        │
├─────────────────────────────────────┤
│  • Operating System (Mac/Linux/Win) │
│  • Shell Type (bash/zsh/fish/PS)   │
│  • Installed Tools (Claude/Codex)   │
└────────┬────────────────────────────┘
         ▼
┌─────────────────────────────────────┐
│       🔑 API Key Setup              │
├─────────────────────────────────────┤
│  Have API Key?                      │
│    ├─ No  → Opens megallm.io       │
│    │        Shows instructions      │
│    │        Waits for key entry    │
│    └─ Yes → Enter API key          │
└────────┬────────────────────────────┘
         ▼
┌─────────────────────────────────────┐
│      ⚙️ Configuration Choice        │
├─────────────────────────────────────┤
│  Tool Selection:                    │
│    • Claude Code only               │
│    • Codex/Windsurf only           │
│    • Both tools                     │
│                                     │
│  Setup Level:                       │
│    • System (~/.claude, ~/.codex)   │
│    • Project (./.claude, ./.codex)  │
└────────┬────────────────────────────┘
         ▼
┌─────────────────────────────────────┐
│      📝 Apply Configuration         │
├─────────────────────────────────────┤
│  • Create/update config files       │
│  • Set environment variables        │
│  • Backup existing configs          │
│  • Reload shell if needed           │
└────────┬────────────────────────────┘
         ▼
┌─────────────────┐
│  ✅ Complete!   │
└─────────────────┘

📦 Installation Options

🚀 Quick Run (Recommended)
# Latest version
npx megallm@latest

# Specific version
npx megallm@1.0.0
💻 Global Installation
# Install globally
npm install -g megallm

# Run from anywhere
megallm
🪟 Windows PowerShell
# Clear cache if needed
npm cache clean --force

# Run with explicit version
npx megallm@latest

# Alternative: Use CMD
cmd /c "npx megallm"

🔧 Configuration Details

Configuration Levels

Level Claude Code Codex/Windsurf Scope
System ~/.claude/settings.json ~/.codex/config.toml All projects
Project ./.claude/settings.json ./.codex/config.toml Current project only

What Gets Configured

Claude Code (JSON) Codex/Windsurf (TOML)
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://ai.megallm.io",
    "ANTHROPIC_API_KEY": "your-key"
  },
  "customApiKeyResponses": {
    "approved": ["last-20-chars"]
  }
}
[api]
base_url = "https://ai.megallm.io"
api_key = "your-key"
provider = "custom"

[auth]
provider = "custom"
endpoint = "https://ai.megallm.io"

🚦 Setup Flow

Step 1: Get Your API Key

🔐 API Key Creation Process

┌──────────────────────────────────────────────────────┐
│                 User runs: npx megallm                │
└───────────────────────┬──────────────────────────────┘
                        ▼
┌──────────────────────────────────────────────────────┐
│           Tool asks: "Do you have an API key?"        │
└───────┬───────────────────────────────────┬──────────┘
        ▼                                   ▼
    [No Key]                            [Has Key]
        │                                   │
        ▼                                   ▼
┌──────────────────┐              ┌────────────────────┐
│ 🌐 Browser Opens │              │ 📝 Enter API Key   │
│   megallm.io     │              └─────────┬──────────┘
└────────┬─────────┘                        │
         ▼                                  │
┌──────────────────┐                        │
│ Create Account   │                        │
│ Generate API Key │                        │
└────────┬─────────┘                        │
         ▼                                  │
┌──────────────────┐                        │
│ Copy API Key     │                        │
└────────┬─────────┘                        │
         ▼                                  ▼
┌──────────────────────────────────────────────────────┐
│              ✅ API Key Validated & Saved            │
└──────────────────────────────────────────────────────┘

📋 Quick Steps:

  1. No API Key? → Tool opens megallm.io automatically
  2. Sign up → Create your account (free tier available)
  3. Generate → Click "Create New API Key"
  4. Copy → Copy your key to clipboard
  5. Paste → Return to terminal and paste your key
  6. Done → Tool validates and saves your configuration

Step 2: Choose Your Configuration

Question Options Result
Which tool? Claude Code / Codex / Both Configures selected tools
Setup level? System / Project Determines config location
Confirm? Yes / No Applies configuration

📋 Prerequisites

Before running the setup tool, ensure you have installed:

Claude Code

Download

Desktop AI coding assistant

Codex/Windsurf

Download

AI-powered code editor

🛠️ Advanced Usage

Environment Variables

# Enable debug output
DEBUG=* npx megallm

# Skip welcome banner
NO_BANNER=1 npx megallm

# Combine options
DEBUG=* NO_BANNER=1 npx megallm

Manual Configuration

If you prefer manual setup, edit these files directly:

Claude Code Configuration

Location: ~/.claude/settings.json

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://ai.megallm.io",
    "ANTHROPIC_API_KEY": "your-api-key-here"
  },
  "customApiKeyResponses": {
    "approved": ["last-20-chars-of-key"],
    "rejected": []
  }
}
Codex/Windsurf Configuration

Location: ~/.codex/config.toml

[api]
base_url = "https://ai.megallm.io"
api_key = "your-api-key-here"
provider = "custom"

[auth]
provider = "custom"
endpoint = "https://ai.megallm.io"
api_key = "your-api-key-here"

🐛 Troubleshooting

Tool Not Detected
  • Ensure Claude Code or Codex is installed
  • Check configuration directories exist:
    • Claude: ~/.claude/
    • Codex: ~/.codex/
  • Try restarting your terminal
Configuration Not Applied
  • Restart your terminal/shell
  • For project configs, verify you're in the right directory
  • Check file permissions: ls -la ~/.claude/ or ~/.codex/
API Key Issues
  • Verify key is valid at megallm.io
  • Check for extra spaces or characters
  • Ensure key has proper permissions
  • Try regenerating the key if needed

📚 Documentation

🤝 Contributing

We welcome contributions! Here's how to get started:

# Fork and clone
git clone https://github.com/yourusername/megallm-npm
cd megallm-npm

# Install dependencies
npm install

# Make changes and test
npm start

# Submit PR
git push origin feature/your-feature

💬 Support

Channel Link
📧 Email support@megallm.io
🐛 Issues GitHub Issues
💬 Discord Join Community
📚 Docs Documentation

📄 License

MIT License - see LICENSE file for details.


Built with ❤️ by the MegaLLM Team

⭐ Star us on GitHub