setclaw 1.0.0 → 1.0.1
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 +243 -0
- package/bin/setup.mjs +21 -7
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# setclaw
|
|
4
|
+
|
|
5
|
+
**One command. All models. Every OS.**
|
|
6
|
+
|
|
7
|
+
Connect [Claude Code](https://docs.anthropic.com/en/docs/claude-code) and [Factory AI Droid](https://app.factory.ai) to [Quatarly](https://api.quatarly.cloud) — access Claude, Gemini, and GPT models with a single API key.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/setclaw)
|
|
10
|
+
[](https://nodejs.org)
|
|
11
|
+
[](./LICENSE)
|
|
12
|
+
[](https://www.npmjs.com/package/setclaw)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## What You Get
|
|
19
|
+
|
|
20
|
+
| Provider | Models |
|
|
21
|
+
|:---------|:-------|
|
|
22
|
+
| **Claude** | Sonnet 4.6, Opus 4.6 Thinking, Haiku 4.5 |
|
|
23
|
+
| **Gemini** | 3.1 Pro, 3 Flash |
|
|
24
|
+
| **GPT** | 5.1, 5.1 Codex, 5.1 Codex Max, 5.2, 5.2 Codex, 5.3 Codex |
|
|
25
|
+
|
|
26
|
+
> All 11 models through one Quatarly API key. No separate accounts needed.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Prerequisites
|
|
33
|
+
|
|
34
|
+
| # | What | How |
|
|
35
|
+
|:-:|:-----|:----|
|
|
36
|
+
| 1 | **Node.js 18+** | [nodejs.org](https://nodejs.org) |
|
|
37
|
+
| 2 | **Quatarly API key** | Format: `qua_trail_...` or `qua_...` |
|
|
38
|
+
| 3 | **Factory AI** *(optional)* | See [Install Factory](#install-factory-ai-optional) below |
|
|
39
|
+
|
|
40
|
+
### Install & Configure — One Command
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm i -g setclaw
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
That's it. During installation it will:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
setclaw — Quatarly setup for Claude Code & Factory
|
|
50
|
+
─────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
Enter your Quatarly API key: █
|
|
53
|
+
|
|
54
|
+
> Adding models to Factory...
|
|
55
|
+
✔ Factory: 11 models added, 0 updated (11 total)
|
|
56
|
+
✔ Backup saved to ~/.factory/settings.json.backup
|
|
57
|
+
> Setting Claude Code environment variables...
|
|
58
|
+
✔ Env vars written to Windows registry (HKCU\Environment).
|
|
59
|
+
|
|
60
|
+
Environment variables set:
|
|
61
|
+
ANTHROPIC_BASE_URL = https://api.quatarly.cloud/
|
|
62
|
+
ANTHROPIC_AUTH_TOKEN = qua_trai...
|
|
63
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL = claude-haiku-4-5-20251001
|
|
64
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL = claude-sonnet-4-6-20250929
|
|
65
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL = claude-opus-4-6-thinking
|
|
66
|
+
|
|
67
|
+
✔ All done! Restart your terminal, then launch Claude Code.
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Non-Interactive Install (CI / Scripts)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
QUATARLY_API_KEY=qua_trail_your-key npm i -g setclaw
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Using Claude Code
|
|
79
|
+
|
|
80
|
+
### 1. Install Claude Code
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm i -g @anthropic-ai/claude-code
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 2. Restart Your Terminal
|
|
87
|
+
|
|
88
|
+
> **Important:** Environment variables are set persistently, but your current shell won't see them until you restart it.
|
|
89
|
+
>
|
|
90
|
+
> - **New terminal** — picks up automatically
|
|
91
|
+
> - **Current terminal** — run `source ~/.zshrc` or `source ~/.bashrc`
|
|
92
|
+
> - **VS Code / GUI apps** — restart the app or log out & back in
|
|
93
|
+
|
|
94
|
+
### 3. Launch
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
claude
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Claude Code now routes all requests through Quatarly using your API key and credit balance.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Install Factory AI *(Optional)*
|
|
105
|
+
|
|
106
|
+
If you also want custom models inside Factory AI Droid:
|
|
107
|
+
|
|
108
|
+
**Windows (PowerShell):**
|
|
109
|
+
```powershell
|
|
110
|
+
irm https://app.factory.ai/cli/windows | iex
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**macOS / Linux:**
|
|
114
|
+
```bash
|
|
115
|
+
curl -fsSL https://app.factory.ai/cli | sh
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Then create an account at [app.factory.ai](https://app.factory.ai), run `droid` once to generate `~/.factory/settings.json`, and re-run:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npm i -g setclaw
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`setclaw` will detect the Factory config and inject all 11 models automatically.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Environment Variables Set
|
|
129
|
+
|
|
130
|
+
| Variable | Value |
|
|
131
|
+
|:---------|:------|
|
|
132
|
+
| `ANTHROPIC_BASE_URL` | `https://api.quatarly.cloud/` |
|
|
133
|
+
| `ANTHROPIC_AUTH_TOKEN` | *your Quatarly API key* |
|
|
134
|
+
| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | `claude-haiku-4-5-20251001` |
|
|
135
|
+
| `ANTHROPIC_DEFAULT_SONNET_MODEL` | `claude-sonnet-4-6-20250929` |
|
|
136
|
+
| `ANTHROPIC_DEFAULT_OPUS_MODEL` | `claude-opus-4-6-thinking` |
|
|
137
|
+
|
|
138
|
+
<details>
|
|
139
|
+
<summary><b>Where are they stored?</b></summary>
|
|
140
|
+
|
|
141
|
+
| OS | Location |
|
|
142
|
+
|:---|:---------|
|
|
143
|
+
| **Windows** | `HKCU\Environment` (User-level registry) |
|
|
144
|
+
| **macOS** | `~/.bashrc` and `~/.zshrc` |
|
|
145
|
+
| **Linux** | `~/.bashrc` and `~/.zshrc` |
|
|
146
|
+
|
|
147
|
+
</details>
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Models Reference
|
|
152
|
+
|
|
153
|
+
| Model | Provider | Endpoint |
|
|
154
|
+
|:------|:---------|:---------|
|
|
155
|
+
| `claude-sonnet-4-6-20250929` | Anthropic | `https://api.quatarly.cloud/` |
|
|
156
|
+
| `claude-opus-4-6-thinking` | Anthropic | `https://api.quatarly.cloud/` |
|
|
157
|
+
| `claude-haiku-4-5-20251001` | Anthropic | `https://api.quatarly.cloud/` |
|
|
158
|
+
| `gemini-3.1-pro` | OpenAI-compat | `https://api.quatarly.cloud/v1` |
|
|
159
|
+
| `gemini-3-flash` | OpenAI-compat | `https://api.quatarly.cloud/v1` |
|
|
160
|
+
| `gpt-5.1` | OpenAI-compat | `https://api.quatarly.cloud/v1` |
|
|
161
|
+
| `gpt-5.1-codex` | OpenAI-compat | `https://api.quatarly.cloud/v1` |
|
|
162
|
+
| `gpt-5.1-codex-max` | OpenAI-compat | `https://api.quatarly.cloud/v1` |
|
|
163
|
+
| `gpt-5.2` | OpenAI-compat | `https://api.quatarly.cloud/v1` |
|
|
164
|
+
| `gpt-5.2-codex` | OpenAI-compat | `https://api.quatarly.cloud/v1` |
|
|
165
|
+
| `gpt-5.3-codex` | OpenAI-compat | `https://api.quatarly.cloud/v1` |
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Manual Setup (Without setclaw)
|
|
170
|
+
|
|
171
|
+
<details>
|
|
172
|
+
<summary><b>macOS / Linux</b></summary>
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
export ANTHROPIC_BASE_URL="https://api.quatarly.cloud/"
|
|
176
|
+
export ANTHROPIC_AUTH_TOKEN="qua_trail_your-key-here"
|
|
177
|
+
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5-20251001"
|
|
178
|
+
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-6-20250929"
|
|
179
|
+
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-6-thinking"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Add these to `~/.zshrc` or `~/.bashrc` to persist.
|
|
183
|
+
|
|
184
|
+
</details>
|
|
185
|
+
|
|
186
|
+
<details>
|
|
187
|
+
<summary><b>Windows (PowerShell)</b></summary>
|
|
188
|
+
|
|
189
|
+
```powershell
|
|
190
|
+
$env:ANTHROPIC_BASE_URL = "https://api.quatarly.cloud/"
|
|
191
|
+
$env:ANTHROPIC_AUTH_TOKEN = "qua_trail_your-key-here"
|
|
192
|
+
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "claude-haiku-4-5-20251001"
|
|
193
|
+
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "claude-sonnet-4-6-20250929"
|
|
194
|
+
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "claude-opus-4-6-thinking"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
To persist, use `[System.Environment]::SetEnvironmentVariable("VAR", "value", "User")` for each.
|
|
198
|
+
|
|
199
|
+
</details>
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## FAQ
|
|
204
|
+
|
|
205
|
+
<details>
|
|
206
|
+
<summary><b>Can I run it again with a different API key?</b></summary>
|
|
207
|
+
|
|
208
|
+
Yes. Re-run `npm i -g setclaw` — it updates existing models and env vars without creating duplicates. A backup of your Factory settings is saved before any changes.
|
|
209
|
+
|
|
210
|
+
</details>
|
|
211
|
+
|
|
212
|
+
<details>
|
|
213
|
+
<summary><b>Do I need an Anthropic account?</b></summary>
|
|
214
|
+
|
|
215
|
+
No. Claude Code routes through Quatarly — you only need a Quatarly API key.
|
|
216
|
+
|
|
217
|
+
</details>
|
|
218
|
+
|
|
219
|
+
<details>
|
|
220
|
+
<summary><b>What if Factory AI isn't installed?</b></summary>
|
|
221
|
+
|
|
222
|
+
`setclaw` detects whether `~/.factory/settings.json` exists. If not, it skips Factory setup and only configures Claude Code env vars.
|
|
223
|
+
|
|
224
|
+
</details>
|
|
225
|
+
|
|
226
|
+
<details>
|
|
227
|
+
<summary><b>How do I uninstall?</b></summary>
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
npm uninstall -g setclaw
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
This removes the package. To also remove the env vars:
|
|
234
|
+
- **Windows:** Delete from `HKCU\Environment` via System Properties > Environment Variables
|
|
235
|
+
- **macOS/Linux:** Remove the `# --- Quatarly / Claude Code env ---` block from `~/.bashrc` / `~/.zshrc`
|
|
236
|
+
|
|
237
|
+
</details>
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## License
|
|
242
|
+
|
|
243
|
+
MIT
|
package/bin/setup.mjs
CHANGED
|
@@ -7,24 +7,38 @@
|
|
|
7
7
|
* terminal directly (/dev/tty on unix, CON on windows) to prompt.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { readFileSync, writeFileSync, copyFileSync, appendFileSync, existsSync,
|
|
10
|
+
import { readFileSync, writeFileSync, copyFileSync, appendFileSync, existsSync, createReadStream } from "fs";
|
|
11
11
|
import { join } from "path";
|
|
12
12
|
import { homedir, platform } from "os";
|
|
13
13
|
import { execSync } from "child_process";
|
|
14
14
|
import { createInterface } from "readline";
|
|
15
|
+
import { Socket } from "net";
|
|
15
16
|
|
|
16
17
|
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
17
18
|
|
|
18
|
-
function openTTY() {
|
|
19
|
-
const ttyPath = platform() === "win32" ? "CON" : "/dev/tty";
|
|
20
|
-
return createReadStream(ttyPath, { encoding: "utf-8" });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
19
|
function ask(question) {
|
|
20
|
+
if (platform() === "win32") {
|
|
21
|
+
// On Windows, npm postinstall has no usable stdin and createReadStream("CON")
|
|
22
|
+
// resolves as a relative path. Shell out to PowerShell to read from the console.
|
|
23
|
+
process.stderr.write(question);
|
|
24
|
+
try {
|
|
25
|
+
const result = execSync(
|
|
26
|
+
'powershell -NoProfile -Command "[Console]::In.ReadLine()"',
|
|
27
|
+
{ stdio: ["inherit", "pipe", "inherit"], encoding: "utf-8" }
|
|
28
|
+
);
|
|
29
|
+
return Promise.resolve((result || "").trim());
|
|
30
|
+
} catch {
|
|
31
|
+
return Promise.reject(
|
|
32
|
+
new Error("Cannot read from terminal. Pass the key via: QUATARLY_API_KEY=<key> npm i -g setclaw")
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Unix: open /dev/tty directly to bypass npm's stdin suppression
|
|
24
38
|
return new Promise((resolve, reject) => {
|
|
25
39
|
let ttyIn;
|
|
26
40
|
try {
|
|
27
|
-
ttyIn =
|
|
41
|
+
ttyIn = createReadStream("/dev/tty", { encoding: "utf-8" });
|
|
28
42
|
} catch {
|
|
29
43
|
reject(new Error("Cannot open terminal for input. Pass the key via: QUATARLY_API_KEY=<key> npm i -g setclaw"));
|
|
30
44
|
return;
|