@aaronjmars/openroutercli 0.11.0 → 0.12.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 +1 -1
- package/SKILL.md +6 -5
- package/package.json +1 -1
- package/src/commands/presets.js +23 -5
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ and run `openrouter login --management`.
|
|
|
71
71
|
| Feature | What it does |
|
|
72
72
|
|---|---|
|
|
73
73
|
| **OAuth PKCE login** | `openrouter login` opens the browser, catches the callback locally, exchanges the code, and stores the key - `0600` perms in `~/.config/openrouter/`. No paste-an-API-key dance. |
|
|
74
|
-
| **Two-slot key management** | User key + management/provisioning key live in separate slots. `keys`, `byok`, `guardrails`, `workspaces`, `observability`, `activity` auto-pick the management key; everything else uses the user key. `--key` always wins. |
|
|
74
|
+
| **Two-slot key management** | User key + management/provisioning key live in separate slots. `keys`, `byok`, `guardrails`, `workspaces`, `observability`, `activity` and `presets create` auto-pick the management key; everything else uses the user key. `--key` always wins. |
|
|
75
75
|
| **Streaming + JSON modes** | Streams in a TTY, switches to JSON when piped or `--json` is set. No global flag plumbing - works on every command. |
|
|
76
76
|
| **Chat with everything** | Tool calls (`--tool @file.json --tool-choice required`), server tools (`--server-tool web_search`), deferred tool loading, structured output (`--schema schema.json`), JSON mode, multimodal images (`--image url\|path`), image output (`--modalities text,image`), reasoning effort, automatic prompt caching (`--cache --cache-ttl 1h`), OpenAI explicit caching (`--cache-ttl 30m|12h`) and free repeat responses (`--response-cache`), alignment rules (`--rule`), provider routing, fallback models, service tiers, sessions and traces, full sampling controls. |
|
|
77
77
|
| **Interactive REPL** | `openrouter chat -i` - slash commands `/model <id>`, `/reset`, `/exit`. History preserved per session. |
|
package/SKILL.md
CHANGED
|
@@ -82,8 +82,8 @@ command automatically.
|
|
|
82
82
|
|
|
83
83
|
| Slot | Used by | How to obtain |
|
|
84
84
|
| --- | --- | --- |
|
|
85
|
-
| **User key** | `chat`, `messages`, `responses`, `embed`, `rerank`, `speech`, `transcribe`, `image`, `video`, `files`, `presets
|
|
86
|
-
| **Management key** | `keys`, `byok`, `guardrails`, `workspaces`, `activity`, `analytics`, `observability`, `org members`, `org settings`, `auth-code` | Dashboard only - <https://openrouter.ai/settings/provisioning-keys>. Cannot be obtained via OAuth. Save with `openrouter login --management`. |
|
|
85
|
+
| **User key** | `chat`, `messages`, `responses`, `embed`, `rerank`, `speech`, `transcribe`, `image`, `video`, `files`, `presets` (read), `generation`, `credits`, `whoami`, `benchmarks`, `classifications`, `datasets`, `decisions`, `extract`, `containers`, `batches`, `tools` | OAuth (`openrouter login`) or paste from dashboard |
|
|
86
|
+
| **Management key** | `keys`, `byok`, `guardrails`, `workspaces`, `activity`, `analytics`, `observability`, `org members`, `org settings`, `auth-code`, `presets create` | Dashboard only - <https://openrouter.ai/settings/provisioning-keys>. Cannot be obtained via OAuth. Save with `openrouter login --management`. |
|
|
87
87
|
|
|
88
88
|
You can store both - they live side by side in the config file. `--key sk-or-...`
|
|
89
89
|
always wins over both. Inference commands prefer the user key; management
|
|
@@ -376,7 +376,7 @@ openrouter byok delete <id>
|
|
|
376
376
|
|
|
377
377
|
The `--api-key` flag is the upstream provider secret (never echoed back).
|
|
378
378
|
|
|
379
|
-
### Files, presets (user key)
|
|
379
|
+
### Files, presets (user key; presets create needs a management key)
|
|
380
380
|
|
|
381
381
|
```bash
|
|
382
382
|
# Files - backing store for file/PDF inputs
|
|
@@ -386,10 +386,11 @@ openrouter files download <file_id> -o report.pdf
|
|
|
386
386
|
openrouter files delete <file_id>
|
|
387
387
|
|
|
388
388
|
# Presets - saved config profiles. Invoke via @preset/<slug> as a model.
|
|
389
|
-
openrouter presets list
|
|
389
|
+
openrouter presets list [--offset N] [--limit N]
|
|
390
390
|
openrouter presets get <slug>
|
|
391
|
-
openrouter presets versions <slug>
|
|
391
|
+
openrouter presets versions <slug> [--offset N] [--limit N]
|
|
392
392
|
openrouter presets create <slug> --api chat --body @preset.json # existing slug = new version
|
|
393
|
+
openrouter presets create <slug> --body @preset.json --workspace <uuid> # into another workspace
|
|
393
394
|
```
|
|
394
395
|
|
|
395
396
|
### Raw escape hatch
|
package/package.json
CHANGED
package/src/commands/presets.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
parseArgs,
|
|
3
|
+
authFromValues,
|
|
4
|
+
loadJson,
|
|
5
|
+
PAGINATION_OPTIONS,
|
|
6
|
+
paginationQuery,
|
|
7
|
+
} from "../args.js";
|
|
2
8
|
import { api } from "../api.js";
|
|
3
9
|
import { outln, printResult, table } from "../output.js";
|
|
4
10
|
|
|
@@ -7,19 +13,24 @@ const HELP = `Usage: openrouter presets <subcommand> [options]
|
|
|
7
13
|
View and create server-saved config presets.
|
|
8
14
|
|
|
9
15
|
Subcommands:
|
|
10
|
-
list
|
|
16
|
+
list [--offset N] [--limit N] List presets (default)
|
|
11
17
|
get <slug> Get a single preset
|
|
12
|
-
versions <slug>
|
|
18
|
+
versions <slug> [--offset N] [--limit N]
|
|
19
|
+
List versions for a preset
|
|
13
20
|
version <slug> <version> Get a specific preset version
|
|
14
21
|
create <slug> --body <json|@file> [--api chat|messages|responses]
|
|
15
22
|
Create a preset from an inference request body.
|
|
16
23
|
An existing slug gets a new version.
|
|
24
|
+
Needs a read-write management key (inference
|
|
25
|
+
keys are rejected).
|
|
17
26
|
|
|
18
27
|
create options:
|
|
19
28
|
--body <json|@file> A normal request body for that API. Only preset fields
|
|
20
29
|
(model, provider, sampling params, ...) are kept;
|
|
21
30
|
messages, input and stream are ignored.
|
|
22
31
|
--api <a> chat (default) | messages | responses
|
|
32
|
+
--workspace <uuid> Workspace to create it in (default: the key's workspace
|
|
33
|
+
for a key limited to one, else the account default)
|
|
23
34
|
|
|
24
35
|
Example:
|
|
25
36
|
openrouter presets create fast-cheap --body '{"model":"openai/gpt-5-nano","temperature":0.2,"provider":{"sort":"price"}}'
|
|
@@ -73,6 +84,7 @@ export async function presetsCommand(argv) {
|
|
|
73
84
|
const { values, positionals } = parseArgs(rest, {
|
|
74
85
|
body: { type: "string" },
|
|
75
86
|
api: { type: "string" },
|
|
87
|
+
workspace: { type: "string" },
|
|
76
88
|
});
|
|
77
89
|
const slug = positionals[0];
|
|
78
90
|
if (!slug) throw new Error("slug required");
|
|
@@ -83,7 +95,9 @@ export async function presetsCommand(argv) {
|
|
|
83
95
|
const body = buildPresetBody(apiName, await loadJson(values.body, "--body"));
|
|
84
96
|
const data = await api("POST", `/presets/${encodeURIComponent(slug)}/${route}`, {
|
|
85
97
|
auth: authFromValues(values),
|
|
98
|
+
requiresManagement: true,
|
|
86
99
|
body,
|
|
100
|
+
query: values.workspace ? { workspace_id: values.workspace } : undefined,
|
|
87
101
|
});
|
|
88
102
|
printResult(data, () => {
|
|
89
103
|
const p = data && (data.data || data);
|
|
@@ -97,10 +111,12 @@ export async function presetsCommand(argv) {
|
|
|
97
111
|
}
|
|
98
112
|
|
|
99
113
|
if (sub === "versions") {
|
|
100
|
-
const { values, positionals } = parseArgs(rest,
|
|
114
|
+
const { values, positionals } = parseArgs(rest, PAGINATION_OPTIONS);
|
|
101
115
|
if (!positionals[0]) throw new Error("slug required");
|
|
116
|
+
const query = paginationQuery(values);
|
|
102
117
|
const data = await api("GET", `/presets/${encodeURIComponent(positionals[0])}/versions`, {
|
|
103
118
|
auth: authFromValues(values),
|
|
119
|
+
query: Object.keys(query).length ? query : undefined,
|
|
104
120
|
});
|
|
105
121
|
printResult(data, () => {
|
|
106
122
|
const rows = data.data || [];
|
|
@@ -126,9 +142,11 @@ export async function presetsCommand(argv) {
|
|
|
126
142
|
}
|
|
127
143
|
|
|
128
144
|
if (sub === "list") {
|
|
129
|
-
const { values } = parseArgs(rest,
|
|
145
|
+
const { values } = parseArgs(rest, PAGINATION_OPTIONS);
|
|
146
|
+
const query = paginationQuery(values);
|
|
130
147
|
const data = await api("GET", "/presets", {
|
|
131
148
|
auth: authFromValues(values),
|
|
149
|
+
query: Object.keys(query).length ? query : undefined,
|
|
132
150
|
});
|
|
133
151
|
printResult(data, () => {
|
|
134
152
|
const rows = data.data || [];
|