@certalis/agent-smith 0.1.19 → 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
@@ -26,14 +26,16 @@ request to another provider.
26
26
  - **A pool of providers per client protocol.** Claude Code speaks
27
27
  `anthropic-messages`; Codex speaks `openai-responses`. Each protocol gets an
28
28
  ordered list of providers.
29
- - **Each provider is a built-in strategy** (`anthropic-api`, `openai-api`,
30
- `claude-code`, `codex`). It knows how to authenticate, how to read its quota
31
- signals, and how to choose between its own accounts.
29
+ - **Each provider is a built-in strategy** (`anthropic-api`,
30
+ `model-studio-anthropic-api`, `kimi-code-anthropic-api`,
31
+ `google-gemini-api`, `openai-api`, `claude-code`, `codex`). It knows how to authenticate,
32
+ how to read its quota signals, and how to choose between its own accounts.
32
33
  - **Each provider holds its accounts**: API keys, or subscription sign-ins once
33
34
  you enable them.
34
35
 
35
- Nothing is translated between protocols: a provider only serves clients that
36
- speak its protocol.
36
+ The default is no cross-protocol translation. `google-gemini-api` is the first
37
+ explicit adapter: it accepts the canonical Anthropic Messages client wire and
38
+ converts supported requests/responses at the selected Google provider edge.
37
39
 
38
40
  ## Install
39
41
 
@@ -68,8 +70,12 @@ startServer({
68
70
 
69
71
  ```json
70
72
  {
71
- "provider_pools": {
72
- "anthropic-messages": ["anthropic"]
73
+ "routing": {
74
+ "routes": {
75
+ "anthropic-messages": [
76
+ "anthropic"
77
+ ]
78
+ }
73
79
  }
74
80
  }
75
81
  ```
@@ -157,25 +163,27 @@ The config file is JSON, read at startup from:
157
163
  on macOS and Linux,
158
164
  - or the path in `AGENT_SMITH_CONFIG_PATH`.
159
165
 
160
- Restart agent-smith after changing `providers`, `provider_pools`, `alerts` or
161
- `block_when_all_full`.
166
+ Pool and Router management API updates apply live. Restart after hand-editing the configuration file.
167
+ On first start, Agent Smith automatically rewrites supported old configs and
168
+ keeps a private `<config-path>.backup` (or a timestamped backup if one already
169
+ differs). See the [migration and rollback guide](docs/configuration.md#migration-and-rollback).
162
170
 
163
171
  | Key | What it does |
164
172
  |---|---|
165
173
  | `providers.<name>.enabled` | Turns a provider's routes on or off. By default `anthropic` and `openai` are on, and `claude-code` and `codex` are off. |
166
- | `providers.<name>.strategy` | The built-in strategy: `anthropic-api`, `openai-api`, `claude-code` or `codex`. Required for a provider name you add yourself. |
174
+ | `providers.<name>.strategy` | The built-in strategy: `anthropic-api`, `model-studio-anthropic-api`, `kimi-code-anthropic-api`, `google-gemini-api`, `openai-api`, `claude-code` or `codex`. Required for a provider name you add yourself. |
167
175
  | `providers.<name>.base_url` | The upstream URL, for an endpoint compatible with one of the strategies. |
168
176
  | `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. |
169
- | `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. |
177
+ | `routing.routes.<protocol>` | The ordered providers for `anthropic-messages` or `openai-responses`. Clients reach it at `/v1/pool/<protocol>/*`, and the local wrappers use it automatically. |
170
178
  | `client` | This machine's shared-pool switch, origin and forwarding-key file. Use `agent-smith client on`, `off` or `status`; it does not define providers or a separate pool. |
171
- | `team_routing` | Which subscription accounts may share a pool, and their usage caps. See the [configuration guide](docs/configuration.md#team-routing). |
179
+ | `providers.<name>.pool` | Membership, usage caps and admission for that provider’s subscription pool. See the [configuration guide](docs/configuration.md#provider-pools). |
172
180
  | `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). |
173
- | `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. |
181
+ | `providers.<name>.pool.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. |
174
182
 
175
- To use capacity before renewal, enable `team_routing.prefer_expiring_quota`:
183
+ To use capacity before renewal, enable `providers.<name>.pool.prefer_expiring_quota`:
176
184
  new pinned chats may favor a fresh quota window close to its reset. Existing
177
185
  chats and hard caps stay unchanged; this option is off by default. See
178
- [load balancing](docs/load-balancing.md#team-routing-opt-in).
186
+ [load balancing](docs/load-balancing.md#provider-pools-opt-in).
179
187
 
180
188
  For direct Codex subscription accounts, the private dashboard's **Accounts →
181
189
  Usage resets** lists available reset grants and their expiration. Using one
@@ -195,8 +203,12 @@ Each example is a complete config file, also in [`examples/config/`](examples/co
195
203
 
196
204
  ```json
197
205
  {
198
- "provider_pools": {
199
- "anthropic-messages": ["anthropic"]
206
+ "routing": {
207
+ "routes": {
208
+ "anthropic-messages": [
209
+ "anthropic"
210
+ ]
211
+ }
200
212
  }
201
213
  }
202
214
  ```
@@ -206,13 +218,42 @@ Each example is a complete config file, also in [`examples/config/`](examples/co
206
218
 
207
219
  ```json
208
220
  {
209
- "provider_pools": {
210
- "openai-responses": ["openai"]
221
+ "routing": {
222
+ "routes": {
223
+ "openai-responses": [
224
+ "openai"
225
+ ]
226
+ }
227
+ }
228
+ }
229
+ ```
230
+
231
+ **Claude-compatible Gemini Developer API**
232
+ ([`google-gemini-anthropic-messages.json`](examples/config/google-gemini-anthropic-messages.json)).
233
+ The configured client model maps to Gemini's native model name; add a Gemini
234
+ Developer API key to the `gemini` account after starting Agent Smith.
235
+
236
+ ```json
237
+ {
238
+ "providers": {
239
+ "gemini": {
240
+ "strategy": "google-gemini-api",
241
+ "models": {
242
+ "claude-sonnet-*": "gemini-2.5-flash"
243
+ }
244
+ }
245
+ },
246
+ "routing": {
247
+ "routes": {
248
+ "anthropic-messages": [
249
+ "gemini"
250
+ ]
251
+ }
211
252
  }
212
253
  }
213
254
  ```
214
255
 
215
- **An Anthropic-compatible provider choice**
256
+ **An Anthropic-compatible endpoint as fallback**
216
257
  ([`compatible-endpoint-fallback.json`](examples/config/compatible-endpoint-fallback.json)).
217
258
  Requests go to Anthropic first. A wrapped Claude Code session can choose `acme`
218
259
  after Anthropic reports a capacity block; that choice sends Sonnet as
@@ -226,11 +267,18 @@ never moved to `acme` automatically. `acme` serves no other model.
226
267
  "enabled": true,
227
268
  "strategy": "anthropic-api",
228
269
  "base_url": "https://api.acme.example",
229
- "models": { "claude-sonnet-*": "acme-large" }
270
+ "models": {
271
+ "claude-sonnet-*": "acme-large"
272
+ }
230
273
  }
231
274
  },
232
- "provider_pools": {
233
- "anthropic-messages": ["anthropic", "acme"]
275
+ "routing": {
276
+ "routes": {
277
+ "anthropic-messages": [
278
+ "anthropic",
279
+ "acme"
280
+ ]
281
+ }
234
282
  }
235
283
  }
236
284
  ```
@@ -279,8 +327,8 @@ share that organisation's limits, so adding them adds no capacity.
279
327
  - A conversation stays on its account while that account is eligible. Moving
280
328
  provider loses the prompt cache and can change model behaviour and cost.
281
329
  - If no provider in the pool serves the requested model, agent-smith returns
282
- `400` naming `provider_pools.<protocol>`.
283
- - Direct routes, `/v1/<provider>/*`, never use a pool.
330
+ `400`; its current error text refers to `provider_pools.<protocol>`.
331
+ - Direct routes, `/v1/<provider>/*`, do not traverse the ordered provider route; the selected provider’s seat pool still applies.
284
332
 
285
333
  Details: [load balancing](docs/load-balancing.md).
286
334
 
@@ -382,7 +430,7 @@ and [Usage Policy](https://www.anthropic.com/legal/aup), and OpenAI's
382
430
  ```
383
431
 
384
432
  Both examples enable a single sign-in. Putting several sign-ins in one pool
385
- with `team_routing.allowlisted_account_uuids` is the use the quoted terms most
433
+ with `providers.<name>.pool.members` is the use the quoted terms most
386
434
  clearly forbid.
387
435
 
388
436
  ## Advanced use