labs-claude 0.2.6 → 0.3.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/README.md CHANGED
@@ -1,122 +1,141 @@
1
- # labs-claude
2
-
3
- Run the **real Claude Code CLI** on **ElevenLabs models**: GPT-6 Astra, GPT-6.1 Sol, GPT-5.6 Terra, Claude Opus 5.5, Gemini 3.8 Flash, GLM-52 and more, using your own ElevenLabs credits. It works the way Ollama does: Claude Code stays original (tools, skills, subagents, `/model`, `/resume`, permissions) and only the model behind it changes.
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm install -g labs-claude
9
- labs setup
10
- labs
11
- ```
12
-
13
- ## Update
14
-
15
- ```bash
16
- npm install -g labs-claude@latest --prefer-online
17
- ```
18
-
19
- Then **close every open `labs` window and open `labs` again**. A new `labs` replaces the old background proxy by itself, and old windows keep running old code until they are restarted. `labs --version` shows what you have.
20
-
21
- Works on **Windows, macOS and Linux**. You need:
22
-
23
- - **Node.js 18+**
24
- - **Claude Code** installed (`claude --version` should work)
25
- - An **ElevenLabs API key** with ElevenAgents access (elevenlabs.io → Developers → API Keys)
26
-
27
- `labs setup` checks your key and creates one agent in **your** ElevenLabs account named *Labs Claude Code Bridge*. The key is saved in `~/.labs/config.json`, readable only by you. If `ELEVENLABS_API_KEY` is set in your environment instead, the key is used from there and never written to disk.
28
-
29
- ## Use
30
-
31
- | Command | What it does |
32
- |---|---|
33
- | `labs` | Claude Code on the default model (astra) |
34
- | `labs --model opus` | Pick a model by short name |
35
- | `labs --model 5` | Pick by its number in `labs models` |
36
- | `labs --model gpt-5.4` | Any ElevenLabs LLM id |
37
- | `labs -p "fix the failing test"` | Any Claude Code flag passes through |
38
- | `labs --effort max` | Reasoning effort (default: `high`). labs keeps the effort you chose: a slow first word is retried up to 3 times at the same effort, never lowered |
39
- | `labs models` / `labs models --all` | List models with context and reply sizes |
40
- | `labs usage` | Credits left, and what recent sessions cost per model (tokens and USD) |
41
- | `labs stop` | Stop the background proxy |
42
-
43
- Inside Claude Code, `/model terra` or `/model gpt-6-luna` switches model, and `/effort` changes effort. Claude's own names map to the same models on ElevenLabs (`opus` → `claude-opus-5-5`).
44
-
45
- ## How it works
46
-
47
- ```
48
- Claude Code ──HTTP (Anthropic API)──> labs proxy on 127.0.0.1:8081 ──WebSocket──> ElevenLabs agent ──> chosen LLM
49
- ```
50
-
51
- - The proxy forwards Claude Code's real system prompt and its real tools. Each tool is mirrored once into your ElevenLabs account as a client tool.
52
- - When the model calls a tool, Claude Code runs it on your machine, with its usual permission prompts.
53
- - Every conversation runs in text-only mode, so no audio is generated.
54
-
55
- ## Control your real Chrome
56
-
57
- Claude in Chrome needs a claude.ai login, which labs replaces with its own key, so `labs --chrome` cannot work. labs drives **your real Chrome** (your logins and tabs) through Microsoft's official **Playwright Extension** instead:
58
-
59
- 1. Install the [Playwright Extension](https://chromewebstore.google.com/detail/playwright-extension/mmlmfjhmonkocbjadbfplnigmagldckm) (publisher: Microsoft; linked from [microsoft/playwright](https://github.com/microsoft/playwright/tree/main/packages/extension)).
60
- 2. Click its icon and copy `PLAYWRIGHT_MCP_EXTENSION_TOKEN` (optional: without it Chrome asks "Allow?" on each connection).
61
- 3. Run `labs setup` and answer **y** to "Let labs control your real Chrome?". It adds the `labs-browser` server to Claude Code.
62
- 4. Close and reopen `labs`, then ask for any browser task: *"open gmail.com and read the subject of my top email"*.
63
-
64
- The model works in its own tab group, so your other tabs stay out of reach. It can use every site you are signed in to, so give it the same care as any browser agent.
65
-
66
- ## GLM 5.3 on Amazon Bedrock (your own AWS account)
67
-
68
- `glm` runs Z.AI's full GLM 5.3 (744B, 1M context, 128k replies) through Amazon Bedrock instead of ElevenLabs. It is a direct API, so none of the ElevenLabs limits below apply (no 50-second cut, no tool cap, no 4k replies).
69
-
70
- 1. In the AWS console (region us-east-1): Amazon Bedrock → API keys → generate a key.
71
- 2. `labs bedrock` and paste it (hidden; saved to `~/.labs/bedrock-key`, never printed).
72
- 3. `labs --model glm`, or `/model glm` inside Claude Code. The older ElevenLabs GLM 5.2 is still there as `glm52`.
73
-
74
- Every request of that session (side calls too) stays on Bedrock and is billed to your AWS account (credits first). `~/.labs/bedrock-usage.jsonl` logs tokens per call. Claude Code compacts at `"bedrockContextLimit"` (default `200000`) because Bedrock bills all input tokens on every turn.
75
-
76
- ## Chat page
77
-
78
- `labs chat` opens a private chat page at `http://127.0.0.1:8081/chat`, already logged in: it opens a one-time link (single use, 60 seconds), so you never paste the key. If that fails, the key goes to the clipboard for a one-time login instead.
79
-
80
- - **Chat**: talk to GLM 5.3 (or any labs model); drop text files and images in; chats are saved in `~/.labs/chat/`; each reply shows tokens and an estimated cost.
81
- - **Agent**: pick a folder and give a task; the real Claude Code works there on the chosen model and the page shows each step. "Can read and edit files" allows edits only; "Full access" also runs commands.
82
-
83
- The page works only on this machine (`127.0.0.1`) and only with your labs key (an HttpOnly, same-site cookie).
84
-
85
- The page lives inside the proxy, so it is down until `labs` or `labs chat` starts the proxy. To keep it up from login, run `labs autostart on` (Windows): a hidden task checks the proxy at login and every 2 minutes, also on battery. `labs autostart off` removes the task.
86
-
87
- ## Phone (Remote Control)
88
-
89
- `/remote-control` does not work in labs: Anthropic disables it whenever `ANTHROPIC_BASE_URL` points at a proxy. Use real `claude` for Remote Control, or run `labs` in `tmux` on a server and open it from your phone over SSH.
90
-
91
- ## Saving tokens
92
-
93
- ElevenLabs caches only the system prompt, so every token of history is paid in full on every turn. labs keeps that down:
94
-
95
- - **Side calls on a cheap model.** Titles, summaries and compaction (requests without tools) run on `gemini-3.8-flash`. Set `"sideModel": false` in `~/.labs/config.json` to keep them on your chosen model.
96
- - **Compaction at 300k.** Claude Code compacts at `"contextLimit"` (default `300000`), even on 1M models; raise it in `~/.labs/config.json` if you want longer memory at a higher cost.
97
- - **Big file reads.** A whole-file Read over 350 lines is summarised by `gemini-3.8-flash` with line ranges; the model reads exact lines with offset/limit before editing. Turn off with `"shunt": false`.
98
- - `labs usage` shows fresh vs cached input per model, so you can see where credits go.
99
-
100
- ## Limits to know
101
-
102
- - **Context windows are ElevenLabs' limits:** Astra, Sol and Terra have 272k; Opus 5.5, Sonnet 5.5 and Gemini 3.8 Flash have 1M; GLM, Qwen and DeepSeek have 64k context with 4k replies.
103
- - **About 50 seconds per reply:** ElevenLabs cuts any single reply (thinking plus writing) after roughly 50 s. labs asks the model to write big files in parts of about 80 lines.
104
- - **15 seconds to the first word:** ElevenLabs' maximum. labs retries a slow start up to 3 times before Claude Code sees an error.
105
- - **120-second tool limit:** ElevenLabs gives up on a tool after 120 s; labs sends the late result as a message when the command finishes.
106
- - **About 190 tools at once:** an ElevenLabs agent holds at most 200 tool documents; beyond that, labs offers the most recently used ones.
107
- - **Usage is billed to your ElevenLabs account.** Check it at elevenlabs.io → Usage or with `labs usage`.
108
-
109
- ## Reliability
110
-
111
- - **One memory per task.** Each Claude Code thread stays in one ElevenLabs conversation; a restart replays your instructions (CLAUDE.md, memory) plus the newest turns.
112
- - **Live streaming.** Text appears as the model writes it.
113
- - **Self-healing proxy.** A `labs` window restarts the background proxy within ~10 s if it dies.
114
- - **Local only.** The proxy accepts only `labs` (a private key in `~/.labs/proxy-key`) on `127.0.0.1`.
115
-
116
- ## Files
117
-
118
- `~/.labs/`: `config.json`, `proxy-key`, `proxy.log`, `llm-list.json`, `tool-registry-<agent>.json`, `conversations/`, `bedrock-key`, `bedrock-usage.jsonl`, `chat/`
119
-
120
- ## License
121
-
122
- MIT
1
+ # labs-claude
2
+
3
+ Run the **real Claude Code CLI** on **ElevenLabs models**: GPT-6 Astra, GPT-6.1 Sol, GPT-5.6 Terra, Claude Opus 5.5, Gemini 3.8 Flash, GLM-52 and more, using your own ElevenLabs credits. It works the way Ollama does: Claude Code stays original (tools, skills, subagents, `/model`, `/resume`, permissions) and only the model behind it changes.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g labs-claude
9
+ labs setup
10
+ labs
11
+ ```
12
+
13
+ ## Update
14
+
15
+ ```bash
16
+ npm install -g labs-claude@latest --prefer-online
17
+ ```
18
+
19
+ Then **close every open `labs` window and open `labs` again**. A new `labs` replaces the old background proxy by itself, and old windows keep running old code until they are restarted. `labs --version` shows what you have.
20
+
21
+ Works on **Windows, macOS and Linux**. You need:
22
+
23
+ - **Node.js 18+**
24
+ - **Claude Code** installed (`claude --version` should work)
25
+ - An **ElevenLabs API key** with ElevenAgents access (elevenlabs.io → Developers → API Keys)
26
+
27
+ `labs setup` checks your key and creates one agent in **your** ElevenLabs account named *Labs Claude Code Bridge*. The key is saved in `~/.labs/config.json`, readable only by you. If `ELEVENLABS_API_KEY` is set in your environment instead, the key is used from there and never written to disk.
28
+
29
+ ## Use
30
+
31
+ | Command | What it does |
32
+ |---|---|
33
+ | `labs` | Claude Code on the default model (astra) |
34
+ | `labs --model opus` | Pick a model by short name |
35
+ | `labs --model 5` | Pick by its number in `labs models` |
36
+ | `labs --model gpt-5.4` | Any ElevenLabs LLM id |
37
+ | `labs -p "fix the failing test"` | Any Claude Code flag passes through |
38
+ | `labs --effort max` | Reasoning effort (default: `high`). labs keeps the effort you chose: a slow first word is retried up to 3 times at the same effort, never lowered |
39
+ | `labs models` / `labs models --all` | List models with context and reply sizes |
40
+ | `labs usage` | Credits left, and what recent sessions cost per model (tokens and USD) |
41
+ | `labs stop` | Stop the background proxy |
42
+
43
+ Inside Claude Code, `/model terra` or `/model gpt-6-luna` switches model, and `/effort` changes effort. Claude's own names map to the same models on ElevenLabs (`opus` → `claude-opus-5-5`).
44
+
45
+ ## How it works
46
+
47
+ ```
48
+ Claude Code ──HTTP (Anthropic API)──> labs proxy on 127.0.0.1:8081 ──WebSocket──> ElevenLabs agent ──> chosen LLM
49
+ ```
50
+
51
+ - The proxy forwards Claude Code's real system prompt and its real tools. Each tool is mirrored once into your ElevenLabs account as a client tool.
52
+ - When the model calls a tool, Claude Code runs it on your machine, with its usual permission prompts.
53
+ - Every conversation runs in text-only mode, so no audio is generated.
54
+
55
+ ## Control your real Chrome
56
+
57
+ Claude in Chrome needs a claude.ai login, which labs replaces with its own key, so `labs --chrome` cannot work. labs drives **your real Chrome** (your logins and tabs) through Microsoft's official **Playwright Extension** instead:
58
+
59
+ 1. Install the [Playwright Extension](https://chromewebstore.google.com/detail/playwright-extension/mmlmfjhmonkocbjadbfplnigmagldckm) (publisher: Microsoft; linked from [microsoft/playwright](https://github.com/microsoft/playwright/tree/main/packages/extension)).
60
+ 2. Click its icon and copy `PLAYWRIGHT_MCP_EXTENSION_TOKEN` (optional: without it Chrome asks "Allow?" on each connection).
61
+ 3. Run `labs setup` and answer **y** to "Let labs control your real Chrome?". It adds the `labs-browser` server to Claude Code.
62
+ 4. Close and reopen `labs`, then ask for any browser task: *"open gmail.com and read the subject of my top email"*.
63
+
64
+ The model works in its own tab group, so your other tabs stay out of reach. It can use every site you are signed in to, so give it the same care as any browser agent.
65
+
66
+ ## Qwen on our GPU box (a labs key, no ElevenLabs account needed)
67
+
68
+ The box runs Qwen 3.8 27B (normal and uncensored, 262k context) on one RTX PRO 6000. It is on for booked hours, not all day.
69
+
70
+ 1. Get a labs key (`lk_...`) from whoever runs the gateway.
71
+ 2. `labs key`, press Enter for the address (`https://labs.instant.uz`), paste the key (hidden).
72
+ 3. `labs --model qwen` or `labs --model qwen-uncensored`.
73
+
74
+ When the box is off, `labs` says so before Claude Code opens. Box tokens are free per token; each key can have a daily $ cap for paid models. The gateway (keys, metering, console) lives in `gateway/` and is not part of the npm package.
75
+
76
+ ## GLM 5.3 on Amazon Bedrock (your own AWS account)
77
+
78
+ `glm` runs Z.AI's full GLM 5.3 (744B, 1M context, 128k replies) through Amazon Bedrock instead of ElevenLabs. It is a direct API, so none of the ElevenLabs limits below apply (no 50-second cut, no tool cap, no 4k replies).
79
+
80
+ 1. In the AWS console (region us-east-1): Amazon Bedrock → API keys → generate a key.
81
+ 2. `labs bedrock` and paste it (hidden; saved to `~/.labs/bedrock-key`, never printed).
82
+ 3. `labs --model glm`, or `/model glm` inside Claude Code. The older ElevenLabs GLM 5.2 is still there as `glm52`.
83
+
84
+ Every request of that session (side calls too) stays on Bedrock and is billed to your AWS account (credits first). `~/.labs/bedrock-usage.jsonl` logs tokens per call. Claude Code compacts at `"bedrockContextLimit"` (default `200000`) because Bedrock bills all input tokens on every turn.
85
+
86
+ ## Auto fallback: real Opus first, labs Opus 5.5 when the subscription ends
87
+
88
+ `labs auto` (any Claude Code flags work) starts the real Claude Code on your subscription. When the subscription fails for good in that session, the same session is resumed on labs Opus 5.5 with one line: `Subscription limit hit, continuing on labs Opus 5.5`. The next `labs auto` tries the subscription again.
89
+
90
+ - Signal: labs tails the session transcript (`~/.claude/projects/.../<session>.jsonl`). It switches on an API-error record of type `authentication_failed`, `oauth_org_not_allowed`, `account_on_hold`, `billing_error`, or a `rate_limit` carrying `quotaLimits.status: rejected` that resets more than 5 minutes away (session, weekly, Opus limits). Plain 429s and overloads are retried by Claude Code and never switch.
91
+ - The title and first line show the brain: `Opus · subscription` or `Opus 5.5 · labs`.
92
+ - Test it: `LABS_AUTO_FORCE_FALLBACK=1 labs auto -p "say ok"` runs one real subscription turn, then forces the switch.
93
+ - Interactive limitation: after the switch, retype or say "continue" (the failed message is in the session; labs does not resend it).
94
+
95
+ ## Chat page
96
+
97
+ `labs chat` opens a private chat page at `http://127.0.0.1:8081/chat`, already logged in: it opens a one-time link (single use, 60 seconds), so you never paste the key. If that fails, the key goes to the clipboard for a one-time login instead.
98
+
99
+ - **Chat**: talk to GLM 5.3 (or any labs model); drop text files and images in; chats are saved in `~/.labs/chat/`; each reply shows tokens and an estimated cost.
100
+ - **Agent**: pick a folder and give a task; the real Claude Code works there on the chosen model and the page shows each step. "Can read and edit files" allows edits only; "Full access" also runs commands.
101
+
102
+ The page works only on this machine (`127.0.0.1`) and only with your labs key (an HttpOnly, same-site cookie).
103
+
104
+ The page lives inside the proxy, so it is down until `labs` or `labs chat` starts the proxy. To keep it up from login, run `labs autostart on` (Windows): a hidden task checks the proxy at login and every 2 minutes, also on battery. `labs autostart off` removes the task.
105
+
106
+ ## Phone (Remote Control)
107
+
108
+ `/remote-control` does not work in labs: Anthropic disables it whenever `ANTHROPIC_BASE_URL` points at a proxy. Use real `claude` for Remote Control, or run `labs` in `tmux` on a server and open it from your phone over SSH.
109
+
110
+ ## Saving tokens
111
+
112
+ ElevenLabs caches only the system prompt, so every token of history is paid in full on every turn. labs keeps that down:
113
+
114
+ - **Side calls on a cheap model.** Titles, summaries and compaction (requests without tools) run on `gemini-3.8-flash`. Set `"sideModel": false` in `~/.labs/config.json` to keep them on your chosen model.
115
+ - **Compaction at 300k.** Claude Code compacts at `"contextLimit"` (default `300000`), even on 1M models; raise it in `~/.labs/config.json` if you want longer memory at a higher cost.
116
+ - **Big file reads.** A whole-file Read over 350 lines is summarised by `gemini-3.8-flash` with line ranges; the model reads exact lines with offset/limit before editing. Turn off with `"shunt": false`.
117
+ - `labs usage` shows fresh vs cached input per model, so you can see where credits go.
118
+
119
+ ## Limits to know
120
+
121
+ - **Context windows are ElevenLabs' limits:** Astra, Sol and Terra have 272k; Opus 5.5, Sonnet 5.5 and Gemini 3.8 Flash have 1M; GLM, Qwen and DeepSeek have 64k context with 4k replies.
122
+ - **About 50 seconds per reply:** ElevenLabs cuts any single reply (thinking plus writing) after roughly 50 s. labs asks the model to write big files in parts of about 80 lines.
123
+ - **15 seconds to the first word:** ElevenLabs' maximum. labs retries a slow start up to 3 times before Claude Code sees an error.
124
+ - **120-second tool limit:** ElevenLabs gives up on a tool after 120 s; labs sends the late result as a message when the command finishes.
125
+ - **About 190 tools at once:** an ElevenLabs agent holds at most 200 tool documents; beyond that, labs offers the most recently used ones.
126
+ - **Usage is billed to your ElevenLabs account.** Check it at elevenlabs.io → Usage or with `labs usage`.
127
+
128
+ ## Reliability
129
+
130
+ - **One memory per task.** Each Claude Code thread stays in one ElevenLabs conversation; a restart replays your instructions (CLAUDE.md, memory) plus the newest turns.
131
+ - **Live streaming.** Text appears as the model writes it.
132
+ - **Self-healing proxy.** A `labs` window restarts the background proxy within ~10 s if it dies.
133
+ - **Local only.** The proxy accepts only `labs` (a private key in `~/.labs/proxy-key`) on `127.0.0.1`.
134
+
135
+ ## Files
136
+
137
+ `~/.labs/`: `config.json`, `proxy-key`, `proxy.log`, `llm-list.json`, `tool-registry-<agent>.json`, `conversations/`, `bedrock-key`, `bedrock-usage.jsonl`, `chat/`
138
+
139
+ ## License
140
+
141
+ MIT