Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

mahaoyang/cx-switch

Repository files navigation

CX Switch

A beautiful web UI for managing and switching Codex API provider configurations.

CX Switch Screenshot

Features

  • πŸͺŸ Windows/WSL Sync: Optional toggle keeps Windows and WSL configs in sync when switching
  • 🎨 Modern Interface: Beautiful, intuitive web UI with glass-morphism design
  • πŸ” Secure Storage: Keys stored safely in ~/.cx-switch/ (not affected by npm updates)
  • πŸ”‘ Key Masking: Sensitive information hidden by default with toggle visibility
  • 🌍 Multi-language: Support for English, δΈ­ζ–‡, and EspaΓ±ol
  • ⚑ Fast Switching: One-click switching between providers
  • πŸ“¦ Easy Management: Add, edit, and delete configurations effortlessly
  • πŸ”„ Export: Export to ~/.codex directory or clipboard
  • 🎯 Project Trust: Manage project-specific trust levels
  • πŸš€ Quick Start: Simple CLI command to launch

Installation

Global Installation (Recommended)

npm install -g cx-switch

Run Directly with npx

npx cx-switch

Local Development

git clone https://github.com/mahaoyang/cx-switch.git
cd cx-switch
npm install
npm run dev

Usage

After installation, simply run:

cx-switch
# or use the shorter command
cx

This will:

  1. Start the local server on port 3000
  2. Automatically open your browser
  3. You can start managing your Codex configurations!

Adding a Provider

  1. Click "Add New" button
  2. Fill in your API details:
    • API Base URL: e.g., https://api.openai.com/v1
    • API Key: Your OpenAI API key (sk-...)
    • Model: e.g., gpt-5.1-codex-max, claude-3-opus
    • Reasoning Effort: low, medium, high, or xhigh (optional)
  3. Configure advanced options (optional):
    • Custom provider settings
    • Additional auth fields
    • Project trust levels
  4. Click "Save"

Switching Providers

  1. Select a provider from the left sidebar
  2. Click "Switch to this provider" button
  3. The active provider will be marked with "Current"

Switching automatically writes auth.json and config.toml into your ~/.codex directory under the current user. When running on Windows or inside WSL, a tooltip-enabled toggle appears next to the button so you can also sync the other side (Windows ↔ WSL) in one go.

Exporting Configuration

Go to the "Export Configuration" tab and choose:

  1. Export to ~/.codex directory: Directly writes files to your Codex directory
  2. Copy auth.json: Copies auth.json content to clipboard
  3. Copy config.toml: Copies config.toml content to clipboard

Data Storage

Your configurations are stored in ~/.cx-switch/:

~/.cx-switch/
β”œβ”€β”€ providers.json # Your provider configurations
β”œβ”€β”€ active-provider.json # Currently active provider
└── global-config.json # Global settings

Important Notes:

  • βœ… This directory is separate from the npm package
  • βœ… Your data is safe during npm updates
  • βœ… API keys stored locally, never sent to any server
  • πŸ“¦ You can backup this directory to preserve your configurations

Configuration Examples

auth.json

{
 "OPENAI_API_KEY": "sk-your-api-key-here"
}

config.toml

model = "gpt-5.1-codex-max"
model_reasoning_effort = "xhigh"
# Custom provider configuration
model_provider = "azure"
[model_providers.azure]
base_url = "https://your-resource.openai.azure.com/v1"
wire_api = "responses"
requires_openai_auth = true
# Project trust levels
[projects."/home/user/workspace/my-project"]
trust_level = "trusted"

Tech Stack

  • Vue 3: Progressive JavaScript framework
  • Vite: Next generation frontend tooling
  • Tailwind CSS 4: Utility-first CSS framework
  • Lucide Icons: Beautiful icon set
  • vue-i18n: Internationalization

Development

# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Run CLI locally
npm start

Browser Support

  • Modern browsers (Chrome, Firefox, Safari, Edge)
  • File System Access API support (for directory export)
  • Clipboard API support (for copy functions)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

Author

hy

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /