upres-cli 0.2.0 → 0.3.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 CHANGED
@@ -3,9 +3,11 @@
3
3
  [![npm version](https://img.shields.io/npm/v/upres-cli?style=flat-square)](https://www.npmjs.com/package/upres-cli)
4
4
  [![PyPI version](https://img.shields.io/pypi/v/upres-ai?style=flat-square)](https://pypi.org/project/upres-ai/)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
6
+
7
+ > Star this repo if UpRes helps you.
6
8
  [![GitHub stars](https://img.shields.io/github/stars/auroracapital/upres-cli?style=flat-square)](https://github.com/auroracapital/upres-cli/stargazers)
7
9
 
8
- Official CLI + SDK for **[upres.ai](https://upres.ai)** — AI image and video upscaling. One API, 6 specialist models (Flare, Prism, Lumen, Mirage, Motion, Motion X), up to 8K output.
10
+ Official CLI + SDK for **[upres.ai](https://upres.ai)** — image, video, and speech restoration. One API, 14 public aliases, up to 8K output.
9
11
 
10
12
  ```
11
13
  $ upres upscale photo.jpg --model flare --scale 4
@@ -25,7 +27,7 @@ Result: photo_upscaled.jpg
25
27
  - **Upscayl** is great for one-offs but can't handle bulk exports or CI pipelines
26
28
  - **Every other SaaS upscaler** either watermarks your output, caps resolution at 2K, or charges per image with no monthly plan
27
29
 
28
- upres.ai gives you a clean REST API, 6 specialist models, batch processing, and predictable pricing starting at $9/mo on the Creator launch deal.
30
+ upres.ai gives you a clean REST API, 14 public aliases, batch processing, and predictable pricing starting at $9/mo on the Creator plan.
29
31
 
30
32
  ---
31
33
 
@@ -55,7 +57,7 @@ upres upscale photo.jpg --model flare --scale 4
55
57
 
56
58
  ## Authentication
57
59
 
58
- 1. Sign up at [upres.ai](https://upres.ai) (free — 3 upscales/month)
60
+ 1. Sign up at [upres.ai](https://upres.ai) (free — 5 upscales/month)
59
61
  2. Go to [upres.ai/account/api-keys](https://upres.ai/account/api-keys)
60
62
  3. Generate a key — it's shown once
61
63
 
@@ -150,7 +152,7 @@ The Python SDK uses `httpx` — async-ready, no heavy dependencies.
150
152
  | Example | What it does |
151
153
  |---|---|
152
154
  | [batch-upscale-folder.js](examples/batch-upscale-folder.js) | Upscale all images in a folder with configurable concurrency |
153
- | [restore-photo-folder.py](examples/restore-photo-folder.py) | Restore old/scanned photos using Recraft Crisp Upscale |
155
+ | [restore-photo-folder.py](examples/restore-photo-folder.py) | Restore old/scanned photos with Lumen |
154
156
  | [ecommerce-pipeline.js](examples/ecommerce-pipeline.js) | Product image pipeline: raw shots → 4K → publish-ready |
155
157
  | [lightroom-export-hook.md](examples/lightroom-export-hook.md) | Auto-upscale Lightroom exports via post-processing hook |
156
158
  | [figma-plugin-stub.md](examples/figma-plugin-stub.md) | Figma plugin integration guide |
@@ -159,16 +161,24 @@ The Python SDK uses `httpx` — async-ready, no heavy dependencies.
159
161
 
160
162
  ## Models
161
163
 
162
- 6 specialist models across image and video. Each one tells you up front whether it invents detail or leaves your file alone.
164
+ 14 public aliases across image, video, and speech. Each one tells you up front whether it invents detail or leaves your file alone. Aliases that do not enlarge ignore `--scale`.
163
165
 
164
- | Model | Kind | Best for |
166
+ | Alias | Kind | Best for |
165
167
  |---|---|---|
166
168
  | `flare` | Image | Everyday photos, fastest default |
167
169
  | `prism` | Image | Text, logos, product shots — keeps edges true |
168
170
  | `lumen` | Image | Maximum detail recovery for print, up to 8x |
169
171
  | `mirage` | Image | Invents new detail — art and hero images |
170
- | `motion` | Video | Fast 4K finish for Sora/Kling/Runway clips |
172
+ | `hush` | Image | Faithful denoise, same size as the source |
173
+ | `keen` | Image | Deblur and sharpen, same size |
174
+ | `visage` | Image | Faces only, does not enlarge |
175
+ | `atelier` | Image | Hush, Visage if a portrait, then Lumen |
176
+ | `motion` | Video | Fast 4K finish for AI video |
171
177
  | `motion-x` | Video | Cinema-grade, for film and commercials |
178
+ | `still` | Video | Temporal denoise, resolution stays put |
179
+ | `cadence` | Video | Frame interpolation, does not enlarge |
180
+ | `atelier-x` | Video | Still, then Motion X |
181
+ | `voice` | Speech | Speech denoise to 48 kHz. Not for music |
172
182
 
173
183
  Full model catalogue: [upres.ai/models](https://upres.ai/models) · Live spec: [api.upres.ai/v1/openapi.json](https://api.upres.ai/v1/openapi.json)
174
184
 
@@ -178,11 +188,13 @@ Full model catalogue: [upres.ai/models](https://upres.ai/models) · Live spec: [
178
188
 
179
189
  | Plan | Price | Includes | API | Watermark |
180
190
  |---|---|---|---|---|
181
- | **Free** | $0 | 3 upscales/mo | — | Yes |
182
- | **Creator** | $9/mo (launch deal, was $19) | 50 stills + 20 min 4K video/mo | — | No |
183
- | **Studio** | $39/mo | 250 stills + 90 min 4K video/mo | **Yes** | No |
191
+ | **Free** | $0 | 5 upscales/mo | — | Yes |
192
+ | **Creator** | $9/mo | 50 upscales + 20 videos up to 8K/mo | — | No |
193
+ | **Pro** | $19/mo | 100 upscales + 30 videos up to 8K/mo | — | No |
194
+ | **Studio** | $39/mo | 250 upscales + 90 videos up to 8K/mo | — | No |
195
+ | **Business** | $49/mo | 500 upscales + 150 videos up to 8K/mo | **Yes** | No |
184
196
 
185
- **Studio tier unlocks the full API, batch processing, and no output watermark.**
197
+ **API keys (and so this CLI) need the Business plan.** Every paid plan removes the watermark. On another plan the API answers 403; your key is kept and works again once you are on Business.
186
198
 
187
199
  [Compare plans →](https://upres.ai/pricing) · [vs. Topaz →](https://upres.ai/topaz-alternative) · [vs. Upscayl →](https://upres.ai/compare/upscayl)
188
200
 
@@ -208,7 +220,7 @@ Or in `claude_desktop_config.json` / Cursor:
208
220
  }
209
221
  ```
210
222
 
211
- Tools: `upres_list_models`, `upres_get_credits`, `upres_upscale_image`, `upres_upscale_video`, `upres_get_job`.
223
+ Tools: `upres_list_models`, `upres_get_credits`, `upres_upscale_image`, `upres_upscale_video`, `upres_enhance_audio`, `upres_get_job`.
212
224
 
213
225
  ---
214
226
 
@@ -220,14 +232,17 @@ If you're building something open-source on top of the API, email [support@upres
220
232
 
221
233
  ## Error handling
222
234
 
223
- The SDK handles these errors automatically:
235
+ The SDK throws errors that callers can catch. The CLI prints the error and exits with a nonzero status.
224
236
 
225
- | Status | Behavior |
237
+ | Status | SDK behavior |
226
238
  |---|---|
227
- | `401` | Prints API key error + link to key management, exits |
228
- | `402` | Prints quota exceeded + link to pricing, exits |
229
- | `429` | Prints rate limit message (60 req/min), exits |
230
- | `5xx` | Throws `UpresError` with message |
239
+ | `401` | Throws `UpresError` with API key guidance |
240
+ | `402` | Throws `UpresError` with quota and pricing information |
241
+ | `403` | Throws `UpresError` with plan information |
242
+ | `429` | Throws `UpresError` with rate limit information |
243
+ | `5xx` | Throws an error with the API message |
244
+
245
+ `UpresError.status` contains the HTTP status code.
231
246
 
232
247
  In Python: raises `AuthError`, `QuotaExceededError`, or `UpresError`.
233
248
 
package/dist/cli.cjs CHANGED
@@ -6,8 +6,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __esm = (fn, res) => function __init() {
10
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ var __esm = (fn, res, err) => function __init() {
10
+ if (err) throw err[0];
11
+ try {
12
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ } catch (e) {
14
+ throw err = [e], e;
15
+ }
11
16
  };
12
17
  var __export = (target, all) => {
13
18
  for (var name in all)
@@ -31,88 +36,59 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
36
  ));
32
37
 
33
38
  // src/models.ts
34
- var MODELS, IMAGE_MODELS, VIDEO_MODELS, DEFAULT_IMAGE_MODEL, DEFAULT_VIDEO_MODEL;
39
+ function scaleParam(maxScale) {
40
+ if (maxScale <= 1) return [];
41
+ const options = [];
42
+ for (let step = 2; step <= maxScale; step *= 2) options.push(step);
43
+ return [
44
+ {
45
+ name: "scale",
46
+ type: "integer",
47
+ required: false,
48
+ default: 4,
49
+ options,
50
+ description: "Scale multiplier. Ignored when the alias does not enlarge."
51
+ }
52
+ ];
53
+ }
54
+ function model(id, name, description, category, inputTypes, maxScale) {
55
+ const fileParam = category.startsWith("video") ? { name: "video", type: "string", required: true, description: "Video URL or file" } : category.startsWith("audio") ? { name: "audio", type: "string", required: true, description: "Audio URL or file" } : { name: "image", type: "string", required: true, description: "Image URL or file" };
56
+ return {
57
+ id,
58
+ name,
59
+ description,
60
+ category,
61
+ price: "One credit per stage that runs",
62
+ inputTypes,
63
+ params: [fileParam, ...scaleParam(maxScale)]
64
+ };
65
+ }
66
+ var MODELS, IMAGE_MODELS, VIDEO_MODELS, AUDIO_MODELS, DEFAULT_IMAGE_MODEL, DEFAULT_VIDEO_MODEL, DEFAULT_AUDIO_MODEL;
35
67
  var init_models = __esm({
36
68
  "src/models.ts"() {
37
69
  "use strict";
38
70
  MODELS = [
39
- {
40
- id: "flare",
41
- name: "Flare",
42
- description: "Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.",
43
- category: "image-upscale",
44
- price: "Included in plan quota",
45
- inputTypes: ["image/*"],
46
- params: [
47
- { name: "image", type: "string", required: true, description: "Image URL or file" },
48
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
49
- ]
50
- },
51
- {
52
- id: "prism",
53
- name: "Prism",
54
- description: "Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.",
55
- category: "image-upscale",
56
- price: "Included in plan quota",
57
- inputTypes: ["image/*"],
58
- params: [
59
- { name: "image", type: "string", required: true, description: "Image URL or file" },
60
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
61
- ]
62
- },
63
- {
64
- id: "lumen",
65
- name: "Lumen",
66
- description: "Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.",
67
- category: "image-upscale",
68
- price: "Included in plan quota",
69
- inputTypes: ["image/*"],
70
- params: [
71
- { name: "image", type: "string", required: true, description: "Image URL or file" },
72
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4, 8], description: "Scale multiplier" }
73
- ]
74
- },
75
- {
76
- id: "mirage",
77
- name: "Mirage",
78
- description: "Invents plausible new detail rather than recovering what was there. Most dramatic, least faithful. Good for art, wrong for documents.",
79
- category: "image-enhance",
80
- price: "Included in plan quota",
81
- inputTypes: ["image/*"],
82
- params: [
83
- { name: "image", type: "string", required: true, description: "Image URL or file" },
84
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4, 8], description: "Scale multiplier" }
85
- ]
86
- },
87
- {
88
- id: "motion",
89
- name: "Motion",
90
- description: "Fast 4K finish for AI-generated video (Sora, Kling, Runway). Frame-consistent, does not invent faces.",
91
- category: "video-upscale",
92
- price: "Counts against monthly video minutes",
93
- inputTypes: ["video/*"],
94
- params: [
95
- { name: "video", type: "string", required: true, description: "Video URL or file" },
96
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
97
- ]
98
- },
99
- {
100
- id: "motion-x",
101
- name: "Motion X",
102
- description: "Cinema-grade video upscale for film and commercials. Noticeably slower and dearer per second than Motion.",
103
- category: "video-upscale",
104
- price: "Counts against monthly video minutes",
105
- inputTypes: ["video/*"],
106
- params: [
107
- { name: "video", type: "string", required: true, description: "Video URL or file" },
108
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
109
- ]
110
- }
71
+ model("flare", "Flare", "Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.", "image-upscale", ["image/*"], 4),
72
+ model("prism", "Prism", "Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.", "image-upscale", ["image/*"], 4),
73
+ model("lumen", "Lumen", "Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.", "image-upscale", ["image/*"], 8),
74
+ model("mirage", "Mirage", "Invents plausible new detail rather than recovering what was there. Good for art, wrong for documents.", "image-upscale", ["image/*"], 8),
75
+ model("hush", "Hush", "Faithful denoise. Same size as the source, nothing invented.", "image-clean", ["image/*"], 1),
76
+ model("keen", "Keen", "Deblur and sharpen. Same size as the source, does not invent texture.", "image-restore", ["image/*"], 1),
77
+ model("visage", "Visage", "Restores faces and leaves the rest of the frame alone. Does not enlarge.", "image-restore", ["image/*"], 1),
78
+ model("atelier", "Atelier", "Hush, then Visage if the photo looks like a portrait, then Lumen. A skipped face stage is free.", "image-studio", ["image/*"], 8),
79
+ model("motion", "Motion", "Fast 4K finish for AI-generated video. Frame-consistent, does not invent faces.", "video-upscale", ["video/*"], 4),
80
+ model("motion-x", "Motion X", "Cinema-grade video upscale. Noticeably slower and dearer per second than Motion.", "video-upscale", ["video/*"], 4),
81
+ model("still", "Still", "Temporal video denoise. Resolution stays put.", "video-clean", ["video/*"], 1),
82
+ model("cadence", "Cadence", "Frame interpolation. Does not enlarge the picture.", "video-restore", ["video/*"], 1),
83
+ model("atelier-x", "Atelier X", "Still, then Motion X. Two credits.", "video-studio", ["video/*"], 4),
84
+ model("voice", "Voice", "Speech denoise and bandwidth extension to 48 kHz. Not for music.", "audio-clean", ["audio/*"], 1)
111
85
  ];
112
- IMAGE_MODELS = MODELS.filter((m) => m.category !== "video-upscale");
113
- VIDEO_MODELS = MODELS.filter((m) => m.category === "video-upscale");
86
+ IMAGE_MODELS = MODELS.filter((m) => m.category.startsWith("image"));
87
+ VIDEO_MODELS = MODELS.filter((m) => m.category.startsWith("video"));
88
+ AUDIO_MODELS = MODELS.filter((m) => m.category.startsWith("audio"));
114
89
  DEFAULT_IMAGE_MODEL = "flare";
115
90
  DEFAULT_VIDEO_MODEL = "motion";
91
+ DEFAULT_AUDIO_MODEL = "voice";
116
92
  }
117
93
  });
118
94
 
@@ -196,6 +172,15 @@ async function callTool(name, args) {
196
172
  });
197
173
  return text(job);
198
174
  }
175
+ case "upres_enhance_audio": {
176
+ const audio_url = String(args.audio_url ?? "");
177
+ if (!audio_url) throw new Error("audio_url is required");
178
+ const job = await api("POST", "/jobs", {
179
+ image_url: audio_url,
180
+ model: args.model ?? "voice"
181
+ });
182
+ return text(job);
183
+ }
199
184
  case "upres_get_job": {
200
185
  const job_id = String(args.job_id ?? "");
201
186
  if (!job_id) throw new Error("job_id is required");
@@ -266,12 +251,12 @@ var init_mcp = __esm({
266
251
  "src/mcp.ts"() {
267
252
  "use strict";
268
253
  init_models();
269
- VERSION = "0.2.0";
254
+ VERSION = "0.3.0";
270
255
  DEFAULT_BASE_URL2 = "https://api.upres.ai/v1";
271
256
  TOOLS = [
272
257
  {
273
258
  name: "upres_list_models",
274
- description: "List UpRes upscale models (flare, prism, lumen, mirage, motion, motion-x) with use cases.",
259
+ description: "List the 14 public UpRes aliases for image, video, and speech.",
275
260
  inputSchema: { type: "object", properties: {}, additionalProperties: false }
276
261
  },
277
262
  {
@@ -281,17 +266,17 @@ var init_mcp = __esm({
281
266
  },
282
267
  {
283
268
  name: "upres_upscale_image",
284
- description: "Submit an image upscale job from a public URL. Models: flare, prism, lumen, mirage.",
269
+ description: "Submit an image job from a public URL. Upscale: flare, prism, lumen, mirage. Restore: hush, keen, visage, atelier. Scale is ignored when the alias does not enlarge.",
285
270
  inputSchema: {
286
271
  type: "object",
287
272
  properties: {
288
273
  image_url: { type: "string", description: "Public HTTPS URL of the image" },
289
274
  model: {
290
275
  type: "string",
291
- enum: ["flare", "prism", "lumen", "mirage"],
292
- description: "Image model. Default flare."
276
+ enum: IMAGE_MODELS.map((m) => m.id),
277
+ description: "Image alias. Default flare."
293
278
  },
294
- scale: { type: "integer", enum: [2, 4, 8], description: "Scale multiplier. Default 4." }
279
+ scale: { type: "integer", enum: [2, 4, 8], description: "Scale multiplier. Default 4. Ignored for hush, keen, and visage." }
295
280
  },
296
281
  required: ["image_url"],
297
282
  additionalProperties: false
@@ -299,22 +284,39 @@ var init_mcp = __esm({
299
284
  },
300
285
  {
301
286
  name: "upres_upscale_video",
302
- description: "Submit a video upscale job from a public URL. Models: motion, motion-x.",
287
+ description: "Submit a video job from a public URL. motion and motion-x upscale. still denoises, cadence interpolates frames, atelier-x runs still then motion-x.",
303
288
  inputSchema: {
304
289
  type: "object",
305
290
  properties: {
306
291
  video_url: { type: "string", description: "Public HTTPS URL of the video" },
307
292
  model: {
308
293
  type: "string",
309
- enum: ["motion", "motion-x"],
310
- description: "Video model. Default motion."
294
+ enum: VIDEO_MODELS.map((m) => m.id),
295
+ description: "Video alias. Default motion."
311
296
  },
312
- scale: { type: "integer", enum: [2, 4], description: "Scale multiplier. Default 4." }
297
+ scale: { type: "integer", enum: [2, 4], description: "Scale multiplier. Default 4. Ignored for still and cadence." }
313
298
  },
314
299
  required: ["video_url"],
315
300
  additionalProperties: false
316
301
  }
317
302
  },
303
+ {
304
+ name: "upres_enhance_audio",
305
+ description: "Submit a speech job from a public URL. voice denoises speech and extends it to 48 kHz. Music is not supported.",
306
+ inputSchema: {
307
+ type: "object",
308
+ properties: {
309
+ audio_url: { type: "string", description: "Public HTTPS URL of wav, mp3, m4a, or flac speech" },
310
+ model: {
311
+ type: "string",
312
+ enum: AUDIO_MODELS.map((m) => m.id),
313
+ description: "Audio alias. Default voice."
314
+ }
315
+ },
316
+ required: ["audio_url"],
317
+ additionalProperties: false
318
+ }
319
+ },
318
320
  {
319
321
  name: "upres_get_job",
320
322
  description: "Get status and result_url of an UpRes job by id.",
@@ -355,13 +357,20 @@ function loadConfigFile() {
355
357
  function resolveApiKey(override) {
356
358
  const key = override ?? process.env.UPRES_API_KEY ?? loadConfigFile().apiKey;
357
359
  if (!key) {
358
- console.error(
359
- "Error: No API key found.\n Set UPRES_API_KEY env var, pass --api-key, or save to ~/.config/upres/config.json\n Get a key at https://upres.ai/account/api-keys"
360
+ throw new Error(
361
+ "No API key found.\n Set UPRES_API_KEY env var, pass --api-key, or save to ~/.config/upres/config.json\n Get a key at https://upres.ai/account/api-keys"
360
362
  );
361
- process.exit(1);
362
363
  }
363
364
  return key;
364
365
  }
366
+ var UpresError = class extends Error {
367
+ constructor(message, status) {
368
+ super(message);
369
+ this.status = status;
370
+ this.name = "UpresError";
371
+ }
372
+ status;
373
+ };
365
374
  var UpresClient = class {
366
375
  apiKey;
367
376
  baseUrl;
@@ -382,19 +391,24 @@ var UpresClient = class {
382
391
  if (!res.ok) {
383
392
  const err = await res.json().catch(() => ({ error: `HTTP ${res.status}` }));
384
393
  if (res.status === 401) {
385
- console.error(`Error: Invalid API key. Get a new key at https://upres.ai/account/api-keys`);
386
- process.exit(1);
394
+ throw new UpresError(`Invalid API key. Get a new key at https://upres.ai/account/api-keys`, res.status);
387
395
  }
388
396
  if (res.status === 402) {
389
- console.error(
390
- `Error: Monthly quota exceeded (used ${err.used ?? "?"}/${err.quota ?? "?"}).
391
- Upgrade to Studio at https://upres.ai/pricing`
397
+ throw new UpresError(
398
+ `Monthly quota exceeded (used ${err.used ?? "?"}/${err.quota ?? "?"}).
399
+ Upgrade your plan at https://upres.ai/pricing`,
400
+ res.status
401
+ );
402
+ }
403
+ if (res.status === 403) {
404
+ throw new UpresError(
405
+ `${err.error ?? "API access requires the Business plan."}
406
+ Your key is kept and works again on Business: https://upres.ai/pricing`,
407
+ res.status
392
408
  );
393
- process.exit(1);
394
409
  }
395
410
  if (res.status === 429) {
396
- console.error(`Error: Rate limit exceeded (60 req/min). Wait a moment and retry.`);
397
- process.exit(1);
411
+ throw new UpresError(`Rate limit exceeded (60 req/min). Wait a moment and retry.`, res.status);
398
412
  }
399
413
  throw new Error(err.error ?? `HTTP ${res.status}`);
400
414
  }
@@ -497,7 +511,7 @@ var UpresClient = class {
497
511
 
498
512
  // src/cli.ts
499
513
  init_models();
500
- var VERSION2 = "0.2.0";
514
+ var VERSION2 = "0.3.0";
501
515
  function parseArgs(argv) {
502
516
  const args = [];
503
517
  const flags = {};
@@ -538,7 +552,7 @@ COMMANDS
538
552
  version Print version
539
553
 
540
554
  OPTIONS
541
- --model <id> Model ID (default: flare for images, motion for video)
555
+ --model <id> Public alias (default: flare, motion for video, voice for speech)
542
556
  --scale <n> Scale factor 2-8 (default: 4)
543
557
  --output <path> Output file or directory
544
558
  --api-key <key> API key (or set UPRES_API_KEY env var)
@@ -559,14 +573,16 @@ EXAMPLES
559
573
  upres account
560
574
 
561
575
  API KEY
562
- 1. Get a Studio key at https://upres.ai/account/api-keys
576
+ 1. Get a key on the Business plan at https://upres.ai/account/api-keys
563
577
  2. Export: UPRES_API_KEY=upres_yourkey
564
578
  3. Or save: echo '{"apiKey":"upres_yourkey"}' > ~/.config/upres/config.json
565
579
 
566
580
  PRICING
567
- Free: 3 upscales/month
568
- Creator: $9/month \u2014 50 stills + 20 min 4K video
569
- Studio: $39/month \u2014 250 stills + 90 min 4K video + API
581
+ Free: 5 upscales/month
582
+ Creator: $9/month \u2014 50 upscales + 20 videos up to 8K
583
+ Pro: $19/month \u2014 100 upscales + 30 videos up to 8K
584
+ Studio: $39/month \u2014 250 upscales + 90 videos up to 8K
585
+ Business: $49/month \u2014 500 upscales + 150 videos up to 8K + API
570
586
 
571
587
  https://upres.ai/pricing
572
588
  `);
@@ -580,6 +596,8 @@ function resolveModel(modelArg, filePath) {
580
596
  }
581
597
  const ext = import_node_path2.default.extname(filePath).toLowerCase();
582
598
  const videoExts = [".mp4", ".mov", ".avi", ".mkv", ".webm", ".gif"];
599
+ const audioExts = [".wav", ".mp3", ".m4a", ".flac"];
600
+ if (audioExts.includes(ext)) return DEFAULT_AUDIO_MODEL;
583
601
  return videoExts.includes(ext) ? DEFAULT_VIDEO_MODEL : DEFAULT_IMAGE_MODEL;
584
602
  }
585
603
  function resolveOutputPath(input, outputDir) {
@@ -600,7 +618,7 @@ async function cmdUpscale(args, flags) {
600
618
  process.exit(1);
601
619
  }
602
620
  const client = new UpresClient({ apiKey: flags["api-key"] });
603
- const model = resolveModel(flags.model, input);
621
+ const model2 = resolveModel(flags.model, input);
604
622
  const scale = flags.scale ? Number(flags.scale) : 4;
605
623
  const resolution = flags.resolution ?? "4k";
606
624
  const outputPath = flags.output;
@@ -611,9 +629,9 @@ async function cmdUpscale(args, flags) {
611
629
  console.error(`Error: File not found: ${input}`);
612
630
  process.exit(1);
613
631
  }
614
- process.stdout.write(`Submitting job... model=${model}
632
+ process.stdout.write(`Submitting job... model=${model2}
615
633
  `);
616
- let job = isFile ? await client.createJobFromFile(input, { model, scale }) : await client.createJobFromUrl(input, { model, scale });
634
+ let job = isFile ? await client.createJobFromFile(input, { model: model2, scale }) : await client.createJobFromUrl(input, { model: model2, scale });
617
635
  console.log(`Job created: ${job.id} (status: ${job.status})`);
618
636
  if (noWait) {
619
637
  console.log(`Run "upres jobs" to check status.`);
@@ -652,17 +670,18 @@ async function cmdBatch(args, flags) {
652
670
  process.exit(1);
653
671
  }
654
672
  const outputDir = flags.output ?? import_node_path2.default.join(dir, "upscaled");
655
- const model = resolveModel(flags.model, files[0]);
673
+ const model2 = resolveModel(flags.model, files[0]);
656
674
  const scale = flags.scale ? Number(flags.scale) : 4;
657
675
  const concurrency = flags.concurrency ? Number(flags.concurrency) : 3;
658
- console.log(`Batch upscaling ${files.length} images with ${model} (concurrency: ${concurrency})`);
676
+ console.log(`Batch upscaling ${files.length} images with ${model2} (concurrency: ${concurrency})`);
659
677
  const client = new UpresClient({ apiKey: flags["api-key"] });
660
678
  let done = 0;
661
679
  let failed = 0;
680
+ let accountError = false;
662
681
  async function processFile(filePath) {
663
682
  const filename = import_node_path2.default.basename(filePath);
664
683
  try {
665
- const job = await client.createJobFromFile(filePath, { model, scale });
684
+ const job = await client.createJobFromFile(filePath, { model: model2, scale });
666
685
  const completed = await client.waitForJob(job.id);
667
686
  if (completed.status === "failed") {
668
687
  console.error(` FAILED ${filename}: ${completed.error}`);
@@ -676,21 +695,34 @@ async function cmdBatch(args, flags) {
676
695
  } catch (e) {
677
696
  console.error(` ERROR ${filename}: ${e.message}`);
678
697
  failed++;
698
+ if (e instanceof UpresError) accountError = true;
679
699
  }
680
700
  }
681
701
  for (let i = 0; i < files.length; i += concurrency) {
682
702
  const chunk = files.slice(i, i + concurrency);
683
703
  await Promise.all(chunk.map(processFile));
704
+ if (accountError) break;
684
705
  }
685
706
  console.log(`
686
707
  Done: ${done} succeeded, ${failed} failed. Output: ${outputDir}`);
708
+ if (failed > 0) process.exitCode = 1;
687
709
  }
710
+ var CATEGORY_LABEL = {
711
+ "image-upscale": "Image Upscale",
712
+ "image-clean": "Image Clean",
713
+ "image-restore": "Image Restore",
714
+ "image-studio": "Image Studio",
715
+ "video-upscale": "Video Upscale",
716
+ "video-clean": "Video Clean",
717
+ "video-restore": "Video Restore",
718
+ "video-studio": "Video Studio",
719
+ "audio-clean": "Speech"
720
+ };
688
721
  function cmdModels() {
689
- const categories = ["image-upscale", "image-enhance", "video-upscale"];
722
+ const categories = [...new Set(MODELS.map((m) => m.category))];
690
723
  for (const cat of categories) {
691
- const label = { "image-upscale": "Image Upscale", "image-enhance": "Image Enhance", "video-upscale": "Video Upscale" }[cat];
692
724
  console.log(`
693
- ${label}`);
725
+ ${CATEGORY_LABEL[cat] ?? cat}`);
694
726
  console.log("\u2500".repeat(60));
695
727
  for (const m of MODELS.filter((x) => x.category === cat)) {
696
728
  console.log(` ${m.id.padEnd(44)} ${m.price}`);
@@ -737,6 +769,7 @@ Account info (based on recent jobs)`);
737
769
  console.log(` API keys: https://upres.ai/account/api-keys`);
738
770
  } catch (e) {
739
771
  console.error(e.message);
772
+ process.exitCode = 1;
740
773
  }
741
774
  }
742
775
  async function main() {