@certalis/agent-smith 0.1.4 → 0.1.6
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 +58 -6
- package/dist/bin.js +492 -118
- package/dist/post-processor.worker.js +128 -18
- package/dist/server.js +408 -92
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# agent-smith
|
|
2
2
|
|
|
3
|
-
**A proof-of-concept
|
|
3
|
+
**A proof-of-concept proxy and provider pool for Claude Code and Codex.**
|
|
4
4
|
|
|
5
5
|
> [!WARNING]
|
|
6
6
|
> **This is a proof of concept for ideation, not a product.** It exists to
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
> providers' terms.
|
|
16
16
|
> - Not affiliated with, endorsed by or sponsored by Anthropic or OpenAI.
|
|
17
17
|
|
|
18
|
-
Claude Code and Codex keep talking their own protocol. agent-smith sits
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
Claude Code and Codex keep talking their own protocol. agent-smith sits between
|
|
19
|
+
them and the provider: it chooses a provider from the pool you configure, then
|
|
20
|
+
an account inside that provider, watches the quota each provider reports, and
|
|
21
|
+
fails over when one cannot serve.
|
|
22
22
|
|
|
23
23
|
## How it works
|
|
24
24
|
|
|
@@ -85,6 +85,40 @@ startServer({
|
|
|
85
85
|
|
|
86
86
|
Codex works the same way with an OpenAI API key and an `openai-responses` pool.
|
|
87
87
|
|
|
88
|
+
## Connect an authorized development caller through SSH
|
|
89
|
+
|
|
90
|
+
The agents box and a development laptop both send requests to one proxy with a
|
|
91
|
+
forwarding key. A laptop can reach a private server through an SSH tunnel in
|
|
92
|
+
v1.
|
|
93
|
+
|
|
94
|
+
This is connectivity only, not team tenancy: the shared forwarding key does
|
|
95
|
+
not identify an individual caller or enforce per-client fairness. Do not
|
|
96
|
+
distribute it team-wide until the B2/W7 tenancy work exists.
|
|
97
|
+
|
|
98
|
+
Copy [`team-client.json`](examples/config/team-client.json) into your private
|
|
99
|
+
Agent-smith config. Put the forwarding key in the owner-only file named by
|
|
100
|
+
`proxy_key_file`, not in the JSON or a shell profile. `base_url` is the endpoint
|
|
101
|
+
visible to your machine, not a second pool. The key can spend from the pool, but
|
|
102
|
+
cannot administer it.
|
|
103
|
+
|
|
104
|
+
For an SSH tunnel, forward a local port to the private server and leave that SSH
|
|
105
|
+
session running:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
ssh -N -L 18181:127.0.0.1:8080 agent-smith-pool
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Then install the normal `claude` and `codex` wrappers once:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
agent-smith install-client
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Open a new terminal and use `claude` or `codex` normally. The wrappers only add
|
|
118
|
+
their own marked `PATH` entry; they do not replace the real binaries or start a
|
|
119
|
+
second proxy. The forwarding key is for inference, not dashboard or management
|
|
120
|
+
access.
|
|
121
|
+
|
|
88
122
|
## Configuration
|
|
89
123
|
|
|
90
124
|
The config file is JSON, read at startup from:
|
|
@@ -93,7 +127,8 @@ The config file is JSON, read at startup from:
|
|
|
93
127
|
on macOS and Linux,
|
|
94
128
|
- or the path in `ccflare_CONFIG_PATH`.
|
|
95
129
|
|
|
96
|
-
Restart agent-smith after changing `providers` or
|
|
130
|
+
Restart agent-smith after changing `providers`, `provider_pools`, `alerts` or
|
|
131
|
+
`block_when_all_full`.
|
|
97
132
|
|
|
98
133
|
| Key | What it does |
|
|
99
134
|
|---|---|
|
|
@@ -102,7 +137,10 @@ Restart agent-smith after changing `providers` or `provider_pools`.
|
|
|
102
137
|
| `providers.<name>.base_url` | The upstream URL, for an endpoint compatible with one of the strategies. |
|
|
103
138
|
| `providers.<name>.models` | The models a provider serves, as `"client model": "provider model"`. A trailing `*` matches a prefix. Without it, the provider serves every model name unchanged. |
|
|
104
139
|
| `provider_pools.<protocol>` | The ordered providers for `anthropic-messages` or `openai-responses`. Clients reach it at `/v1/pool/<protocol>/*`, and the local wrappers use it automatically. |
|
|
140
|
+
| `client` | The Agent-smith origin and forwarding key used by `agent-smith install-client`. It is for this machine only; it does not define providers or a separate pool. |
|
|
105
141
|
| `team_routing` | Which subscription accounts may share a pool, and their usage caps. See the [configuration guide](docs/configuration.md#team-routing). |
|
|
142
|
+
| `alerts` | A Slack webhook or bot token and/or an email address that hear when a seat spends extra usage and when every account is full. A filled value turns its channel on. See [Alerts](docs/configuration.md#alerts). |
|
|
143
|
+
| `block_when_all_full` | `true` by default: when every account is full, every request is refused until the soonest reset, so none spends extra usage. |
|
|
106
144
|
|
|
107
145
|
Every key, the environment variables and the HTTP API are in the
|
|
108
146
|
[configuration guide](docs/configuration.md).
|
|
@@ -154,6 +192,20 @@ to `acme` and are sent as `acme-large`. `acme` serves no other model.
|
|
|
154
192
|
}
|
|
155
193
|
```
|
|
156
194
|
|
|
195
|
+
**A laptop using a private shared pool**
|
|
196
|
+
([`team-client.json`](examples/config/team-client.json)). The example uses an
|
|
197
|
+
SSH-local port; use the direct private origin instead on a host that can reach
|
|
198
|
+
the pool without SSH.
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"client": {
|
|
203
|
+
"base_url": "http://127.0.0.1:18181",
|
|
204
|
+
"proxy_key_file": "~/.config/ccflare/team-pool.key"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
157
209
|
The Claude Code and Codex subscription examples are in
|
|
158
210
|
[Subscription sign-ins and provider terms](#subscription-sign-ins-and-provider-terms).
|
|
159
211
|
|