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