omnigateway 0.1.8 → 0.2.1
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 +27 -33
- package/bin/omni.js +1133 -305
- package/gateway.js +3632 -543
- package/package.json +1 -1
- package/public/assets/{Chip-CM9ZMdr9.js → Chip-C4X8tf5z.js} +1 -1
- package/public/assets/Confirm-BnmH8Gn0.js +4 -0
- package/public/assets/{CopyValue-WrOTcHwq.js → CopyValue-B-uR4Js-.js} +5 -5
- package/public/assets/{Field-Br6jKPz8.js → Field-Ct4SeDZD.js} +2 -2
- package/public/assets/Lamp-CBOwqG5K.js +25 -0
- package/public/assets/{Meter-BzMaum0C.js → Meter-COdz0dwY.js} +1 -1
- package/public/assets/Modal-DMFUHQ-A.js +82 -0
- package/public/assets/{Rack-BFWC50ex.js → Rack-DAbY9x1I.js} +23 -19
- package/public/assets/{Readout-DMJs4gYD.js → Readout-Bl2kD9Tl.js} +6 -2
- package/public/assets/{States-BNeCLhZn.js → States-D5Memn8D.js} +4 -4
- package/public/assets/{Table-nOg_lgEJ.js → Table-DObRatbW.js} +1 -1
- package/public/assets/Toggle-Dkjlvck5.js +39 -0
- package/public/assets/TokenBreakdown-oXP49ZTa.js +31 -0
- package/public/assets/_app-Brc2wQZm.js +1 -0
- package/public/assets/_app.accounts-I9RXUiyi.js +54 -0
- package/public/assets/_app.console-BVVpryIB.js +44 -0
- package/public/assets/_app.index-83Ig4FUL.js +62 -0
- package/public/assets/_app.keys-KeP6L4g_.js +39 -0
- package/public/assets/_app.logs-B5oh01Ls.js +32 -0
- package/public/assets/_app.models-BuOFMZUN.js +144 -0
- package/public/assets/_app.settings-BN436vI2.js +38 -0
- package/public/assets/_app.usage-C528VOia.js +166 -0
- package/public/assets/catalog-kJ53n_fc.js +1 -0
- package/public/assets/dist-CnzT-Ut2.js +1 -0
- package/public/assets/index-CE-KQ-ju.js +172 -0
- package/public/assets/{login-BpUl6C5b.js → login-2LpCZOtB.js} +8 -8
- package/public/assets/queries-1zRLkX-Q.js +144 -0
- package/public/assets/{trash-2-DjWP2u19.js → trash-2-Da6cLgPn.js} +1 -1
- package/public/index.html +2 -2
- package/public/assets/Lamp-DO-sRDg2.js +0 -25
- package/public/assets/Modal-lhjr949H.js +0 -82
- package/public/assets/Toggle-DYoCVD37.js +0 -42
- package/public/assets/_app-lXr06Xli.js +0 -1
- package/public/assets/_app.accounts-BTb5vHI_.js +0 -51
- package/public/assets/_app.console-DHUClMsI.js +0 -25
- package/public/assets/_app.index-DZ--9mKU.js +0 -61
- package/public/assets/_app.keys-B-cy-2DS.js +0 -39
- package/public/assets/_app.logs-BQjAIT2P.js +0 -33
- package/public/assets/_app.models-BAmXHlf2.js +0 -144
- package/public/assets/_app.settings-CG8bv_rm.js +0 -34
- package/public/assets/_app.usage-BLrQ2hB8.js +0 -163
- package/public/assets/catalog-C_OQ0icG.js +0 -1
- package/public/assets/index-UAZ0O5y0.js +0 -170
- package/public/assets/queries-D_-Jj9vt.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.
|
|
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.
|
|
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
|