multi-ai-consult
by wlevan3v1.0.0
Consult Gemini, Codex, Qwen, and OpenCode AIs in parallel
1 command GitHub
Commands
consultConsult Gemini, Codex, Qwen, and OpenCode AIs in parallel and synthesize responses
Documentation
# Multi-AI Consult Consult multiple AI assistants in parallel and get a synthesized response. ## Features - **Parallel Execution**: Query Gemini, Codex, Qwen, and OpenCode simultaneously - **Platform Detection**: Automatically uses `gtimeout` on macOS, `timeout` on Linux - **Full PATH Resolution**: Resolves CLI binary paths at startup to prevent exit 127 errors - **Response Truncation**: Prevents 25K token overflow with intelligent truncation - **Tiered Synthesis**: Adapts strategy based on response size (Small/Medium/Large) - **Enhanced Error Classification**: Categorizes errors (auth, rate limit, network, timeout) for smart retry - **Graceful Degradation**: Works with any subset of available AI CLIs ## Prerequisites Install at least one AI CLI: - `gemini` - Google Gemini CLI - `codex` - OpenAI Codex CLI - `qwen` - Alibaba Qwen CLI - `opencode` - OpenCode CLI Also required: - `jq` - JSON parsing - `coreutils` (macOS): `brew install coreutils` for `gtimeout` ## Usage ```bash # Basic consultation /consult <your question> # Query specific AIs only /consult --only=gemini,codex <question> # Exclude specific AIs /consult --exclude=qwen <question> # Show individual responses before synthesis /consult --verbose <question> # Preview prompt without executing /consult --dry-run <question> ``` ## Configuration | Variable | Default | Description | |----------|---------|-------------| | `CONSULT_TIMEOUT` | `120` | Timeout per CLI (seconds) | | `CONSULT_MAX_RESPONSE_CHARS` | `20000` | Max chars per response (~5K tokens) | | `CONSULT_GEMINI_MODEL` | `gemini-3-pro-preview` | Gemini model | | `CONSULT_CODEX_MODEL` | `gpt-5.1-codex-max` | Codex model | | `CONSULT_OPENCODE_MODEL` | `anthropic/claude-opus-4-5` | OpenCode model | ## How It Works 1. **Verify**: Detects platform and resolves full paths to CLI binaries 2. **Prepare**: Constructs a clear prompt from your query 3. **Execute**: Runs all available CLIs in parallel with timeout 4. **Retry**: Failed CLIs get one retry with exponential backoff 5. **Parse**: Extracts text responses using jq (handles NDJSON formats) 6. **Synthesize**: Combines all responses into a unified answer ## Exit Codes | Code | Meaning | |------|---------| | 0 | Success - at least 2 AIs responded | | 1 | Partial success - only 1 AI responded | | 2-5 | All AIs failed (auth/rate limit/timeout/other) | | 10 | No AI CLIs installed | | 11 | Missing required dependency | ## License MIT