omnigateway 0.1.7 → 0.2.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.
Files changed (44) hide show
  1. package/README.md +27 -33
  2. package/bin/omni.js +917 -161
  3. package/gateway.js +3247 -300
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-C69u2U_b.js → Chip-BB_5C1Zp.js} +1 -1
  6. package/public/assets/Confirm-B6aAiVbT.js +4 -0
  7. package/public/assets/{CopyValue-CJy2T0H6.js → CopyValue-CRQDLo7k.js} +4 -4
  8. package/public/assets/{Field-Sc8mDqJv.js → Field-uHZxl4fI.js} +8 -8
  9. package/public/assets/Lamp-B-5SjXbG.js +25 -0
  10. package/public/assets/{Meter-C0nUftAa.js → Meter-DI_BRUKt.js} +1 -1
  11. package/public/assets/Modal-CI6jk2D4.js +82 -0
  12. package/public/assets/{Rack-CMqGBP4I.js → Rack-D1WJswv3.js} +23 -19
  13. package/public/assets/{Readout-Dv2dZWtI.js → Readout-BocZ2HXP.js} +5 -5
  14. package/public/assets/{States-D55MhqMx.js → States-Bbiu5cHE.js} +10 -10
  15. package/public/assets/{Table-DBB3jdgi.js → Table-CdPWxYaz.js} +1 -1
  16. package/public/assets/Toggle-CiLC67Dw.js +39 -0
  17. package/public/assets/TokenBreakdown-B96iPBm9.js +28 -0
  18. package/public/assets/_app-BBOF6A0T.js +1 -0
  19. package/public/assets/_app.accounts-BNkhpvaB.js +54 -0
  20. package/public/assets/_app.console-Daz4aKhf.js +44 -0
  21. package/public/assets/_app.index-LO6d38oe.js +62 -0
  22. package/public/assets/{_app.keys-BX8k8COP.js → _app.keys-kBqLqoFf.js} +8 -8
  23. package/public/assets/_app.logs-_wYNS47N.js +32 -0
  24. package/public/assets/_app.models-Cjng8ohC.js +144 -0
  25. package/public/assets/_app.settings-a0FKyQAi.js +38 -0
  26. package/public/assets/{_app.usage-BRhEvwVr.js → _app.usage-D3KtgLrC.js} +32 -29
  27. package/public/assets/dist-C-IbPRiV.js +1 -0
  28. package/public/assets/index-PW6EvVh5.js +170 -0
  29. package/public/assets/{login-DaC-wVpI.js → login-CTvH_KAd.js} +8 -8
  30. package/public/assets/queries-D2o-X8Pj.js +144 -0
  31. package/public/assets/{trash-2--aH2iKg-.js → trash-2-BcZb-sCT.js} +1 -1
  32. package/public/index.html +2 -2
  33. package/public/assets/Lamp-7jD_9929.js +0 -25
  34. package/public/assets/Modal-CiVHSJmm.js +0 -82
  35. package/public/assets/Toggle-BoGjb5oi.js +0 -42
  36. package/public/assets/_app-p5Mz7sXD.js +0 -1
  37. package/public/assets/_app.accounts-B5wMO9TH.js +0 -51
  38. package/public/assets/_app.console-Bka7AkiL.js +0 -25
  39. package/public/assets/_app.index-MnQuadXb.js +0 -61
  40. package/public/assets/_app.logs-DD-sd4fn.js +0 -33
  41. package/public/assets/_app.models-CezFNL6y.js +0 -144
  42. package/public/assets/_app.settings-D1taAt8B.js +0 -16
  43. package/public/assets/index-vCuK1fRQ.js +0 -170
  44. package/public/assets/queries-2E6-CboE.js +0 -144
package/README.md CHANGED
@@ -24,6 +24,9 @@ omni start
24
24
  - **Speaks both dialects.** `POST /v1/messages` (Anthropic) and
25
25
  `POST /v1/chat/completions` (OpenAI), including streaming, translated to
26
26
  whichever provider actually serves the request.
27
+ - **Filters bulky tool history, optionally.** Built-in RTK filters shorten
28
+ eligible large or repetitive shell and recognizable command output before
29
+ provider dispatch, preserve errors and non-tool-result content, and default off.
27
30
  - **Routes across your accounts.** Define a virtual model like `fast` or
28
31
  `smart` with several targets; the gateway ranks them by tier, health,
29
32
  remaining quota, cost, and latency.
@@ -118,6 +121,7 @@ Everything above is also available in the browser at
118
121
  | --- | --- | --- |
119
122
  | `POST` | `/v1/messages` | Anthropic Messages API |
120
123
  | `POST` | `/v1/chat/completions` | OpenAI Chat Completions API |
124
+ | `POST` | `/v1/messages/count_tokens` | Anthropic-compatible local token estimation (authenticated) |
121
125
  | `GET` | `/v1/models` | Listing in both dialects, filtered by your key's allowlist |
122
126
  | `GET` | `/health` | Unauthenticated liveness check |
123
127
 
@@ -134,27 +138,32 @@ Ask for one of your virtual models by name. A bare provider model
134
138
  `GET /v1/models` answers both client families from one listing: each entry
135
139
  carries the OpenAI keys (`object`, `created`, `owned_by`) and the Anthropic ones
136
140
  (`type`, `display_name`, `created_at`, `max_input_tokens`, `max_tokens`) at
137
- once. `max_input_tokens` is the one worth knowing about — a client that is told
138
- no context window assumes its own default, which is 200K whatever the model
139
- really holds, so a 1M-context target would be used as if it were a fifth of its
140
- size. The figure is the smallest window any of that model's targets can hold,
141
- because failover can land on any of them.
142
-
143
- A client reads these figures once, when it starts, and caches them — so
144
- raising a limit here can take a client restart to show up.
145
-
146
- The figures come from the published limits for the model each target names, and
147
- from how the credential that would serve it signs in: an OpenAI account
148
- connected by OAuth is served through the Codex backend, which takes a 272,000
149
- token prompt where the API takes 922,000, so a gateway with both kinds of
150
- OpenAI credential advertises the smaller. Leave the fields in the console (or
151
- the CLI) empty to keep that worked out for you, and fill them in per target only
152
- when your own account's limits differ. A model outside the built-in catalog with
153
- nothing stated is left undescribed, and its clients keep their own defaults.
141
+ once.
154
142
 
155
143
  Most tools that accept a custom base URL work unchanged: set it to
156
144
  `http://127.0.0.1:9000` and use a gateway key where the provider key goes.
157
145
 
146
+ ### Tools and routing
147
+
148
+ Two kinds of tool behave differently, and the difference decides where a
149
+ request can go.
150
+
151
+ A **custom tool** — a name, a description, and a JSON Schema — is portable. It
152
+ translates to every provider, so a request using one routes across your whole
153
+ pool as usual.
154
+
155
+ An **Anthropic-defined tool** — web search, web fetch, code execution, Bash,
156
+ text editor, computer use, memory, tool search, advisor, or an MCP toolset —
157
+ has a schema Anthropic owns. No other provider can express it, so any request
158
+ declaring one, *or replaying the blocks a previous one produced*, is routed to
159
+ an Anthropic account only. If the virtual model you asked for has no Anthropic
160
+ target, the request fails at routing with the unsupported requirement named,
161
+ rather than quietly losing the tool.
162
+
163
+ The gateway forwards the tool version you send and never upgrades it. Betas
164
+ stay yours: send `anthropic-beta` yourself, as the tool requires — the gateway
165
+ carries the header through but does not add one on your behalf.
166
+
158
167
  ## The CLI
159
168
 
160
169
  `omni --help` lists everything; `omni <command> --help` explains one. Every
@@ -216,22 +225,7 @@ Configuration is environment variables, read from the installation's `.env`:
216
225
  | `OMNI_LOG_FILE` | No | the systemd journal, when there is one | Where stdout was already redirected, so the Console screen can read it back. Names a file; does not create one |
217
226
 
218
227
  Gateway events are written to stdout as one greppable line each: process lifecycle, OAuth
219
- refreshes, quota probes, failover, and errors. Completed requests are *not* among them — they
220
- are recorded in the database and read back through `omni logs` and the console's Logs screen.
221
- Use `debug` to add routing decisions, per-attempt tracing, and upstream HTTP timing:
222
-
223
- ```text
224
- 2026-08-09T04:12:04.881Z WARN attempt failed; retrying requestId=req_9f2 provider=anthropic attempt=1 code=UPSTREAM retryable=true
225
- ```
226
-
227
- Fields are a closed allowlist: logs never include request or response bodies, headers, OAuth
228
- tokens, API keys, admin passwords, or encryption keys. `OMNI_LOG_LEVEL` is read once at boot;
229
- an invalid value falls back to `info` and is reported in the boot log.
230
-
231
- The Console screen and `omni console` show these lines. A process cannot read back its own
232
- stdout, so both read whatever captured it: `OMNI_LOG_FILE` if set, otherwise the systemd
233
- journal. Run the gateway in the foreground and its output goes to your terminal, where nothing
234
- captured it — both surfaces say so rather than showing an empty log.
228
+ refreshes, quota probes, failover, and errors.
235
229
 
236
230
  `OMNI_LOG_FILE` *names* where output was captured; it does not redirect it. Setting it alone
237
231
  leaves the log empty, because the gateway still writes to stdout. Redirect the output and name