### Quick Start Commands Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Basic commands to add accounts, check the status of your authentication, and start the web dashboard for managing your setup. ```bash # Add accounts opencode-multi-auth add personal opencode-multi-auth add work # Check status opencode-multi-auth status # Start dashboard opencode-multi-auth web --host 127.0.0.1 --port 3434 ``` -------------------------------- ### One-time Setup for Sandbox Environment Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/SANDBOX_QUICK_REF.md Initializes the sandbox environment by cloning the repository and installing dependencies. Ensure the target directory is empty or clone to a temporary location first. ```bash cd /Users/jorgitin/Documents/projects/open_multi_auth git clone https://github.com/guard22/opencode-multi-auth-codex.git . npm ci npm run build ``` -------------------------------- ### Project Setup and Build Commands Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/TEST_EXECUTION_PLAN.md Install dependencies, lint the code, build the project, and perform a TypeScript type check without emitting JavaScript. These are foundational commands for development and testing. ```bash npm ci npm run lint npm run build npx tsc --noEmit ``` -------------------------------- ### Install from Source Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Clone the repository, install dependencies, and build the project from source. This is useful for development or contributing. ```bash git clone https://github.com/guard22/opencode-multi-auth-codex.git cd opencode-multi-auth-codex npm ci npm run build ``` -------------------------------- ### Install Plugin via npm Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Use this command to install the plugin globally from npm. This is the recommended installation method. ```bash opencode plugin @guard22/opencode-multi-auth-codex@latest --global ``` -------------------------------- ### Copy Credentials Example Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Copy the example credentials file to create your own configuration. This file will store your account details for the automated login process. ```bash cp auto-login/credentials.example.json auto-login/credentials.json ``` -------------------------------- ### Install Plugin from GitHub Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Install the plugin directly from the GitHub repository head. Use this if you need the latest development version. ```bash opencode plugin github:guard22/opencode-multi-auth-codex --global ``` -------------------------------- ### Install Oh My OpenCode Plugin Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/OPENCODE_SETUP_1TO1.md Installs the Oh My OpenCode plugin using bun. Ensure you are in the correct directory. ```bash bun add oh-my-opencode@3.1.6 --cwd ~/.config/opencode ``` -------------------------------- ### Start OpenCode Web Dashboard Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/OPENCODE_SETUP_1TO1.md Use this command to start the local web dashboard for managing accounts and tokens. Access the dashboard via the provided URL. ```bash node ~/.config/opencode/node_modules/@guard22/opencode-multi-auth-codex/dist/cli.js web --host 127.0.0.1 --port 3434 ``` -------------------------------- ### Install Antigravity Auth Plugin Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/OPENCODE_SETUP_1TO1.md Installs the Antigravity Auth plugin using bun. Ensure you are in the correct directory. ```bash bun add opencode-antigravity-auth@1.4.5 --cwd ~/.config/opencode ``` -------------------------------- ### Install Specific Plugin Version Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Configuration snippet for users to install a specific version of the plugin. ```json { "plugin": ["npm:@guard22/opencode-multi-auth-codex@1.2.1"] } ``` -------------------------------- ### Build and Test Commands Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Standard commands for installing dependencies, linting, building, and running various types of tests. ```bash npm ci npm run lint npm run build npx tsc --noEmit npm run test:unit npm run test:integration npm run test:web:headless npm run test:failure npm run test:stress npm run test:sandbox npm run test:soak:48h ``` -------------------------------- ### Install OpenCode Multi-Auth Plugin (v1.0.9) Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/OPENCODE_SETUP_1TO1.md Add the multi-account ChatGPT OAuth rotation plugin for OpenCode using Bun. This command installs a specific version from GitHub. ```bash bun add github:guard22/opencode-multi-auth-codex#v1.0.9 --cwd ~/.config/opencode ``` -------------------------------- ### Configure GitHub Install via JSON Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Configure the GitHub installation using a JSON file. This allows for declarative configuration of the GitHub source. ```json { "plugin": ["github:guard22/opencode-multi-auth-codex"] } ``` -------------------------------- ### Install Playwright and Browsers Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Install the Playwright library for Python and download the necessary browser binaries. This is a prerequisite for running the automated login script. ```bash pip install playwright playwright install chromium ``` -------------------------------- ### Install OpenCode Multi-Auth Plugin (main branch) Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/OPENCODE_SETUP_1TO1.md Add the multi-account ChatGPT OAuth rotation plugin for OpenCode using Bun. This command tracks the main branch, which is not recommended for beginners. ```bash bun add github:guard22/opencode-multi-auth-codex --cwd ~/.config/opencode ``` -------------------------------- ### Run Sandbox Dashboard Locally Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/SANDBOX_QUICK_REF.md Starts the sandbox dashboard on a local host and port. Access it via the provided URL. ```bash node dist/cli.js web --host 127.0.0.1 --port 4343 ``` -------------------------------- ### Get Settings Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Retrieves the current system settings, including rotation strategy and thresholds. ```APIDOC ## GET /api/settings ### Description Retrieves the current configuration settings for account rotation and thresholds. ### Method GET ### Endpoint /api/settings ### Response #### Success Response (200) - **rotationStrategy** (string) - The current rotation strategy (e.g., "weighted-round-robin"). - **criticalThreshold** (integer) - The critical threshold value. - **lowThreshold** (integer) - The low threshold value. - **accountWeights** (object) - An object mapping account aliases to their assigned weights. ``` -------------------------------- ### Check Node.js and Bun Versions Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/OPENCODE_SETUP_1TO1.md Verify that Node.js and Bun are installed and accessible in your environment. These are prerequisites for OpenCode tooling. ```bash node -v bun -v ls /Applications/OpenCode.app/Contents/MacOS/opencode-cli ``` -------------------------------- ### Start Codex Dashboard on Loopback Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Starts the Codex dashboard web server, binding it to the loopback interface on a specified port. Ensure the UI renders correctly and the state endpoint is accessible. ```bash node dist/cli.js web --host 127.0.0.1 --port 3434 ``` -------------------------------- ### Get System Settings Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Retrieve the current system settings using the API. This is a read-only operation. ```bash curl -s http://127.0.0.1:3434/api/settings ``` -------------------------------- ### Troubleshoot Port Conflicts Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/SANDBOX_QUICK_REF.md If the dashboard fails to start due to a port being in use, restart it on a different port. ```bash node dist/cli.js web --host 127.0.0.1 --port 4344 ``` -------------------------------- ### Test Non-Loopback Bind Block Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Attempt to start the dashboard binding to all interfaces (0.0.0.0). This should fail with a LOCALHOST_ONLY error, indicating safety measures are in place. ```bash node dist/cli.js web --host 0.0.0.0 --port 3434 ``` -------------------------------- ### Generate Post Draft for Benchmark Results Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/docs/reddit-benchmark-report.html Creates a draft for a blog post or report summarizing benchmark findings. It includes setup details, caveats, and median results for different GPT models. The output is intended for a textarea with the ID 'postDraft'. ```javascript function makePostDraft() { const draft = [ "I benchmarked GPT-5.4, GPT-5.4 Fast, GPT-5.5, and GPT-5.5 Fast in OpenCode.", "", "Setup: OpenCode 1.4.7, opencode-multi-auth-codex 1.4.1, 5 round-robin runs per mode, same prompt, JSON event timing.", "", "Important caveat: direct openai/gpt-5.5 selection is still rejected by this OpenCode build, so GPT-5.5 was tested through backend mapping. I verified the debug logs: regular 5.5 maps gpt-5.4 -> gpt-5.5, and 5.5 Fast maps gpt-5.4 -> gpt-5.5 with service_tier=priority.", "", "Median results:", "- GPT-5.4: 32.62s wall, 15.60s TTFT, 23.62 gen TPS, 6.22 e2e TPS", "- GPT-5.4 Fast: 26.96s wall, 4.46s TTFT, 22.44 gen TPS, 8.24 e2e TPS", "- GPT-5.5: 18.92s wall, 3.90s TTFT, 90.99 gen TPS, 10.68 e2e TPS", "- GPT-5.5 Fast: 18.21s wall, 4.53s TTFT, 99.19 gen TPS, 11.47 e2e TPS", "", "Takeaway: GPT-5.5 is a clear speed upgrade in this sample. GPT-5.5 Fast wins end-to-end throughput; regular GPT-5.5 had the best median TTFT." ].join("\\n"); document.getElementById("postDraft").value = draft; } ``` -------------------------------- ### Build and Lint Project Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Run these commands to ensure the project code is clean and built successfully before proceeding with live testing. ```bash npm run lint npm run build ``` -------------------------------- ### Add Test Accounts Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Use the CLI to add new test accounts to the system. Ensure you have the CLI tool available. ```bash node dist/cli.js add test1 node dist/cli.js add test2 ``` -------------------------------- ### Get Force Mode Status Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Retrieves the current force mode status. ```APIDOC ## GET /api/force ### Description Retrieves the current status of the force mode, indicating if it is active and for which accounts. ### Method GET ### Endpoint /api/force ### Response #### Success Response (200) - **forceModeEnabled** (boolean) - Indicates if force mode is globally enabled. - **forcedAccounts** (object) - A map of account aliases to their force mode status and TTL. ``` -------------------------------- ### Prepare and Publish Release Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Commands to update the package version, rebuild, publish to npm, and create a git release. ```bash npm version 1.2.1 --no-git-tag-version npm install npm run build npm publish --access public ``` -------------------------------- ### Configure Isolated Sandbox Environment Variables Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/SANDBOX_QUICK_REF.md Sets up environment variables for an isolated sandbox, including HOME directory, store directory, and auth file path. Creates necessary directories. ```bash export HOME=/tmp/oma-sandbox-home export OPENCODE_MULTI_AUTH_STORE_DIR=/tmp/oma-sandbox-store export OPENCODE_MULTI_AUTH_CODEX_AUTH_FILE=/tmp/oma-sandbox-home/.codex/auth.json mkdir -p "$HOME/.codex" "$OPENCODE_MULTI_AUTH_STORE_DIR" ``` -------------------------------- ### Opencode Multi-Auth Codex Environment Variables Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/docs/PHASE_H_VALIDATION.md Configure store directory and file, auth file path, probe effort and models, rotation strategy and thresholds, and feature flags. ```bash # Store configuration OPENCODE_MULTI_AUTH_STORE_DIR=/path/to/store OPENCODE_MULTI_AUTH_STORE_FILE=/path/to/accounts.json # Auth configuration OPENCODE_MULTI_AUTH_CODEX_AUTH_FILE=/path/to/auth.json # Probe configuration OPENCODE_MULTI_AUTH_PROBE_EFFORT=low OPENCODE_MULTI_AUTH_LIMITS_PROBE_MODELS=gpt-5.3-codex,gpt-5.2-codex # Rotation configuration OPENCODE_MULTI_AUTH_ROTATION_STRATEGY=round-robin OPENCODE_MULTI_AUTH_CRITICAL_THRESHOLD=10 OPENCODE_MULTI_AUTH_LOW_THRESHOLD=30 # Feature flags OPENCODE_MULTI_AUTH_ANTIGRAVITY_ENABLED=false ``` -------------------------------- ### Run Unit Tests Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/TEST_EXECUTION_PLAN.md Execute the unit test suite for the project. This command is essential for verifying individual components. ```bash npm run test:unit ``` -------------------------------- ### OpenCode Configuration Baseline Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/OPENCODE_SETUP_1TO1.md This JSON configuration file sets up OpenCode with specified plugins, permissions, model providers, and MCP settings. Remember to replace placeholders like API keys and usernames. ```json { "$schema": "https://opencode.ai/config.json", "plugin": [ "oh-my-opencode@3.1.6", "opencode-antigravity-auth@1.4.5", "file:///Users/YOUR_USER/.config/opencode/node_modules/@guard22/opencode-multi-auth-codex/dist/index.js" ], "permission": { "delegate_task": "allow", "task": { "*": "allow" }, "skill": { "*": "allow" } }, "compaction": { "auto": true, "prune": true }, "model": "google/antigravity-gemini-3-pro-high", "provider": { "openai": { "options": { "reasoningEffort": "medium", "reasoningSummary": "auto", "textVerbosity": "medium", "include": ["reasoning.encrypted_content"], "store": false }, "models": { "gpt-5.2": { "name": "GPT-5.2", "limit": { "context": 272000, "output": 128000 }, "modalities": { "input": ["text", "image"], "output": ["text"] } }, "gpt-5.2-codex-medium": { "name": "GPT 5.2 Codex Medium (OAuth)", "limit": { "context": 400000, "output": 128000 }, "modalities": { "input": ["text", "image"], "output": ["text"] }, "options": { "reasoningEffort": "medium", "reasoningSummary": "auto", "textVerbosity": "medium", "include": ["reasoning.encrypted_content"], "store": false } }, "gpt-5.2-codex-high": { "name": "GPT 5.2 Codex High (OAuth)", "limit": { "context": 400000, "output": 128000 }, "modalities": { "input": ["text", "image"], "output": ["text"] }, "options": { "reasoningEffort": "high", "reasoningSummary": "detailed", "textVerbosity": "medium", "include": ["reasoning.encrypted_content"], "store": false } } } }, "google": { "models": { "antigravity-gemini-3-pro-high": { "name": "Gemini 3 Pro High (Antigravity)", "limit": { "context": 250000, "output": 65535 }, "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] } }, "gemini-3-flash": { "name": "Gemini 3 Flash (Antigravity)", "limit": { "context": 250000, "output": 65536 }, "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] } }, "claude-opus-4-5-thinking-high": { "name": "Claude Opus 4.5 Thinking High (Antigravity)", "limit": { "context": 200000, "output": 64000 }, "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] } } } } }, "mcp": { "chrome-devtools": { "type": "local", "command": ["npx", "-y", "chrome-devtools-mcp@latest", "--channel", "stable"], "enabled": true }, "firecrawl-mcp": { "type": "local", "command": ["npx", "-y", "firecrawl-mcp"], "environment": { "FIRECRAWL_API_KEY": "PASTE_FIRECRAWL_API_KEY_HERE" }, "enabled": true } } } ``` -------------------------------- ### Apply Settings Preset Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Apply a predefined 'balanced' preset to the system settings. This is a POST request to a specific endpoint. ```bash curl -i -X POST http://127.0.0.1:3434/api/settings/preset -H 'Content-Type: application/json' --data '{"preset":"balanced"}' ``` -------------------------------- ### Run Local Verification Commands Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/docs/ADMIN_MERGE_BRIEF.md Execute linting, unit tests, and build processes locally. These commands are essential for verifying the integrity and functionality of the project before deployment. ```bash npm run lint npm run test:unit npm run build ``` -------------------------------- ### Run Integration and Web Headless Tests Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/TEST_EXECUTION_PLAN.md Execute integration and web headless tests. These commands are part of the broader test suite for the project. ```bash npm run test:integration npm run test:web:headless ``` -------------------------------- ### Debug Plugin Loading in OpenCode CLI Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/OPENCODE_SETUP_1TO1.md Execute this command to print logs and verify that OpenCode plugins, including the multi-auth codex, are loading correctly. ```bash /Applications/OpenCode.app/Contents/MacOS/opencode-cli debug config --print-logs ``` -------------------------------- ### CLI Commands Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md A list of available CLI commands for managing accounts and services. ```APIDOC ## CLI Commands - `opencode-multi-auth add ` -> add account via OAuth - `opencode-multi-auth remove ` -> remove account - `opencode-multi-auth list` -> list configured accounts - `opencode-multi-auth status` -> full status - `opencode-multi-auth path` -> print store path - `opencode-multi-auth web --host 127.0.0.1 --port 3434` -> run dashboard - `opencode-multi-auth service install|disable|status` -> systemd user service helpers ``` -------------------------------- ### Generate Benchmark Metrics Table Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/docs/reddit-benchmark-report.html Populates an HTML table with detailed benchmark metrics for each model. It highlights the 'gpt-5.5-fast' row and formats metric values using the 'fmt' function. Assumes 'data' is globally available. ```javascript function makeTable() { const root = document.getElementById("metricsTable"); root.innerHTML = data.map((row) => ` ${row.name}${row.id === "gpt-5.5-fast" ? ' top e2e' : ""} ${row.route} ${fmt(row.wallAvg)}s / ${fmt(row.wallMed)}s ${fmt(row.ttftAvg)}s / ${fmt(row.ttftMed)}s ${fmt(row.genAvg)} / ${fmt(row.genMed)} ${fmt(row.e2eAvg)} / ${fmt(row.e2eMed)} ${fmt(row.outputAvg, 1)} / ${fmt(row.outputMed, 0)} ${fmt(row.closeAvg, 1)}ms / ${fmt(row.closeMed, 0)}ms `).join(""); } ``` -------------------------------- ### Perform Fast Safety Checks in Sandbox Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/SANDBOX_QUICK_REF.md Executes quick checks within the sandboxed environment to verify paths and expected configurations. ```bash node dist/cli.js path echo "$HOME" echo "$OPENCODE_MULTI_AUTH_STORE_DIR" echo "$OPENCODE_MULTI_AUTH_CODEX_AUTH_FILE" ``` -------------------------------- ### Configure Plugin via JSON Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Alternatively, configure the plugin using a JSON file. This method is useful for programmatic configuration. ```json { "plugin": ["@guard22/opencode-multi-auth-codex@latest"] } ``` -------------------------------- ### Perform Full Sandbox Reset Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/SANDBOX_QUICK_REF.md Deletes and recreates both the sandbox home and store directories for a complete reset. ```bash rm -rf /tmp/oma-sandbox-home /tmp/oma-sandbox-store mkdir -p /tmp/oma-sandbox-home/.codex /tmp/oma-sandbox-store ``` -------------------------------- ### Apply Preset Settings Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Applies a predefined preset of settings. ```APIDOC ## POST /api/settings/preset ### Description Applies a predefined set of configuration settings based on a given preset name. ### Method POST ### Endpoint /api/settings/preset ### Parameters #### Request Body - **preset** (string) - Required - The name of the preset to apply (e.g., "balanced"). ``` -------------------------------- ### Create Git Release Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/README.md Commands to commit the version bump, tag the release, and push to the main branch. ```bash git commit -m "chore: release v1.2.1" git tag v1.2.1 git push origin main --follow-tags ``` -------------------------------- ### Set Settings Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Updates the system settings, including rotation strategy and account weights. ```APIDOC ## PUT /api/settings ### Description Updates the system settings with a new rotation strategy, thresholds, and account weights. ### Method PUT ### Endpoint /api/settings ### Parameters #### Request Body - **rotationStrategy** (string) - Required - The desired rotation strategy. - **criticalThreshold** (integer) - Required - The critical threshold value. - **lowThreshold** (integer) - Required - The low threshold value. - **accountWeights** (object) - Required - An object mapping account aliases to their assigned weights. ``` -------------------------------- ### Inspect Sandbox Store Directory Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/SANDBOX_QUICK_REF.md Lists the contents of the sandbox store directory to help diagnose issues with corrupted or incorrect store data. ```bash ls -la /tmp/oma-sandbox-store ``` -------------------------------- ### Single-Command Sandbox Invocation Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/SANDBOX_QUICK_REF.md Launches the sandbox web interface using environment variables defined directly in the command, avoiding persistent exports. ```bash HOME=/tmp/oma-sandbox-home \ OPENCODE_MULTI_AUTH_STORE_DIR=/tmp/oma-sandbox-store \ OPENCODE_MULTI_AUTH_CODEX_AUTH_FILE=/tmp/oma-sandbox-home/.codex/auth.json \ node dist/cli.js web --host 127.0.0.1 --port 4343 ``` -------------------------------- ### Execute Failure, Stress, Sandbox, and Soak Tests Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/TEST_EXECUTION_PLAN.md Run specific test suites including failure, stress, sandbox, and a 48-hour soak test. These are critical for assessing system stability and resilience. ```bash npm run test:failure npm run test:stress npm run test:sandbox npm run test:soak:48h ``` -------------------------------- ### Set Weighted Rotation Strategy Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/codextesting.md Configure the system to use a weighted round-robin rotation strategy with specified thresholds and account weights. Requires JSON payload. ```bash curl -i -X PUT http://127.0.0.1:3434/api/settings -H 'Content-Type: application/json' --data '{"rotationStrategy":"weighted-round-robin","criticalThreshold":10,"lowThreshold":30,"accountWeights":{"test1":0.7,"test2":0.3}}' ``` -------------------------------- ### Reset Sandbox Store Directory Source: https://github.com/floze-the-genius/opencode-multi-auth-codex/blob/main/SANDBOX_QUICK_REF.md Removes and recreates the sandbox store directory to ensure a clean state for testing. ```bash rm -rf /tmp/oma-sandbox-store mkdir -p /tmp/oma-sandbox-store ```