@rerouter/helper 0.1.0 → 0.1.2
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/README.md +120 -0
- package/package.json +1 -1
- package/src/cli.js +1 -1
- package/src/lib/env.js +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# @rerouter/helper
|
|
2
|
+
|
|
3
|
+
Connect coding agents (Claude, Codex, Cursor, opencode, Continue) to Rerouter in seconds.
|
|
4
|
+
|
|
5
|
+
One command to configure your favorite AI coding tool to use Rerouter as the LLM gateway — with automatic backup, preview-first, and zero API keys written to disk.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @rerouter/helper
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or install globally:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @rerouter/helper
|
|
17
|
+
rerouter-helper
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
Set your Rerouter API key (get one from the Rerouter dashboard → API Keys):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# POSIX (bash/zsh)
|
|
26
|
+
export REROUTER_API_KEY=sk-rr-...
|
|
27
|
+
|
|
28
|
+
# PowerShell
|
|
29
|
+
$env:REROUTER_API_KEY = "sk-rr-..."
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Run the interactive wizard:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx @rerouter/helper
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or configure directly:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx @rerouter/helper configure --target claude --model anthropic/claude-sonnet-4 --write
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Commands
|
|
45
|
+
|
|
46
|
+
| Command | Description |
|
|
47
|
+
|--------|-------------|
|
|
48
|
+
| `npx @rerouter/helper` | Interactive wizard |
|
|
49
|
+
| `npx @rerouter/helper models [--search X]` | List models from catalog (auth required) |
|
|
50
|
+
| `npx @rerouter/helper configure --target T --model ID [--small-model ID] [--port N] [--write [--yes]]` | Configure a target |
|
|
51
|
+
| `npx @rerouter/helper check-key` | Key info without inference/billing |
|
|
52
|
+
| `npx @rerouter/helper targets` | List configuration targets |
|
|
53
|
+
| `npx @rerouter/helper bridge [--port N] [--host H]` | Local Responses API bridge (Codex) → Rerouter |
|
|
54
|
+
|
|
55
|
+
## Supported targets
|
|
56
|
+
|
|
57
|
+
| Target | Type | What it does |
|
|
58
|
+
|--------|------|-------------|
|
|
59
|
+
| `claude` | Automatic | Merges `~/.claude/settings.json` with env vars |
|
|
60
|
+
| `codex` | Automatic | Writes `~/.codex/config.toml` for local bridge |
|
|
61
|
+
| `opencode` | Automatic | Merges `~/.config/opencode/opencode.json` |
|
|
62
|
+
| `omp` | Automatic | Writes `~/.omp/agent/models.yml` |
|
|
63
|
+
| `continue` | Automatic | Writes `~/.continue/config.yaml` + `.env` placeholder |
|
|
64
|
+
| `openai` | Snippet | Prints shell env exports |
|
|
65
|
+
| `anthropic` | Snippet | Prints shell env exports |
|
|
66
|
+
| `cursor` | Guide | Step-by-step UI instructions |
|
|
67
|
+
| `vscode` | Guide | Step-by-step UI instructions |
|
|
68
|
+
| `cline` | Guide | Step-by-step UI instructions |
|
|
69
|
+
| `roo` | Guide | Step-by-step UI instructions |
|
|
70
|
+
|
|
71
|
+
## Codex (Responses API bridge)
|
|
72
|
+
|
|
73
|
+
Codex CLI speaks the Responses API (`POST /v1/responses`). Rerouter speaks Chat Completions. Run the local bridge to translate:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Terminal 1: start bridge
|
|
77
|
+
npx @rerouter/helper bridge
|
|
78
|
+
|
|
79
|
+
# Terminal 2: configure Codex
|
|
80
|
+
npx @rerouter/helper configure --target codex --model your-model --write
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The bridge runs on `127.0.0.1:8787` by default. Codex reads `env_key` from `REROUTER_API_KEY`.
|
|
84
|
+
|
|
85
|
+
## Safety
|
|
86
|
+
|
|
87
|
+
- **Preview first.** Without `--write`, every command is read-only.
|
|
88
|
+
- **Timestamp backup.** Any existing config is backed up before writing.
|
|
89
|
+
- **Key never written.** Your API key is only read from `REROUTER_API_KEY` env — never printed, never written to any file.
|
|
90
|
+
- **Ambiguous configs → manual merge.** If a config file is broken or ambiguous, the helper stops and shows you what to add manually.
|
|
91
|
+
|
|
92
|
+
## Environment variables
|
|
93
|
+
|
|
94
|
+
| Variable | Description |
|
|
95
|
+
|----------|-------------|
|
|
96
|
+
| `REROUTER_API_KEY` | Your Rerouter API key (`sk-rr-...`). Required for `models`, `configure`, `check-key`. |
|
|
97
|
+
| `REROUTER_BASE_URL` | Override base URL (default: `https://api.rerouter.dev`). |
|
|
98
|
+
|
|
99
|
+
## Examples
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# List all models
|
|
103
|
+
npx @rerouter/helper models
|
|
104
|
+
|
|
105
|
+
# Search for Claude models
|
|
106
|
+
npx @rerouter/helper models --search claude
|
|
107
|
+
|
|
108
|
+
# Configure Claude with a small/fast model for background tasks
|
|
109
|
+
npx @rerouter/helper configure --target claude --model anthropic/claude-sonnet-4 --small-model anthropic/claude-haiku-4 --write
|
|
110
|
+
|
|
111
|
+
# Preview Cursor setup (no changes)
|
|
112
|
+
npx @rerouter/helper configure --target cursor --model openai/gpt-5
|
|
113
|
+
|
|
114
|
+
# Get shell exports for any OpenAI-compatible tool
|
|
115
|
+
npx @rerouter/helper configure --target openai --model openai/gpt-5
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -36,7 +36,7 @@ UI guide targets: ${GUIDE_TARGETS.join(", ")}
|
|
|
36
36
|
|
|
37
37
|
Env:
|
|
38
38
|
REROUTER_API_KEY Rerouter key (sk-rr-...). Never printed or written to any file.
|
|
39
|
-
REROUTER_BASE_URL Override base URL (default: https://api.rerouter.
|
|
39
|
+
REROUTER_BASE_URL Override base URL (default: https://api.rerouter.dev).
|
|
40
40
|
`;
|
|
41
41
|
|
|
42
42
|
function fail(err) {
|
package/src/lib/env.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* to any file.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export const DEFAULT_BASE_URL = "https://api.rerouter.
|
|
7
|
+
export const DEFAULT_BASE_URL = "https://api.rerouter.dev";
|
|
8
8
|
|
|
9
9
|
export function baseUrl() {
|
|
10
10
|
return (process.env.REROUTER_BASE_URL?.trim() || DEFAULT_BASE_URL).replace(/\/+$/, "");
|