@legioncodeinc/rflectr 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.markdown-link-check.json +7 -0
- package/AGENTS.md +169 -0
- package/LICENSE +661 -0
- package/README.md +612 -0
- package/assets/733630021_1421561133353555_3999689754075308337_n.jpg +0 -0
- package/assets/github-home-image.png +0 -0
- package/assets/og-image.jpg +0 -0
- package/assets/og-image.png +0 -0
- package/assets/og-image.psd +0 -0
- package/assets/rflectr-no-bg.png +0 -0
- package/assets/vertex-models.example.json +14 -0
- package/dist/cli.js +15708 -0
- package/library/README.md +39 -0
- package/library/issues/README.md +46 -0
- package/library/issues/backlog/README.md +26 -0
- package/library/issues/completed/README.md +13 -0
- package/library/issues/in-work/README.md +13 -0
- package/library/knowledge/README.md +34 -0
- package/library/knowledge/private/README.md +40 -0
- package/library/knowledge/private/ai/README.md +8 -0
- package/library/knowledge/private/ai/model-discovery-classification.md +81 -0
- package/library/knowledge/private/ai/translation-layer.md +88 -0
- package/library/knowledge/private/architecture/README.md +10 -0
- package/library/knowledge/private/architecture/launch-flow-claude.md +93 -0
- package/library/knowledge/private/architecture/system-overview.md +108 -0
- package/library/knowledge/private/auth/README.md +9 -0
- package/library/knowledge/private/auth/oauth-device-flows.md +95 -0
- package/library/knowledge/private/data/README.md +8 -0
- package/library/knowledge/private/data/preferences-config.md +87 -0
- package/library/knowledge/private/data/provider-registry.md +126 -0
- package/library/knowledge/private/infrastructure/README.md +7 -0
- package/library/knowledge/private/infrastructure/server-gateway.md +87 -0
- package/library/knowledge/private/integrations/README.md +8 -0
- package/library/knowledge/private/integrations/harnesses.md +87 -0
- package/library/knowledge/private/integrations/local-proxy.md +82 -0
- package/library/knowledge/private/security/README.md +9 -0
- package/library/knowledge/private/security/credential-storage.md +129 -0
- package/library/knowledge/private/standards/documentation-framework.md +154 -0
- package/library/knowledge/public/README.md +49 -0
- package/library/knowledge/public/faqs/README.md +7 -0
- package/library/knowledge/public/faqs/troubleshooting.md +92 -0
- package/library/knowledge/public/guides/README.md +13 -0
- package/library/knowledge/public/guides/ai-agents.md +273 -0
- package/library/knowledge/public/guides/api-server.md +108 -0
- package/library/knowledge/public/guides/claude-desktop.md +382 -0
- package/library/knowledge/public/guides/codex.md +296 -0
- package/library/knowledge/public/guides/gemini-cli.md +105 -0
- package/library/knowledge/public/guides/model-compatibility.md +80 -0
- package/library/knowledge/public/guides/providers.md +90 -0
- package/library/knowledge/public/overview/README.md +7 -0
- package/library/knowledge/public/overview/what-is-rflectr.md +71 -0
- package/library/notes/README.md +21 -0
- package/library/requirements/README.md +51 -0
- package/library/requirements/backlog/README.md +30 -0
- package/library/requirements/completed/README.md +14 -0
- package/library/requirements/completed/prd-001-cli-core-launch-orchestration/prd-001-cli-core-launch-orchestration-index.md +205 -0
- package/library/requirements/completed/prd-001-cli-core-launch-orchestration/qa/.gitkeep +0 -0
- package/library/requirements/completed/prd-002-provider-registry/qa/.gitkeep +0 -0
- package/library/requirements/completed/prd-003-model-discovery-classification/qa/.gitkeep +0 -0
- package/library/requirements/completed/prd-004-translation-layer/qa/.gitkeep +0 -0
- package/library/requirements/completed/prd-005-local-proxy-catalog-routing/qa/.gitkeep +0 -0
- package/library/requirements/completed/prd-007-oauth-device-flows/qa/.gitkeep +0 -0
- package/library/requirements/completed/prd-011-claude-desktop-integration/qa/.gitkeep +0 -0
- package/library/requirements/in-work/README.md +19 -0
- package/library/requirements/reports/README.md +31 -0
- package/package.json +84 -0
- package/scripts/refresh-models-dev-cache.mjs +34 -0
- package/test-proxy.ts +19 -0
- package/test-split.js +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<a href="https://www.ospry.ai">
|
|
4
|
+
<picture>
|
|
5
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/legioncodeinc/brands/main/ospry/logos/png/core-assets/transparent/horizontal-white-1024.png">
|
|
6
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/legioncodeinc/brands/main/ospry/logos/png/core-assets/transparent/horizontal-ink-1024.png">
|
|
7
|
+
<img alt="OSPRY" src="https://raw.githubusercontent.com/legioncodeinc/brands/main/ospry/logos/png/core-assets/transparent/horizontal-ink-1024.png" width="300">
|
|
8
|
+
</picture>
|
|
9
|
+
</a>
|
|
10
|
+
|
|
11
|
+
<sub>Want to know what will actually drive more revenue? **[OSPRY](https://www.ospry.ai)** is the insight engine built for exactly that. Check it out at [ospry.ai](https://www.ospry.ai).</sub>
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<div align="center">
|
|
18
|
+
|
|
19
|
+
<picture>
|
|
20
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/legioncodeinc/brands/main/legion-code-inc/logos/legion-logo-dark.svg">
|
|
21
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/legioncodeinc/brands/main/legion-code-inc/logos/legion-logo-light.svg">
|
|
22
|
+
<img alt="Legion" src="https://raw.githubusercontent.com/legioncodeinc/brands/main/legion-code-inc/logos/legion-logo-light.svg" width="280">
|
|
23
|
+
</picture>
|
|
24
|
+
|
|
25
|
+
<br>
|
|
26
|
+
<br>
|
|
27
|
+
|
|
28
|
+
# rflectr
|
|
29
|
+
|
|
30
|
+
### Relay any model into any coding agent.
|
|
31
|
+
|
|
32
|
+
Launch your tools, switch providers mid-session, and run local API gateways — all from one CLI.
|
|
33
|
+
|
|
34
|
+
<br>
|
|
35
|
+
|
|
36
|
+
[](https://www.npmjs.com/package/@legioncodeinc/rflectr)
|
|
37
|
+
[](LICENSE)
|
|
38
|
+
[](https://nodejs.org)
|
|
39
|
+
|
|
40
|
+
[](#supported-tools)
|
|
41
|
+
[](#supported-tools)
|
|
42
|
+
[](#supported-tools)
|
|
43
|
+
|
|
44
|
+
<br>
|
|
45
|
+
|
|
46
|
+
<picture>
|
|
47
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/rflectr-overview.png">
|
|
48
|
+
<source media="(prefers-color-scheme: light)" srcset="assets/rflectr-overview.png">
|
|
49
|
+
<img alt="rflectr — relay any model into any coding agent. You pick a coding tool, rflectr launches it and routes requests to any model provider you choose." src="assets/rflectr-overview.png" width="900">
|
|
50
|
+
</picture>
|
|
51
|
+
|
|
52
|
+
<br>
|
|
53
|
+
<br>
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g @legioncodeinc/rflectr
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## What is rflectr?
|
|
64
|
+
|
|
65
|
+
**rflectr** is an interactive CLI that launches AI coding tools and runs local API gateways on your machine — so you can point any coding agent at any model provider.
|
|
66
|
+
|
|
67
|
+
It currently supports **Claude Code**, **Claude Desktop (Cowork + Code)**, the **OpenAI Codex CLI**, the **Codex desktop app**, and the **Google Gemini CLI**.
|
|
68
|
+
|
|
69
|
+
**Pick your backend:**
|
|
70
|
+
|
|
71
|
+
| | Backend | Set up with |
|
|
72
|
+
|:---:|---|---|
|
|
73
|
+
| 🔌 | **Your providers** | `rflectr providers` — Groq, Mistral, Nvidia, DeepSeek, custom OpenAI/Anthropic endpoints, and more |
|
|
74
|
+
| ☁️ | **OpenCode Zen / Go** | Cloud models with your OpenCode API key (optional; add via `rflectr providers`) |
|
|
75
|
+
| 📦 | **One-time OpenCode import** | Bring existing OpenCode provider settings into the registry (`rflectr providers import`) |
|
|
76
|
+
| 🟢 | **Google Vertex AI** | Claude on Vertex via `rflectr server --vertex` and local gcloud credentials (no OpenCode key required) |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Contents
|
|
81
|
+
|
|
82
|
+
- [Commands](#commands)
|
|
83
|
+
- [Features](#features)
|
|
84
|
+
- [Supported tools](#supported-tools)
|
|
85
|
+
- [Prerequisites](#prerequisites)
|
|
86
|
+
- [Installation](#installation)
|
|
87
|
+
- [Setup](#setup)
|
|
88
|
+
- [Usage](#usage)
|
|
89
|
+
- [Server mode](#server-mode)
|
|
90
|
+
- [How it works](#how-it-works)
|
|
91
|
+
- [Configuration](#configuration)
|
|
92
|
+
- [Troubleshooting](#troubleshooting)
|
|
93
|
+
- [License](#license)
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Commands
|
|
98
|
+
|
|
99
|
+
> **Platform key:** ✅ supported · ❌ not available. Commands without a platform-specific note run on **macOS, Windows, and Linux**.
|
|
100
|
+
|
|
101
|
+
| Command | Description | 🍎 macOS | 🪟 Windows | 🐧 Linux |
|
|
102
|
+
|---------|-------------|:---:|:---:|:---:|
|
|
103
|
+
| `rflectr` | Print help (does not launch Claude Code) | ✅ | ✅ | ✅ |
|
|
104
|
+
| `rflectr claude` | Pick a provider → launch Claude Code | ✅ | ✅ | ✅ |
|
|
105
|
+
| `rflectr providers` | Add, import, list, remove, and refresh your AI providers | ✅ | ✅ | ✅ |
|
|
106
|
+
| `rflectr models` | Manage favorite models for mid-session `/model` switching | ✅ | ✅ | ✅ |
|
|
107
|
+
| `rflectr server` | Foreground API gateway (registry providers + optional Zen/Go) | ✅ | ✅ | ✅ |
|
|
108
|
+
| `rflectr server --vertex` | Foreground Anthropic-compatible gateway to Claude on Vertex AI | ✅ | ✅ | ✅ |
|
|
109
|
+
| `rflectr claude-app` | Launch Claude Desktop app with registry providers · [guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/claude-desktop.md) | ✅ | ✅ | ❌ |
|
|
110
|
+
| `rflectr codex` | Launch OpenAI Codex CLI with registry providers · [guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/codex.md) | ✅ | ✅ | ✅ |
|
|
111
|
+
| `rflectr codex-app` | Launch Codex desktop app with registry providers · [guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/codex.md) | ✅ | ✅ | ❌ |
|
|
112
|
+
| `rflectr gemini` | Launch Google Gemini CLI with registry providers | ✅ | ✅ | ✅ |
|
|
113
|
+
| `rflectr --ai` | Full agent reference for scripts and alef-agent · [guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/ai-agents.md) | ✅ | ✅ | ✅ |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Features
|
|
118
|
+
|
|
119
|
+
#### 🗂️ Providers & models
|
|
120
|
+
- **Native provider registry** — `rflectr providers` stores config in `~/.rflectr/providers.json` and secrets in the OS keychain. No OpenCode binary required at launch. See the **[Providers guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/providers.md)** for the full list and known issues.
|
|
121
|
+
- **Provider templates** — Add Groq, Mistral, Together, OpenRouter, and 15+ SDK-backed providers, plus custom OpenAI/Anthropic-compatible endpoints.
|
|
122
|
+
- **OpenCode import** — One-time migration from OpenCode (`providers import`); validates API keys and skips placeholders like `anything`.
|
|
123
|
+
- **OpenCode Zen / Go** — Optional cloud backends when you have an OpenCode API key.
|
|
124
|
+
- **Favorite models** — Save up to 20 and switch mid-session with Claude Code's `/model` command.
|
|
125
|
+
- **Smart model pickers** — Recent models per provider, search for large lists (>25), paginated browse (15 per page).
|
|
126
|
+
- **Refresh model lists** — `rflectr providers refresh-models` updates cached catalogs per provider.
|
|
127
|
+
|
|
128
|
+
#### 🛰️ Gateways & routing
|
|
129
|
+
- **SDK adapter proxy** — Non-Anthropic providers route through the Vercel AI SDK (same packages OpenCode uses), so Claude Code still speaks Anthropic format. Labeled `via proxy` in the picker.
|
|
130
|
+
- **API server** — Run a local gateway on port **`17645`** for Claude Code, Claude Desktop, or any Anthropic-compatible client.
|
|
131
|
+
- **Server wizard** — Filter exposed providers, mask discovery ids for Claude Desktop, optional favorites-only catalog, local vs network listen mode.
|
|
132
|
+
- **Vertex gateway** — Anthropic-compatible Claude on Google Vertex AI using gcloud Application Default Credentials.
|
|
133
|
+
|
|
134
|
+
#### 🔒 Safety & ergonomics
|
|
135
|
+
- **Clean environment isolation** — We strip 17 conflicting env vars (Vertex AI, Bedrock, AWS, Foundry, stale Anthropic config) from the child process only. We never touch `~/.claude/settings.json` (see caveat below).
|
|
136
|
+
- **Secure key storage** — Per-provider keys and the OpenCode API key go in the OS credential store (macOS Keychain, Windows Credential Manager, Linux Secret Service) or your shell profile.
|
|
137
|
+
- **Cross-platform** — macOS, Windows, Linux (Ubuntu, Fedora, distros with GNOME Keyring or KWallet).
|
|
138
|
+
- **Dry run mode** — Walk through the full wizard and preview the launch command without starting anything.
|
|
139
|
+
- **Preference memory** — Last provider and model are pre-selected next time.
|
|
140
|
+
- **Agent / headless launch** — Boot flags (`--provider`, `--model`), clean NDJSON/JSONL stdout for alef-agent, and `rflectr --ai` reference. See the **[AI Agents guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/ai-agents.md)**.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Supported tools
|
|
145
|
+
|
|
146
|
+
> **Platform key:** ✅ supported · ❌ not available. Rows without a platform-specific note run on **macOS, Windows, and Linux**. The desktop apps are macOS + Windows only.
|
|
147
|
+
|
|
148
|
+
| Tool | Command | 🍎 macOS | 🪟 Windows | 🐧 Linux | Status |
|
|
149
|
+
|------|---------|:---:|:---:|:---:|--------|
|
|
150
|
+
| Provider registry | `rflectr providers` | ✅ | ✅ | ✅ | ✅ Supported · [guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/providers.md) |
|
|
151
|
+
| Claude Code | `rflectr claude` | ✅ | ✅ | ✅ | ✅ Supported |
|
|
152
|
+
| Favorite models | `rflectr models` | ✅ | ✅ | ✅ | ✅ Supported |
|
|
153
|
+
| OpenCode API server | `rflectr server` | ✅ | ✅ | ✅ | ✅ Supported |
|
|
154
|
+
| Vertex API gateway | `rflectr server --vertex` | ✅ | ✅ | ✅ | ✅ Supported |
|
|
155
|
+
| Claude Desktop (Cowork + Code) | `rflectr claude-app` | ✅ | ✅ | ❌ | ✅ Supported · [guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/claude-desktop.md) |
|
|
156
|
+
| Codex CLI | `rflectr codex` | ✅ | ✅ | ✅ | ✅ Supported · [guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/codex.md) |
|
|
157
|
+
| Codex desktop app | `rflectr codex-app` | ✅ | ✅ | ❌ | ✅ Supported · [guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/codex.md) |
|
|
158
|
+
| Google Gemini CLI | `rflectr gemini` | ✅ | ✅ | ✅ | ⚠️ Experimental · model switching via `.model` prompt |
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Prerequisites
|
|
163
|
+
|
|
164
|
+
| Requirement | Needed for |
|
|
165
|
+
|---|---|
|
|
166
|
+
| **Node.js 18+** | Everything |
|
|
167
|
+
| A supported AI coding tool installed | Launching that tool — [Claude Code](https://www.npmjs.com/package/@anthropic-ai/claude-code), [OpenAI Codex](https://www.npmjs.com/package/@openai/codex), or [Google Gemini CLI](https://www.npmjs.com/package/@google/gemini-cli) |
|
|
168
|
+
| At least one provider | Configure via `rflectr providers add` / `import`, **or** an [OpenCode API key](https://opencode.ai/auth) for Zen/Go cloud backends |
|
|
169
|
+
| [OpenCode CLI](https://opencode.ai) *(optional)* | One-time import from an existing OpenCode setup |
|
|
170
|
+
| [Google Cloud SDK](https://cloud.google.com/sdk) *(Vertex only)* | `gcloud auth application-default login`, a GCP project with Vertex AI enabled, and Claude partner models enabled |
|
|
171
|
+
|
|
172
|
+
> [!NOTE]
|
|
173
|
+
> **On providers:** rflectr keeps your provider list in `~/.rflectr/providers.json`. You can add providers directly (API key + template), import from OpenCode once, or use Zen/Go cloud backends. OpenCode is not required after setup.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Installation
|
|
178
|
+
|
|
179
|
+
Install the CLI globally:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
npm install -g @legioncodeinc/rflectr
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
<details>
|
|
186
|
+
<summary><strong>Upgrading & uninstalling</strong></summary>
|
|
187
|
+
|
|
188
|
+
<br>
|
|
189
|
+
|
|
190
|
+
**Upgrade to the latest version:**
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
npm update -g @legioncodeinc/rflectr
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Uninstall:**
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
npm uninstall -g @legioncodeinc/rflectr
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
> [!NOTE]
|
|
203
|
+
> If you use a Node version manager like **NVM**, run the uninstall command using the active Node version that was used to install it (e.g., run `nvm use <version>` first).
|
|
204
|
+
|
|
205
|
+
**Remove all configuration data** by deleting the `.rflectr` directory:
|
|
206
|
+
|
|
207
|
+
| Platform | Command |
|
|
208
|
+
|---|---|
|
|
209
|
+
| 🍎 macOS / 🐧 Linux | `rm -rf ~/.rflectr` |
|
|
210
|
+
| 🪟 Windows (cmd) | `rmdir /s /q "%USERPROFILE%\.rflectr"` |
|
|
211
|
+
| 🪟 Windows (PowerShell) | `Remove-Item -Recurse -Force "$env:USERPROFILE\.rflectr"` |
|
|
212
|
+
|
|
213
|
+
</details>
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Setup
|
|
218
|
+
|
|
219
|
+
### 1. Configure providers
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
rflectr providers # hub: add, import, list, refresh models
|
|
223
|
+
rflectr providers add # pick a template or custom endpoint
|
|
224
|
+
rflectr providers import # one-time migration from OpenCode (optional)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
On first `rflectr claude` run with an empty registry, an inline wizard walks you through Quick start (Zen), import, or opening `rflectr providers`.
|
|
228
|
+
|
|
229
|
+
### 2. OpenCode API key *(Zen/Go only)*
|
|
230
|
+
|
|
231
|
+
Grab your key at [opencode.ai/auth](https://opencode.ai/auth) if you use OpenCode Zen or Go (skip for registry-only or Vertex setups).
|
|
232
|
+
|
|
233
|
+
| Platform | 🔐 Secure storage | 📄 Plaintext fallback |
|
|
234
|
+
|----------|---------------|-------------------|
|
|
235
|
+
| 🍎 macOS | Keychain (optional: + `~/.zshrc` auto-load) | Shell profile |
|
|
236
|
+
| 🪟 Windows | Credential Manager | `setx` user env var |
|
|
237
|
+
| 🐧 Linux (desktop) | Secret Service (GNOME Keyring / KWallet) | Shell profile |
|
|
238
|
+
| 🐧 Linux (headless) | *n/a* | Shell profile |
|
|
239
|
+
|
|
240
|
+
> [!TIP]
|
|
241
|
+
> The key is active in your current session right away, no matter which option you pick. No terminal restart needed.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Usage
|
|
246
|
+
|
|
247
|
+
### Launch Claude Code
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
rflectr claude
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
First run: pick a provider from your registry (or complete the inline setup wizard). If you've added OpenCode Zen/Go, those appear alongside registry providers like Groq, Nvidia, or DeepSeek.
|
|
254
|
+
|
|
255
|
+
#### Favorite models and mid-session switching
|
|
256
|
+
|
|
257
|
+
Save the models you bounce between:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
rflectr models
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Add up to 20 favorites from Zen, Go, or any OpenCode-configured provider. When you have favorites, `rflectr claude` starts a multi-route proxy automatically. Claude Code's `/model` command lists your starting model plus favorites. Switch live, no restart.
|
|
264
|
+
|
|
265
|
+
No favorites? Launch works like before: single model, no switch menu. `--dry-run` ignores saved favorites so you can preview a single-model launch.
|
|
266
|
+
|
|
267
|
+
#### `rflectr claude` options
|
|
268
|
+
|
|
269
|
+
| Flag | Description |
|
|
270
|
+
|------|-------------|
|
|
271
|
+
| `--dry-run` | Run the full wizard but preview the launch command instead of executing |
|
|
272
|
+
| `--setup` | Reminder to use `rflectr providers` for provider setup |
|
|
273
|
+
| `--trace` | Write debug logs to `~/.rflectr/logs/` and show errors on exit |
|
|
274
|
+
| `--help` | Show command help |
|
|
275
|
+
| `--version` | Show version |
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
rflectr claude --dry-run
|
|
279
|
+
rflectr claude --setup
|
|
280
|
+
rflectr claude --trace
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Claude Code flags and session IDs pass through unchanged:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
rflectr claude -c
|
|
287
|
+
rflectr claude --resume abc-123
|
|
288
|
+
rflectr claude abc-123
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Non-interactive / agent launch** — skip the wizard with boot flags:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
rflectr claude --provider groq --model llama-3.3-70b-versatile -p "Summarize README.md"
|
|
295
|
+
rflectr claude --model zen__deepseek-v4-flash-free -p "task" --output-format stream-json
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
| Flag | Description |
|
|
299
|
+
|------|-------------|
|
|
300
|
+
| `--provider` | Boot provider id (skip wizard with `--model` or in print mode) |
|
|
301
|
+
| `--model` | Boot model id, or slug `provider__model-id` |
|
|
302
|
+
|
|
303
|
+
For alef-agent, NDJSON streaming, Codex `exec --json`, and sandbox defaults, see the **[AI Agents guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/ai-agents.md)** and run `rflectr --ai`.
|
|
304
|
+
|
|
305
|
+
Use `--` when you want every following token passed directly to Claude Code:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
rflectr claude -- --print "hello"
|
|
309
|
+
rflectr claude -- --dangerously-skip-permissions
|
|
310
|
+
rflectr claude --dry-run -- --print "test"
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Server mode
|
|
316
|
+
|
|
317
|
+
Run rflectr as a foreground API gateway on port **`17645`**:
|
|
318
|
+
|
|
319
|
+
| Mode | Command | Auth | Models |
|
|
320
|
+
|------|---------|------|--------|
|
|
321
|
+
| **Registry gateway** | `rflectr server` | Per-provider keys in registry (+ OpenCode key for Zen/Go if exposed) | Providers you configured |
|
|
322
|
+
| **Vertex gateway** | `rflectr server --vertex` | gcloud Application Default Credentials | Claude on Vertex AI |
|
|
323
|
+
|
|
324
|
+
> [!TIP]
|
|
325
|
+
> **Claude Desktop (Cowork + Code):** For the automated macOS/Windows setup, use `rflectr claude-app`. For manual or network setups, see the [Claude Desktop guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/claude-desktop.md).
|
|
326
|
+
|
|
327
|
+
### Registry gateway (`rflectr server`)
|
|
328
|
+
|
|
329
|
+
Works with any providers in your registry. Zen/Go models appear when you have an OpenCode API key and those providers are exposed.
|
|
330
|
+
|
|
331
|
+
**The wizard asks:**
|
|
332
|
+
|
|
333
|
+
| Prompt | What it does |
|
|
334
|
+
|--------|--------------|
|
|
335
|
+
| **Configure & start** vs **Start with saved settings** | Full wizard or reuse saved server preferences |
|
|
336
|
+
| **Exposed providers** | Limit which providers appear in the catalog (Zen, Go, Groq, OpenAI, etc.) |
|
|
337
|
+
| **Mask gateway model ids for discovery?** | Recommended **Yes** for Claude Desktop — hides competitor vendor strings in model ids so discovery works |
|
|
338
|
+
| **Expose only favorite models?** | Optional cap at your favorites (manage with `rflectr models`) |
|
|
339
|
+
| **Listen mode** | **Local only** (`127.0.0.1`) or **Network** (`0.0.0.0` + server password) |
|
|
340
|
+
|
|
341
|
+
**Local mode** — point any Anthropic-compatible client at your machine:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
export ANTHROPIC_BASE_URL="http://127.0.0.1:17645/anthropic"
|
|
345
|
+
export ANTHROPIC_API_KEY="anything"
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
**Network mode** — other devices on your LAN:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
export ANTHROPIC_BASE_URL="http://<server-ip>:17645/anthropic"
|
|
352
|
+
export ANTHROPIC_API_KEY="<server-password>"
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
By default the server password stays in memory only. If you choose to save it, rflectr stores it in `~/.rflectr/config.json`.
|
|
356
|
+
|
|
357
|
+
OpenAI-format models also get an OpenAI-compatible endpoint:
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
export OPENAI_BASE_URL="http://127.0.0.1:17645/openai/v1"
|
|
361
|
+
export OPENAI_API_KEY="anything"
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
**Health check:**
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
curl -s http://127.0.0.1:17645/health
|
|
368
|
+
curl -s http://127.0.0.1:17645/anthropic/v1/models | head
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
The spinner reports how many models loaded and how many came from registry providers.
|
|
372
|
+
|
|
373
|
+
### Vertex gateway (`rflectr server --vertex`)
|
|
374
|
+
|
|
375
|
+
Anthropic-compatible gateway to Claude on Google Vertex AI. No OpenCode API key required.
|
|
376
|
+
|
|
377
|
+
**Setup:**
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
gcloud auth application-default login
|
|
381
|
+
export ANTHROPIC_VERTEX_PROJECT_ID="your-gcp-project" # or GOOGLE_CLOUD_PROJECT
|
|
382
|
+
export GOOGLE_CLOUD_LOCATION="global" # optional; default: global
|
|
383
|
+
rflectr server --vertex
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
- **Default models:** `claude-sonnet-4-6`, `claude-opus-4-6`, `claude-haiku-4-5`
|
|
387
|
+
- **Shorthand aliases** (for Claude Code `/model` and `settings.json`): `sonnet`, `opus`, `haiku`. Append `[1m]` for 1M context on Sonnet and Opus only (Haiku stays 200k).
|
|
388
|
+
- **Custom catalog:** copy `assets/vertex-models.example.json` to `~/.rflectr/vertex-models.json` and edit. Override the config directory with `RFLECTR_HOME`.
|
|
389
|
+
|
|
390
|
+
When the gateway is running:
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
export ANTHROPIC_BASE_URL="http://127.0.0.1:17645/anthropic"
|
|
394
|
+
export ANTHROPIC_API_KEY="anything"
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
> [!TIP]
|
|
398
|
+
> **Claude Code tip:** When routing through the gateway, unset native Vertex env vars so Claude Code doesn't bypass the proxy:
|
|
399
|
+
> ```bash
|
|
400
|
+
> unset CLAUDE_CODE_USE_VERTEX ANTHROPIC_VERTEX_PROJECT_ID CLOUD_ML_REGION
|
|
401
|
+
> ```
|
|
402
|
+
|
|
403
|
+
### Codex CLI (`rflectr codex`)
|
|
404
|
+
|
|
405
|
+
Launch [OpenAI Codex CLI](https://developers.openai.com/codex/cli) with registry providers. Requires `npm install -g @openai/codex`.
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
rflectr providers add # Anthropic, xAI, OpenAI, etc.
|
|
409
|
+
rflectr codex # pick provider + model → Codex TUI
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
rflectr writes a **temporary** profile (`~/.codex/rflectr-launch.config.toml`) and removes it when Codex exits. After a crash: `rflectr codex --restore`.
|
|
413
|
+
|
|
414
|
+
**Sandbox / network:** `rflectr codex` defaults to **`danger-full-access`** (profile + `-s` flag) so shell tools like `curl`, `nlm`, and npm can reach the network. Override for one session:
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
rflectr codex -s workspace-write
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
Pass Codex flags directly after `rflectr codex` — you do **not** need `--` before `-s`. Codex's `--dangerously-bypass-approvals-and-sandbox` also passes through if you need it.
|
|
421
|
+
|
|
422
|
+
Full details: **[Codex guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/codex.md)** — CLI + desktop app, configs, restore, sandbox, routing. For agent / alef-agent integration (boot flags, NDJSON, JSONL): **[AI Agents guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/ai-agents.md)** and `rflectr --ai`.
|
|
423
|
+
|
|
424
|
+
### Claude Desktop app (`rflectr claude-app`)
|
|
425
|
+
|
|
426
|
+
Launch **Claude Desktop** (macOS or Windows) with registry providers:
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
rflectr claude-app
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
This command automates the "Third-Party Inference" (Developer Mode) setup. It temporarily configures Claude Desktop to point at a local gateway, launches the app, and routes traffic to your chosen provider.
|
|
433
|
+
|
|
434
|
+
- **Keep the terminal open** — The proxy runs in the foreground.
|
|
435
|
+
- **Ctrl+C to restore** — When you're done, press `Ctrl+C` in the terminal to automatically restore Claude Desktop to its normal Anthropic cloud mode.
|
|
436
|
+
- **Cleanup** — If the terminal crashes, run `rflectr claude-app --restore`.
|
|
437
|
+
|
|
438
|
+
For manual network setups (e.g., remote cloud desktop), you can still use `rflectr server`. See the full [Claude Desktop Setup Guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/claude-desktop.md).
|
|
439
|
+
|
|
440
|
+
### Codex desktop app (`rflectr codex-app`)
|
|
441
|
+
|
|
442
|
+
Launch the **Codex app** (macOS or Windows) with registry providers:
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
rflectr codex-app
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Patches `~/.codex/config.toml` with backup; **Ctrl+C** in the rflectr terminal restores your config. The app keeps Codex's built-in `openai` provider active so existing conversation history remains visible, and routes the selected model through a foreground local proxy. Preview config without writing: `rflectr codex-app --config`. Recovery: `rflectr codex-app --restore`.
|
|
449
|
+
|
|
450
|
+
See the **[Codex guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/codex.md)** for CLI vs app differences, file ownership, and troubleshooting.
|
|
451
|
+
|
|
452
|
+
> [!TIP]
|
|
453
|
+
> **Reasoning effort:** Capable models show Codex's native reasoning picker (low/medium/high, etc.). rflectr maps your choice to each provider's SDK options and preserves existing `model_reasoning_effort` in Codex config. Claude Code `/effort` and the `rflectr server` gateway use the same mapping — see the [reasoning section in the Codex guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/codex.md#reasoning-effort).
|
|
454
|
+
|
|
455
|
+
### Google Gemini CLI (`rflectr gemini`)
|
|
456
|
+
|
|
457
|
+
Launch the [Google Gemini CLI](https://www.npmjs.com/package/@google/gemini-cli) with registry providers.
|
|
458
|
+
|
|
459
|
+
```bash
|
|
460
|
+
rflectr gemini
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
Pick provider → pick model → Gemini prompt loop opens. Non-interactive tasks with streaming NDJSON are also fully supported:
|
|
464
|
+
|
|
465
|
+
```bash
|
|
466
|
+
rflectr gemini --provider google --model gemini-2.5-flash -p "Review this file" -o stream-json
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
For agent / alef-agent integration (boot flags, NDJSON): **[AI Agents guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/guides/ai-agents.md)** and `rflectr --ai`.
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## How it works
|
|
474
|
+
|
|
475
|
+
### OpenCode Zen / Go filtering
|
|
476
|
+
|
|
477
|
+
When OpenCode Zen is in your registry, `subscriptionFilter` controls which Zen models appear (`free` = free tier only; default = all Zen models). Add or change Zen via `rflectr providers`.
|
|
478
|
+
|
|
479
|
+
### Environment isolation
|
|
480
|
+
|
|
481
|
+
When you launch, rflectr builds a clean child environment:
|
|
482
|
+
|
|
483
|
+
1. Removes 17 conflicting env vars from the child process (Vertex AI, Bedrock, AWS, Foundry, stale Anthropic config)
|
|
484
|
+
2. Sets `ANTHROPIC_BASE_URL`, `ANTHROPIC_API_KEY`, and `ANTHROPIC_MODEL` for the session
|
|
485
|
+
3. Passes `--model <selected>` to Claude Code as a backup override
|
|
486
|
+
|
|
487
|
+
When Claude Code exits (normal exit, Ctrl+C, terminal close), your shell is unchanged. No cleanup step. No restore needed.
|
|
488
|
+
|
|
489
|
+
> [!WARNING]
|
|
490
|
+
> **Claude Code persists the model.** rflectr doesn't edit `~/.claude/settings.json`, but Claude Code saves the model you launched with (via `--model` and `ANTHROPIC_MODEL`). A later bare `claude` launch may still show that model, e.g. `anthropic-opencode-go__deepseek-v4-flash` from a prior rflectr session. To get back to a first-party default, run `claude --model sonnet` (or your preferred Claude model), or remove the `"model"` key from `~/.claude/settings.json`. If you used the favorites switch menu, Claude Code may also cache the gateway catalog at `~/.claude/cache/gateway-models.json`. Delete that file if `/model` shows stale entries from a dead proxy.
|
|
491
|
+
|
|
492
|
+
### Model compatibility
|
|
493
|
+
|
|
494
|
+
OpenCode exposes models through different API formats. rflectr handles them when it can:
|
|
495
|
+
|
|
496
|
+
| Model format | Examples | How it works | Label |
|
|
497
|
+
|---|---|---|---|
|
|
498
|
+
| **Anthropic native** | Claude, Qwen, MiniMax (Go) | Direct connection | *(none)* |
|
|
499
|
+
| **OpenAI chat completions** | DeepSeek, Kimi, MiMo, GLM, Grok, GPT-4o | SDK adapter proxy (Vercel AI SDK) | `via proxy` |
|
|
500
|
+
| **OpenAI Responses API** | GPT-5.4+, GPT-5.5, Codex, o-series | Same proxy; SDK picks Responses API | `via proxy` |
|
|
501
|
+
| **Gemini native** | Gemini (OpenCode Google provider) | SDK adapter, Gemini native API | `via proxy` |
|
|
502
|
+
| **Other SDK providers** | Cerebras, Perplexity, Bedrock, Vertex, Together AI | Whatever `api.npm` OpenCode assigns | `via proxy` |
|
|
503
|
+
| **Not in cloud wizard** | GPT, Gemini on OpenCode Zen/Go | Use an OpenCode-configured provider instead | `not yet supported` |
|
|
504
|
+
|
|
505
|
+
The SDK adapter proxy starts on a random local port for proxy-routed models and stops when Claude Code exits. Each `rflectr claude` session gets its own port, so multiple terminals are fine. (`rflectr server` uses fixed port `17645` — one server instance per machine.)
|
|
506
|
+
|
|
507
|
+
### Provider notes
|
|
508
|
+
|
|
509
|
+
> [!NOTE]
|
|
510
|
+
> **Mistral (free tier):** Rate limits are tight. Expect HTTP 429 during tool-heavy sessions. Claude Code retries with backoff. That's Mistral throttling, not a proxy bug.
|
|
511
|
+
|
|
512
|
+
> [!NOTE]
|
|
513
|
+
> **OpenAI (OpenCode-configured provider):** Configure OpenAI in [OpenCode](https://opencode.ai) with your API key, then pick the OpenAI provider at launch. Newer GPT models use OpenAI's Responses API. The SDK picks `responses` vs `chat` from the model ID. OpenCode catalog IDs can differ from API IDs (e.g. `gpt-5.5-fast` maps to upstream `gpt-5.5`). If you see "model not available", run `rflectr claude --trace` and check `~/.rflectr/logs/claude-debug.log`.
|
|
514
|
+
|
|
515
|
+
`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` is set for direct (non-proxy) routes only. Proxy sessions keep tool-search betas.
|
|
516
|
+
|
|
517
|
+
### API key storage
|
|
518
|
+
|
|
519
|
+
rflectr uses [`@napi-rs/keyring`](https://www.npmjs.com/package/@napi-rs/keyring) for the OS credential store. On later runs it checks silently. Key found? Wizard skips the prompt.
|
|
520
|
+
|
|
521
|
+
| Platform | Credential store | Notes |
|
|
522
|
+
|----------|-----------------|-------|
|
|
523
|
+
| 🍎 macOS | macOS Keychain | Optional `~/.zshrc` auto-load line for system-wide availability |
|
|
524
|
+
| 🪟 Windows | Windows Credential Manager | `setx` available as plaintext alternative |
|
|
525
|
+
| 🐧 Linux (desktop) | Secret Service API (GNOME Keyring, KWallet) | Needs a running keyring daemon |
|
|
526
|
+
| 🐧 Linux (headless) | Not available | Falls back to shell profile or session-only |
|
|
527
|
+
|
|
528
|
+
If the native module fails to load, credential store options are skipped and you get shell profile / session-only storage.
|
|
529
|
+
|
|
530
|
+
---
|
|
531
|
+
|
|
532
|
+
## Configuration
|
|
533
|
+
|
|
534
|
+
**Provider registry** (no secrets in this file):
|
|
535
|
+
|
|
536
|
+
```text
|
|
537
|
+
~/.rflectr/providers.json
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
Manage with `rflectr providers`. API keys are stored in the OS keychain (`keyring:provider:<id>`).
|
|
541
|
+
|
|
542
|
+
**App preferences** — favorites, last provider/model, server settings, optional server password:
|
|
543
|
+
|
|
544
|
+
```text
|
|
545
|
+
~/.rflectr/config.json
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
**Override the config directory:**
|
|
549
|
+
|
|
550
|
+
```bash
|
|
551
|
+
export RFLECTR_HOME="/path/to/your/rflectr-home"
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
The OpenCode API key (for Zen/Go) and per-provider keys are stored separately, based on what you chose during setup (Keychain, credential store, or shell profile).
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## Troubleshooting
|
|
559
|
+
|
|
560
|
+
See the **[Troubleshooting guide](https://github.com/legioncodeinc/rflectr/blob/main/library/knowledge/public/faqs/troubleshooting.md)** for common issues — especially **"Not logged in"** after accidentally choosing **No** on Claude Code's custom API key prompt.
|
|
561
|
+
|
|
562
|
+
<details>
|
|
563
|
+
<summary><strong>Upgrading from opencode-starter</strong></summary>
|
|
564
|
+
|
|
565
|
+
<br>
|
|
566
|
+
|
|
567
|
+
If you used the old **opencode-starter** CLI, rflectr migrates automatically on first run:
|
|
568
|
+
|
|
569
|
+
- Config moves from `~/.opencode-starter/` → `~/.rflectr/`
|
|
570
|
+
- Legacy Keychain / credential-store entries are read and re-saved under `rflectr`
|
|
571
|
+
- The CLI command is now `rflectr` (not `opencode-starter`)
|
|
572
|
+
- Launch Claude Code with `rflectr claude` (bare `rflectr` prints help)
|
|
573
|
+
|
|
574
|
+
The deprecated `OPENCODE_STARTER_HOME` env var still works as a fallback for `RFLECTR_HOME`.
|
|
575
|
+
|
|
576
|
+
</details>
|
|
577
|
+
|
|
578
|
+
---
|
|
579
|
+
|
|
580
|
+
## Contributing
|
|
581
|
+
|
|
582
|
+
Public beta right now. Issues and PRs welcome on [GitHub](https://github.com/legioncodeinc/rflectr).
|
|
583
|
+
|
|
584
|
+
## Disclaimer
|
|
585
|
+
|
|
586
|
+
This project and its creator have **no affiliation** with OpenCode, Anthropic, Claude, Google, or any other vendor named or integrated here. Trademarks belong to their respective owners.
|
|
587
|
+
|
|
588
|
+
rflectr was built for **education and research**.
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
## License
|
|
593
|
+
|
|
594
|
+
rflectr is free software, licensed under the **GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later)**.
|
|
595
|
+
|
|
596
|
+
You may use, study, share, and modify it. If you run a modified version to provide a network service, or you distribute it, you must make the complete corresponding source code available under the same license. See [`LICENSE`](LICENSE) for the full terms.
|
|
597
|
+
|
|
598
|
+
Copyright © 2026 Legion Code Inc. (Mario Aldayuz).
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
<div align="center">
|
|
603
|
+
|
|
604
|
+
<picture>
|
|
605
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/legioncodeinc/brands/main/legion-code-inc/logos/legion-symbol-dark.svg">
|
|
606
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/legioncodeinc/brands/main/legion-code-inc/logos/legion-symbol-light.svg">
|
|
607
|
+
<img alt="Legion symbol" src="https://raw.githubusercontent.com/legioncodeinc/brands/main/legion-code-inc/logos/legion-symbol-light.svg" width="32">
|
|
608
|
+
</picture>
|
|
609
|
+
|
|
610
|
+
<sub>We are Legion. Vibe with Legion.</sub>
|
|
611
|
+
|
|
612
|
+
</div>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|