omnigateway 0.1.5 → 0.1.7
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 +55 -2
- package/bin/omni.js +709 -325
- package/gateway.js +1028 -264
- package/package.json +1 -1
- package/public/assets/{Chip-Ccqsb_Mq.js → Chip-C69u2U_b.js} +2 -2
- package/public/assets/{CopyValue-CvEMy9Zo.js → CopyValue-CJy2T0H6.js} +1 -1
- package/public/assets/{Field-Devm4K46.js → Field-Sc8mDqJv.js} +1 -1
- package/public/assets/{Lamp-BXSUIAtG.js → Lamp-7jD_9929.js} +2 -2
- package/public/assets/{Meter-Fn8X7t60.js → Meter-C0nUftAa.js} +2 -2
- package/public/assets/{Modal-C4y9zALa.js → Modal-CiVHSJmm.js} +2 -2
- package/public/assets/Rack-CMqGBP4I.js +147 -0
- package/public/assets/{Readout-BKpOZIGX.js → Readout-Dv2dZWtI.js} +4 -4
- package/public/assets/{States-DBzsiHjQ.js → States-D55MhqMx.js} +10 -10
- package/public/assets/{Table-DPDJeeVc.js → Table-DBB3jdgi.js} +1 -1
- package/public/assets/{Toggle-CBq5XAMU.js → Toggle-BoGjb5oi.js} +3 -3
- package/public/assets/_app-p5Mz7sXD.js +1 -0
- package/public/assets/_app.accounts-B5wMO9TH.js +51 -0
- package/public/assets/_app.console-Bka7AkiL.js +25 -0
- package/public/assets/_app.index-MnQuadXb.js +61 -0
- package/public/assets/_app.keys-BX8k8COP.js +39 -0
- package/public/assets/_app.logs-DD-sd4fn.js +33 -0
- package/public/assets/_app.models-CezFNL6y.js +144 -0
- package/public/assets/{_app.settings-Du5Nsp9f.js → _app.settings-D1taAt8B.js} +3 -3
- package/public/assets/{_app.usage-DKq4Hsia.js → _app.usage-BRhEvwVr.js} +28 -28
- package/public/assets/catalog-C_OQ0icG.js +1 -0
- package/public/assets/index-vCuK1fRQ.js +170 -0
- package/public/assets/{login-Gyf-1fSa.js → login-DaC-wVpI.js} +8 -8
- package/public/assets/{queries-BMwc6EvM.js → queries-2E6-CboE.js} +12 -12
- package/public/assets/{trash-2-DFVxurNH.js → trash-2--aH2iKg-.js} +1 -1
- package/public/index.html +2 -2
- package/public/assets/Rack-CRQSwSeB.js +0 -147
- package/public/assets/_app-VCodWes4.js +0 -1
- package/public/assets/_app.accounts-BP3L84us.js +0 -51
- package/public/assets/_app.index-C5Vd-zlp.js +0 -61
- package/public/assets/_app.keys-0e1BHrIZ.js +0 -39
- package/public/assets/_app.logs-DNSND96R.js +0 -33
- package/public/assets/_app.models-DzFIbnem.js +0 -144
- package/public/assets/catalog-DVRPlBJJ.js +0 -1
- package/public/assets/index-BYyeRTQJ.js +0 -170
package/README.md
CHANGED
|
@@ -118,7 +118,7 @@ Everything above is also available in the browser at
|
|
|
118
118
|
| --- | --- | --- |
|
|
119
119
|
| `POST` | `/v1/messages` | Anthropic Messages API |
|
|
120
120
|
| `POST` | `/v1/chat/completions` | OpenAI Chat Completions API |
|
|
121
|
-
| `GET` | `/v1/models` |
|
|
121
|
+
| `GET` | `/v1/models` | Listing in both dialects, filtered by your key's allowlist |
|
|
122
122
|
| `GET` | `/health` | Unauthenticated liveness check |
|
|
123
123
|
|
|
124
124
|
Authenticate with either header — sending both is an error:
|
|
@@ -131,6 +131,27 @@ x-api-key: <gateway-key>
|
|
|
131
131
|
Ask for one of your virtual models by name. A bare provider model
|
|
132
132
|
(`claude-sonnet-5`, `gpt-5`) also works if an account can serve it.
|
|
133
133
|
|
|
134
|
+
`GET /v1/models` answers both client families from one listing: each entry
|
|
135
|
+
carries the OpenAI keys (`object`, `created`, `owned_by`) and the Anthropic ones
|
|
136
|
+
(`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.
|
|
154
|
+
|
|
134
155
|
Most tools that accept a custom base URL work unchanged: set it to
|
|
135
156
|
`http://127.0.0.1:9000` and use a gateway key where the provider key goes.
|
|
136
157
|
|
|
@@ -146,6 +167,7 @@ installation other than the default.
|
|
|
146
167
|
| `omni start` / `stop` / `restart` | run the gateway; `--foreground` attaches it to your terminal |
|
|
147
168
|
| `omni doctor` | which installation it resolved, and whether it can act on it |
|
|
148
169
|
| `omni logs` | recent requests as the gateway recorded them |
|
|
170
|
+
| `omni console` | the gateway process's own output: boot, refreshes, quota, errors |
|
|
149
171
|
| `omni usage` | spend and tokens, by provider, model, key, or day |
|
|
150
172
|
| `omni connect <provider>` | authorize an account from the terminal |
|
|
151
173
|
| `omni credentials …` | list, show, enable, disable, retier, refresh, remove |
|
|
@@ -170,7 +192,7 @@ On a machine with systemd:
|
|
|
170
192
|
```bash
|
|
171
193
|
omni service install --enable # writes a user unit for this installation
|
|
172
194
|
omni start # from here on, start/stop delegate to systemctl
|
|
173
|
-
omni
|
|
195
|
+
omni console # reads the journal (or the log file, without systemd)
|
|
174
196
|
```
|
|
175
197
|
|
|
176
198
|
Use `--system` for a system-wide unit (needs root). Without systemd, `omni
|
|
@@ -190,6 +212,37 @@ Configuration is environment variables, read from the installation's `.env`:
|
|
|
190
212
|
| `OMNI_DB_PATH` | No | `./omnigateway.db` | SQLite database path |
|
|
191
213
|
| `OMNI_BASE_URL` | No | derived from host and port | Public origin for OAuth callbacks; set this behind a reverse proxy |
|
|
192
214
|
| `OMNI_STATIC_DIR` | No | the console shipped with the server | Serve a different console build |
|
|
215
|
+
| `OMNI_LOG_LEVEL` | No | `info` | Stdout threshold: `debug`, `info`, `warn`, or `error` |
|
|
216
|
+
| `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
|
+
|
|
218
|
+
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.
|
|
235
|
+
|
|
236
|
+
`OMNI_LOG_FILE` *names* where output was captured; it does not redirect it. Setting it alone
|
|
237
|
+
leaves the log empty, because the gateway still writes to stdout. Redirect the output and name
|
|
238
|
+
the same path:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
bun apps/gateway/src/index.ts >> /var/log/omni.log 2>&1
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
`omni start` does both for the gateway it supervises, and under systemd the journal needs no
|
|
245
|
+
setup.
|
|
193
246
|
|
|
194
247
|
Routing behaviour — weights, retry limits, request deadline, log retention,
|
|
195
248
|
how often provider quota is polled — lives in the database, not the
|