Skip to content

iamvaleriofantozzi/opencode-copilot-multi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

opencode-copilot-multi

npm version License: MIT Node.js Version

OpenCode plugin for seamless switching between multiple GitHub Copilot accounts in a single session.

✨ Features

  • πŸ”„ Multi-account support - Use 2+ GitHub Copilot accounts simultaneously
  • 🎯 Per-model labeling - Models appear as username:model-name
  • πŸ”’ Secure - OAuth tokens stored locally with 0600 permissions
  • ⚑ Non-blocking - Lazy loads, zero impact on OpenCode startup
  • πŸ”„ Auto token refresh - 5-minute buffer before expiry
  • πŸ“± Cross-platform - macOS, Linux, Windows

πŸ“‹ Supported Models

Claude: Opus/Sonnet/Haiku (all versions)
OpenAI: GPT-5, GPT-4o, o1, o3-mini
Google: Gemini 2.5 Pro, Gemini 3

15+ models total. New models auto-detected when you authenticate.

πŸ”§ Installation

Option 1: Global (Recommended)

npm install -g opencode-copilot-multi
# Restart OpenCode

Option 2: Via NPX

npx opencode-copilot-multi@latest add

Option 3: Manual

Edit ~/.config/opencode/opencode.json:

{
  "plugin": ["opencode-copilot-multi"]
}

🎯 Quick Start

  1. Add account

    opencode-copilot-multi add
    • Launches OpenCode auth
    • Select "GitHub Copilot"
    • Complete OAuth
  2. Restart OpenCode - models now appear

  3. Select model - e.g., john:claude-sonnet-4

  4. Add more accounts - Run add again

πŸ› οΈ CLI Commands

opencode-copilot-multi list              # Show all accounts
opencode-copilot-multi add               # Add GitHub Copilot account
opencode-copilot-multi remove <username> # Remove account
opencode-copilot-multi clear [--force]   # Remove all accounts
opencode-copilot-multi install           # Register plugin (auto-run)
opencode-copilot-multi --help            # Show help

βš™οΈ System Requirements

  • Node.js: β‰₯ 18.0.0
  • OpenCode: Latest version
  • GitHub Copilot: Active subscription

πŸ› Troubleshooting

No models appearing

  1. Run: opencode-copilot-multi list
  2. If empty, run: opencode-copilot-multi add
  3. Restart OpenCode
  4. Check logs: tail ~/.local/share/opencode/log/copilot-multi.log

Token refresh errors

Re-authenticate:

opencode-copilot-multi remove <username>
opencode-copilot-multi add

Plugin not loading

opencode-copilot-multi install
# Restart OpenCode

πŸ“š Documentation

πŸ—οΈ How It Works

When you select john:claude-sonnet-4:

  1. Parser extracts username + model
  2. Pool lookup finds account by username
  3. Token check refreshes if expiring
  4. API call routes to GitHub Copilot with account's token
  5. Response returned to OpenCode

See ARCHITECTURE.md for detailed flow diagrams.

πŸ” Security

  • Storage: ~/.local/share/opencode/copilot-multi-accounts.json (0600)
  • Tokens: OAuth only, no passwords
  • Refresh: Auto 5 minutes before expiry
  • No telemetry: Offline by design

See SECURITY.md for complete details.

πŸ§ͺ Development

npm install
npm run build           # Compile TypeScript
npm run watch          # Watch & rebuild
npm link               # Link globally for testing

Project structure:

src/
β”œβ”€β”€ index.ts            # Plugin entry
β”œβ”€β”€ provider.ts         # Custom fetch handler
β”œβ”€β”€ storage/            # Account pool & auth
β”œβ”€β”€ discovery/          # Account detection
β”œβ”€β”€ config/             # Config management
β”œβ”€β”€ commands/           # CLI commands
└── utils/              # Helpers

See CONTRIBUTING.md for development workflow.

πŸ“„ License

MIT Β© 2025 Valerio Fantozzi

🀝 Contributing

Contributions welcome! See CONTRIBUTING.md for:

  • Code style guidelines
  • Development setup
  • PR process
  • Areas for contribution

πŸ†˜ Support


Made with ❀️ by Valerio Fantozzi

About

No description, website, or topics provided.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors