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/dist/mcp.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/models.ts","../src/mcp.ts"],"sourcesContent":["import type { ModelDefinition } from \"./types.js\";\n\n// Synced with https://api.upres.ai/v1/openapi.json (spec v1.1.0).\n// A job names one of six models. Which backend serves a model is ours to\n// choose and can change without notice — that is how a failing vendor\n// stops being your outage.\nexport const MODELS: ModelDefinition[] = [\n {\n id: \"flare\",\n name: \"Flare\",\n description: \"Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"prism\",\n name: \"Prism\",\n description: \"Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"lumen\",\n name: \"Lumen\",\n description: \"Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4, 8], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"mirage\",\n name: \"Mirage\",\n description: \"Invents plausible new detail rather than recovering what was there. Most dramatic, least faithful. Good for art, wrong for documents.\",\n category: \"image-enhance\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4, 8], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"motion\",\n name: \"Motion\",\n description: \"Fast 4K finish for AI-generated video (Sora, Kling, Runway). Frame-consistent, does not invent faces.\",\n category: \"video-upscale\",\n price: \"Counts against monthly video minutes\",\n inputTypes: [\"video/*\"],\n params: [\n { name: \"video\", type: \"string\", required: true, description: \"Video URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"motion-x\",\n name: \"Motion X\",\n description: \"Cinema-grade video upscale for film and commercials. Noticeably slower and dearer per second than Motion.\",\n category: \"video-upscale\",\n price: \"Counts against monthly video minutes\",\n inputTypes: [\"video/*\"],\n params: [\n { name: \"video\", type: \"string\", required: true, description: \"Video URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n];\n\nexport const IMAGE_MODELS = MODELS.filter((m) => m.category !== \"video-upscale\");\nexport const VIDEO_MODELS = MODELS.filter((m) => m.category === \"video-upscale\");\nexport const DEFAULT_IMAGE_MODEL = \"flare\";\nexport const DEFAULT_VIDEO_MODEL = \"motion\";\n","#!/usr/bin/env node\n/**\n * UpRes MCP stdio server. Speaks JSON-RPC over stdin/stdout so Claude,\n * Cursor, and Hermes can upscale without a browser.\n *\n * UPRES_API_KEY=upres_... npx upres-cli mcp\n * claude mcp add upres -- npx -y upres-cli mcp\n */\nimport { MODELS } from \"./models.js\";\n\nconst VERSION = \"0.2.0\";\nconst DEFAULT_BASE_URL = \"https://api.upres.ai/v1\";\n\ntype Json = Record<string, unknown>;\n\nfunction apiKey(): string {\n return process.env.UPRES_API_KEY ?? \"\";\n}\n\nfunction baseUrl(): string {\n return process.env.UPRES_BASE_URL ?? DEFAULT_BASE_URL;\n}\n\nasync function api<T>(method: string, endpoint: string, body?: unknown): Promise<T> {\n const key = apiKey();\n if (!key) {\n throw new Error(\"UPRES_API_KEY is not set. Get a key at https://upres.ai/account/api-keys\");\n }\n const res = await fetch(`${baseUrl()}${endpoint}`, {\n method,\n headers: {\n Authorization: `Bearer ${key}`,\n ...(body ? { \"Content-Type\": \"application/json\" } : {}),\n },\n body: body ? JSON.stringify(body) : undefined,\n });\n const data = (await res.json().catch(() => ({}))) as T & { error?: string };\n if (!res.ok) {\n throw new Error(data.error ?? `HTTP ${res.status}`);\n }\n return data;\n}\n\nconst TOOLS = [\n {\n name: \"upres_list_models\",\n description:\n \"List UpRes upscale models (flare, prism, lumen, mirage, motion, motion-x) with use cases.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n },\n {\n name: \"upres_get_credits\",\n description: \"Show recent job count for the authenticated UpRes API key as a quota proxy.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n },\n {\n name: \"upres_upscale_image\",\n description: \"Submit an image upscale job from a public URL. Models: flare, prism, lumen, mirage.\",\n inputSchema: {\n type: \"object\",\n properties: {\n image_url: { type: \"string\", description: \"Public HTTPS URL of the image\" },\n model: {\n type: \"string\",\n enum: [\"flare\", \"prism\", \"lumen\", \"mirage\"],\n description: \"Image model. Default flare.\",\n },\n scale: { type: \"integer\", enum: [2, 4, 8], description: \"Scale multiplier. Default 4.\" },\n },\n required: [\"image_url\"],\n additionalProperties: false,\n },\n },\n {\n name: \"upres_upscale_video\",\n description: \"Submit a video upscale job from a public URL. Models: motion, motion-x.\",\n inputSchema: {\n type: \"object\",\n properties: {\n video_url: { type: \"string\", description: \"Public HTTPS URL of the video\" },\n model: {\n type: \"string\",\n enum: [\"motion\", \"motion-x\"],\n description: \"Video model. Default motion.\",\n },\n scale: { type: \"integer\", enum: [2, 4], description: \"Scale multiplier. Default 4.\" },\n },\n required: [\"video_url\"],\n additionalProperties: false,\n },\n },\n {\n name: \"upres_get_job\",\n description: \"Get status and result_url of an UpRes job by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n job_id: { type: \"string\", description: \"Job UUID returned by an upscale tool\" },\n },\n required: [\"job_id\"],\n additionalProperties: false,\n },\n },\n];\n\nfunction ok(id: unknown, result: unknown) {\n return { jsonrpc: \"2.0\", id, result };\n}\n\nfunction fail(id: unknown, code: number, message: string) {\n return { jsonrpc: \"2.0\", id, error: { code, message } };\n}\n\nfunction text(obj: unknown) {\n return { content: [{ type: \"text\", text: JSON.stringify(obj, null, 2) }] };\n}\n\nasync function callTool(name: string, args: Json): Promise<unknown> {\n switch (name) {\n case \"upres_list_models\":\n return text(\n MODELS.map((m) => ({\n id: m.id,\n name: m.name,\n category: m.category,\n description: m.description,\n })),\n );\n case \"upres_get_credits\": {\n const jobs = await api<{ data: { status: string }[] }>(\"GET\", \"/jobs?limit=100\");\n const data = jobs.data ?? [];\n return text({\n recent_jobs: data.length,\n completed: data.filter((j) => j.status === \"completed\").length,\n pricing: \"https://upres.ai/pricing\",\n });\n }\n case \"upres_upscale_image\": {\n const image_url = String(args.image_url ?? \"\");\n if (!image_url) throw new Error(\"image_url is required\");\n const job = await api(\"POST\", \"/jobs\", {\n image_url,\n model: args.model ?? \"flare\",\n scale: args.scale ?? 4,\n });\n return text(job);\n }\n case \"upres_upscale_video\": {\n const video_url = String(args.video_url ?? \"\");\n if (!video_url) throw new Error(\"video_url is required\");\n const job = await api(\"POST\", \"/jobs\", {\n image_url: video_url,\n model: args.model ?? \"motion\",\n scale: args.scale ?? 4,\n });\n return text(job);\n }\n case \"upres_get_job\": {\n const job_id = String(args.job_id ?? \"\");\n if (!job_id) throw new Error(\"job_id is required\");\n const job = await api(\"GET\", `/jobs/${job_id}`);\n return text(job);\n }\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n}\n\nasync function handle(msg: Json): Promise<Json | null> {\n const id = msg.id;\n const method = String(msg.method ?? \"\");\n if (msg.jsonrpc !== \"2.0\") return fail(id, -32600, \"Invalid Request\");\n\n if (method === \"initialize\") {\n return ok(id, {\n protocolVersion: \"2024-11-05\",\n capabilities: { tools: {} },\n serverInfo: { name: \"upres\", version: VERSION },\n });\n }\n if (method === \"notifications/initialized\" || method === \"initialized\") return null;\n if (method === \"ping\") return ok(id, {});\n if (method === \"tools/list\") return ok(id, { tools: TOOLS });\n if (method === \"tools/call\") {\n const params = (msg.params ?? {}) as Json;\n const name = String(params.name ?? \"\");\n const args = (params.arguments ?? {}) as Json;\n try {\n return ok(id, await callTool(name, args));\n } catch (e) {\n return ok(id, {\n isError: true,\n content: [{ type: \"text\", text: (e as Error).message }],\n });\n }\n }\n if (id === undefined) return null;\n return fail(id, -32601, `Method not found: ${method}`);\n}\n\nexport async function handleMessage(msg: Json): Promise<Json | null> {\n return handle(msg);\n}\n\nexport function startStdio(): void {\n let buf = \"\";\n process.stdin.setEncoding(\"utf8\");\n process.stdin.on(\"data\", async (chunk: string) => {\n buf += chunk;\n while (true) {\n const nl = buf.indexOf(\"\\n\");\n if (nl < 0) break;\n const line = buf.slice(0, nl).trim();\n buf = buf.slice(nl + 1);\n if (!line) continue;\n let msg: Json;\n try {\n msg = JSON.parse(line) as Json;\n } catch {\n continue;\n }\n const reply = await handle(msg);\n if (reply) process.stdout.write(JSON.stringify(reply) + \"\\n\");\n }\n });\n}\n"],"mappings":";;;AAMO,IAAM,SAA4B;AAAA,EACvC;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY,CAAC,SAAS;AAAA,IACtB,QAAQ;AAAA,MACN,EAAE,MAAM,SAAS,MAAM,UAAU,UAAU,MAAM,aAAa,oBAAoB;AAAA,MAClF,EAAE,MAAM,SAAS,MAAM,WAAW,UAAU,OAAO,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,aAAa,mBAAmB;AAAA,IAClH;AAAA,EACF;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,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OAAO,OAAO,OAAO,QAAQ,EAAE;AACrC,UAAM,OAAQ,OAAO,aAAa,CAAC;AACnC,QAAI;AACF,aAAO,GAAG,IAAI,MAAM,SAAS,MAAM,IAAI,CAAC;AAAA,IAC1C,SAAS,GAAG;AACV,aAAO,GAAG,IAAI;AAAA,QACZ,SAAS;AAAA,QACT,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAO,EAAY,QAAQ,CAAC;AAAA,MACxD,CAAC;AAAA,IACH;AAAA,EACF;AACA,MAAI,OAAO,OAAW,QAAO;AAC7B,SAAO,KAAK,IAAI,QAAQ,qBAAqB,MAAM,EAAE;AACvD;AAEA,eAAsB,cAAc,KAAiC;AACnE,SAAO,OAAO,GAAG;AACnB;AAEO,SAAS,aAAmB;AACjC,MAAI,MAAM;AACV,UAAQ,MAAM,YAAY,MAAM;AAChC,UAAQ,MAAM,GAAG,QAAQ,OAAO,UAAkB;AAChD,WAAO;AACP,WAAO,MAAM;AACX,YAAM,KAAK,IAAI,QAAQ,IAAI;AAC3B,UAAI,KAAK,EAAG;AACZ,YAAM,OAAO,IAAI,MAAM,GAAG,EAAE,EAAE,KAAK;AACnC,YAAM,IAAI,MAAM,KAAK,CAAC;AACtB,UAAI,CAAC,KAAM;AACX,UAAI;AACJ,UAAI;AACF,cAAM,KAAK,MAAM,IAAI;AAAA,MACvB,QAAQ;AACN;AAAA,MACF;AACA,YAAM,QAAQ,MAAM,OAAO,GAAG;AAC9B,UAAI,MAAO,SAAQ,OAAO,MAAM,KAAK,UAAU,KAAK,IAAI,IAAI;AAAA,IAC9D;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/models.ts","../src/mcp.ts"],"sourcesContent":["import type { ModelDefinition } from \"./types.js\";\n\n// Synced with the public aliases in upres.ai server/contract/models.ts.\n// A job names one alias. Which backend serves it is ours to choose and can\n// change without notice — that is how a failing vendor stops being your outage.\n// Aliases with max scale 1 do not enlarge; the API stores scale 1 for them.\n\nfunction scaleParam(maxScale: number): ModelDefinition[\"params\"] {\n if (maxScale <= 1) return [];\n const options: number[] = [];\n for (let step = 2; step <= maxScale; step *= 2) options.push(step);\n return [\n {\n name: \"scale\",\n type: \"integer\",\n required: false,\n default: 4,\n options,\n description: \"Scale multiplier. Ignored when the alias does not enlarge.\",\n },\n ];\n}\n\nfunction model(\n id: string,\n name: string,\n description: string,\n category: ModelDefinition[\"category\"],\n inputTypes: string[],\n maxScale: number,\n): ModelDefinition {\n const fileParam =\n category.startsWith(\"video\")\n ? { name: \"video\", type: \"string\" as const, required: true, description: \"Video URL or file\" }\n : category.startsWith(\"audio\")\n ? { name: \"audio\", type: \"string\" as const, required: true, description: \"Audio URL or file\" }\n : { name: \"image\", type: \"string\" as const, required: true, description: \"Image URL or file\" };\n return {\n id,\n name,\n description,\n category,\n price: \"One credit per stage that runs\",\n inputTypes,\n params: [fileParam, ...scaleParam(maxScale)],\n };\n}\n\nexport const MODELS: ModelDefinition[] = [\n model(\"flare\", \"Flare\", \"Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.\", \"image-upscale\", [\"image/*\"], 4),\n model(\"prism\", \"Prism\", \"Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.\", \"image-upscale\", [\"image/*\"], 4),\n model(\"lumen\", \"Lumen\", \"Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.\", \"image-upscale\", [\"image/*\"], 8),\n model(\"mirage\", \"Mirage\", \"Invents plausible new detail rather than recovering what was there. Good for art, wrong for documents.\", \"image-upscale\", [\"image/*\"], 8),\n model(\"hush\", \"Hush\", \"Faithful denoise. Same size as the source, nothing invented.\", \"image-clean\", [\"image/*\"], 1),\n model(\"keen\", \"Keen\", \"Deblur and sharpen. Same size as the source, does not invent texture.\", \"image-restore\", [\"image/*\"], 1),\n model(\"visage\", \"Visage\", \"Restores faces and leaves the rest of the frame alone. Does not enlarge.\", \"image-restore\", [\"image/*\"], 1),\n 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),\n model(\"motion\", \"Motion\", \"Fast 4K finish for AI-generated video. Frame-consistent, does not invent faces.\", \"video-upscale\", [\"video/*\"], 4),\n model(\"motion-x\", \"Motion X\", \"Cinema-grade video upscale. Noticeably slower and dearer per second than Motion.\", \"video-upscale\", [\"video/*\"], 4),\n model(\"still\", \"Still\", \"Temporal video denoise. Resolution stays put.\", \"video-clean\", [\"video/*\"], 1),\n model(\"cadence\", \"Cadence\", \"Frame interpolation. Does not enlarge the picture.\", \"video-restore\", [\"video/*\"], 1),\n model(\"atelier-x\", \"Atelier X\", \"Still, then Motion X. Two credits.\", \"video-studio\", [\"video/*\"], 4),\n model(\"voice\", \"Voice\", \"Speech denoise and bandwidth extension to 48 kHz. Not for music.\", \"audio-clean\", [\"audio/*\"], 1),\n];\n\nexport const IMAGE_MODELS = MODELS.filter((m) => m.category.startsWith(\"image\"));\nexport const VIDEO_MODELS = MODELS.filter((m) => m.category.startsWith(\"video\"));\nexport const AUDIO_MODELS = MODELS.filter((m) => m.category.startsWith(\"audio\"));\nexport const DEFAULT_IMAGE_MODEL = \"flare\";\nexport const DEFAULT_VIDEO_MODEL = \"motion\";\nexport const DEFAULT_AUDIO_MODEL = \"voice\";\n","#!/usr/bin/env node\n/**\n * UpRes MCP stdio server. Speaks JSON-RPC over stdin/stdout so Claude,\n * Cursor, and Hermes can upscale without a browser.\n *\n * UPRES_API_KEY=upres_... npx upres-cli mcp\n * claude mcp add upres -- npx -y upres-cli mcp\n */\nimport { AUDIO_MODELS, IMAGE_MODELS, MODELS, VIDEO_MODELS } from \"./models.js\";\n\nconst VERSION = \"0.3.0\";\nconst DEFAULT_BASE_URL = \"https://api.upres.ai/v1\";\n\ntype Json = Record<string, unknown>;\n\nfunction apiKey(): string {\n return process.env.UPRES_API_KEY ?? \"\";\n}\n\nfunction baseUrl(): string {\n return process.env.UPRES_BASE_URL ?? DEFAULT_BASE_URL;\n}\n\nasync function api<T>(method: string, endpoint: string, body?: unknown): Promise<T> {\n const key = apiKey();\n if (!key) {\n throw new Error(\"UPRES_API_KEY is not set. Get a key at https://upres.ai/account/api-keys\");\n }\n const res = await fetch(`${baseUrl()}${endpoint}`, {\n method,\n headers: {\n Authorization: `Bearer ${key}`,\n ...(body ? { \"Content-Type\": \"application/json\" } : {}),\n },\n body: body ? JSON.stringify(body) : undefined,\n });\n const data = (await res.json().catch(() => ({}))) as T & { error?: string };\n if (!res.ok) {\n throw new Error(data.error ?? `HTTP ${res.status}`);\n }\n return data;\n}\n\nconst TOOLS = [\n {\n name: \"upres_list_models\",\n description: \"List the 14 public UpRes aliases for image, video, and speech.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n },\n {\n name: \"upres_get_credits\",\n description: \"Show recent job count for the authenticated UpRes API key as a quota proxy.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n },\n {\n name: \"upres_upscale_image\",\n description:\n \"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.\",\n inputSchema: {\n type: \"object\",\n properties: {\n image_url: { type: \"string\", description: \"Public HTTPS URL of the image\" },\n model: {\n type: \"string\",\n enum: IMAGE_MODELS.map((m) => m.id),\n description: \"Image alias. Default flare.\",\n },\n scale: { type: \"integer\", enum: [2, 4, 8], description: \"Scale multiplier. Default 4. Ignored for hush, keen, and visage.\" },\n },\n required: [\"image_url\"],\n additionalProperties: false,\n },\n },\n {\n name: \"upres_upscale_video\",\n description:\n \"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.\",\n inputSchema: {\n type: \"object\",\n properties: {\n video_url: { type: \"string\", description: \"Public HTTPS URL of the video\" },\n model: {\n type: \"string\",\n enum: VIDEO_MODELS.map((m) => m.id),\n description: \"Video alias. Default motion.\",\n },\n scale: { type: \"integer\", enum: [2, 4], description: \"Scale multiplier. Default 4. Ignored for still and cadence.\" },\n },\n required: [\"video_url\"],\n additionalProperties: false,\n },\n },\n {\n name: \"upres_enhance_audio\",\n description: \"Submit a speech job from a public URL. voice denoises speech and extends it to 48 kHz. Music is not supported.\",\n inputSchema: {\n type: \"object\",\n properties: {\n audio_url: { type: \"string\", description: \"Public HTTPS URL of wav, mp3, m4a, or flac speech\" },\n model: {\n type: \"string\",\n enum: AUDIO_MODELS.map((m) => m.id),\n description: \"Audio alias. Default voice.\",\n },\n },\n required: [\"audio_url\"],\n additionalProperties: false,\n },\n },\n {\n name: \"upres_get_job\",\n description: \"Get status and result_url of an UpRes job by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n job_id: { type: \"string\", description: \"Job UUID returned by an upscale tool\" },\n },\n required: [\"job_id\"],\n additionalProperties: false,\n },\n },\n];\n\nfunction ok(id: unknown, result: unknown) {\n return { jsonrpc: \"2.0\", id, result };\n}\n\nfunction fail(id: unknown, code: number, message: string) {\n return { jsonrpc: \"2.0\", id, error: { code, message } };\n}\n\nfunction text(obj: unknown) {\n return { content: [{ type: \"text\", text: JSON.stringify(obj, null, 2) }] };\n}\n\nasync function callTool(name: string, args: Json): Promise<unknown> {\n switch (name) {\n case \"upres_list_models\":\n return text(\n MODELS.map((m) => ({\n id: m.id,\n name: m.name,\n category: m.category,\n description: m.description,\n })),\n );\n case \"upres_get_credits\": {\n const jobs = await api<{ data: { status: string }[] }>(\"GET\", \"/jobs?limit=100\");\n const data = jobs.data ?? [];\n return text({\n recent_jobs: data.length,\n completed: data.filter((j) => j.status === \"completed\").length,\n pricing: \"https://upres.ai/pricing\",\n });\n }\n case \"upres_upscale_image\": {\n const image_url = String(args.image_url ?? \"\");\n if (!image_url) throw new Error(\"image_url is required\");\n const job = await api(\"POST\", \"/jobs\", {\n image_url,\n model: args.model ?? \"flare\",\n scale: args.scale ?? 4,\n });\n return text(job);\n }\n case \"upres_upscale_video\": {\n const video_url = String(args.video_url ?? \"\");\n if (!video_url) throw new Error(\"video_url is required\");\n const job = await api(\"POST\", \"/jobs\", {\n image_url: video_url,\n model: args.model ?? \"motion\",\n scale: args.scale ?? 4,\n });\n return text(job);\n }\n case \"upres_enhance_audio\": {\n const audio_url = String(args.audio_url ?? \"\");\n if (!audio_url) throw new Error(\"audio_url is required\");\n const job = await api(\"POST\", \"/jobs\", {\n image_url: audio_url,\n model: args.model ?? \"voice\",\n });\n return text(job);\n }\n case \"upres_get_job\": {\n const job_id = String(args.job_id ?? \"\");\n if (!job_id) throw new Error(\"job_id is required\");\n const job = await api(\"GET\", `/jobs/${job_id}`);\n return text(job);\n }\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n}\n\nasync function handle(msg: Json): Promise<Json | null> {\n const id = msg.id;\n const method = String(msg.method ?? \"\");\n if (msg.jsonrpc !== \"2.0\") return fail(id, -32600, \"Invalid Request\");\n\n if (method === \"initialize\") {\n return ok(id, {\n protocolVersion: \"2024-11-05\",\n capabilities: { tools: {} },\n serverInfo: { name: \"upres\", version: VERSION },\n });\n }\n if (method === \"notifications/initialized\" || method === \"initialized\") return null;\n if (method === \"ping\") return ok(id, {});\n if (method === \"tools/list\") return ok(id, { tools: TOOLS });\n if (method === \"tools/call\") {\n const params = (msg.params ?? {}) as Json;\n const name = String(params.name ?? \"\");\n const args = (params.arguments ?? {}) as Json;\n try {\n return ok(id, await callTool(name, args));\n } catch (e) {\n return ok(id, {\n isError: true,\n content: [{ type: \"text\", text: (e as Error).message }],\n });\n }\n }\n if (id === undefined) return null;\n return fail(id, -32601, `Method not found: ${method}`);\n}\n\nexport async function handleMessage(msg: Json): Promise<Json | null> {\n return handle(msg);\n}\n\nexport function startStdio(): void {\n let buf = \"\";\n process.stdin.setEncoding(\"utf8\");\n process.stdin.on(\"data\", async (chunk: string) => {\n buf += chunk;\n while (true) {\n const nl = buf.indexOf(\"\\n\");\n if (nl < 0) break;\n const line = buf.slice(0, nl).trim();\n buf = buf.slice(nl + 1);\n if (!line) continue;\n let msg: Json;\n try {\n msg = JSON.parse(line) as Json;\n } catch {\n continue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A,MAAI,OAAO,OAAW,QAAO;AAC7B,SAAO,KAAK,IAAI,QAAQ,qBAAqB,MAAM,EAAE;AACvD;AAEA,eAAsB,cAAc,KAAiC;AACnE,SAAO,OAAO,GAAG;AACnB;AAEO,SAAS,aAAmB;AACjC,MAAI,MAAM;AACV,UAAQ,MAAM,YAAY,MAAM;AAChC,UAAQ,MAAM,GAAG,QAAQ,OAAO,UAAkB;AAChD,WAAO;AACP,WAAO,MAAM;AACX,YAAM,KAAK,IAAI,QAAQ,IAAI;AAC3B,UAAI,KAAK,EAAG;AACZ,YAAM,OAAO,IAAI,MAAM,GAAG,EAAE,EAAE,KAAK;AACnC,YAAM,IAAI,MAAM,KAAK,CAAC;AACtB,UAAI,CAAC,KAAM;AACX,UAAI;AACJ,UAAI;AACF,cAAM,KAAK,MAAM,IAAI;AAAA,MACvB,QAAQ;AACN;AAAA,MACF;AACA,YAAM,QAAQ,MAAM,OAAO,GAAG;AAC9B,UAAI,MAAO,SAAQ,OAAO,MAAM,KAAK,UAAU,KAAK,IAAI,IAAI;AAAA,IAC9D;AAAA,EACF,CAAC;AACH;","names":[]}
package/dist/models.cjs CHANGED
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/models.ts
21
21
  var models_exports = {};
22
22
  __export(models_exports, {
23
+ AUDIO_MODELS: () => AUDIO_MODELS,
24
+ DEFAULT_AUDIO_MODEL: () => DEFAULT_AUDIO_MODEL,
23
25
  DEFAULT_IMAGE_MODEL: () => DEFAULT_IMAGE_MODEL,
24
26
  DEFAULT_VIDEO_MODEL: () => DEFAULT_VIDEO_MODEL,
25
27
  IMAGE_MODELS: () => IMAGE_MODELS,
@@ -27,86 +29,59 @@ __export(models_exports, {
27
29
  VIDEO_MODELS: () => VIDEO_MODELS
28
30
  });
29
31
  module.exports = __toCommonJS(models_exports);
32
+ function scaleParam(maxScale) {
33
+ if (maxScale <= 1) return [];
34
+ const options = [];
35
+ for (let step = 2; step <= maxScale; step *= 2) options.push(step);
36
+ return [
37
+ {
38
+ name: "scale",
39
+ type: "integer",
40
+ required: false,
41
+ default: 4,
42
+ options,
43
+ description: "Scale multiplier. Ignored when the alias does not enlarge."
44
+ }
45
+ ];
46
+ }
47
+ function model(id, name, description, category, inputTypes, maxScale) {
48
+ 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" };
49
+ return {
50
+ id,
51
+ name,
52
+ description,
53
+ category,
54
+ price: "One credit per stage that runs",
55
+ inputTypes,
56
+ params: [fileParam, ...scaleParam(maxScale)]
57
+ };
58
+ }
30
59
  var MODELS = [
31
- {
32
- id: "flare",
33
- name: "Flare",
34
- description: "Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.",
35
- category: "image-upscale",
36
- price: "Included in plan quota",
37
- inputTypes: ["image/*"],
38
- params: [
39
- { name: "image", type: "string", required: true, description: "Image URL or file" },
40
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
41
- ]
42
- },
43
- {
44
- id: "prism",
45
- name: "Prism",
46
- description: "Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.",
47
- category: "image-upscale",
48
- price: "Included in plan quota",
49
- inputTypes: ["image/*"],
50
- params: [
51
- { name: "image", type: "string", required: true, description: "Image URL or file" },
52
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
53
- ]
54
- },
55
- {
56
- id: "lumen",
57
- name: "Lumen",
58
- description: "Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.",
59
- category: "image-upscale",
60
- price: "Included in plan quota",
61
- inputTypes: ["image/*"],
62
- params: [
63
- { name: "image", type: "string", required: true, description: "Image URL or file" },
64
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4, 8], description: "Scale multiplier" }
65
- ]
66
- },
67
- {
68
- id: "mirage",
69
- name: "Mirage",
70
- description: "Invents plausible new detail rather than recovering what was there. Most dramatic, least faithful. Good for art, wrong for documents.",
71
- category: "image-enhance",
72
- price: "Included in plan quota",
73
- inputTypes: ["image/*"],
74
- params: [
75
- { name: "image", type: "string", required: true, description: "Image URL or file" },
76
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4, 8], description: "Scale multiplier" }
77
- ]
78
- },
79
- {
80
- id: "motion",
81
- name: "Motion",
82
- description: "Fast 4K finish for AI-generated video (Sora, Kling, Runway). Frame-consistent, does not invent faces.",
83
- category: "video-upscale",
84
- price: "Counts against monthly video minutes",
85
- inputTypes: ["video/*"],
86
- params: [
87
- { name: "video", type: "string", required: true, description: "Video URL or file" },
88
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
89
- ]
90
- },
91
- {
92
- id: "motion-x",
93
- name: "Motion X",
94
- description: "Cinema-grade video upscale for film and commercials. Noticeably slower and dearer per second than Motion.",
95
- category: "video-upscale",
96
- price: "Counts against monthly video minutes",
97
- inputTypes: ["video/*"],
98
- params: [
99
- { name: "video", type: "string", required: true, description: "Video URL or file" },
100
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
101
- ]
102
- }
60
+ model("flare", "Flare", "Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.", "image-upscale", ["image/*"], 4),
61
+ model("prism", "Prism", "Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.", "image-upscale", ["image/*"], 4),
62
+ model("lumen", "Lumen", "Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.", "image-upscale", ["image/*"], 8),
63
+ model("mirage", "Mirage", "Invents plausible new detail rather than recovering what was there. Good for art, wrong for documents.", "image-upscale", ["image/*"], 8),
64
+ model("hush", "Hush", "Faithful denoise. Same size as the source, nothing invented.", "image-clean", ["image/*"], 1),
65
+ model("keen", "Keen", "Deblur and sharpen. Same size as the source, does not invent texture.", "image-restore", ["image/*"], 1),
66
+ model("visage", "Visage", "Restores faces and leaves the rest of the frame alone. Does not enlarge.", "image-restore", ["image/*"], 1),
67
+ 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),
68
+ model("motion", "Motion", "Fast 4K finish for AI-generated video. Frame-consistent, does not invent faces.", "video-upscale", ["video/*"], 4),
69
+ model("motion-x", "Motion X", "Cinema-grade video upscale. Noticeably slower and dearer per second than Motion.", "video-upscale", ["video/*"], 4),
70
+ model("still", "Still", "Temporal video denoise. Resolution stays put.", "video-clean", ["video/*"], 1),
71
+ model("cadence", "Cadence", "Frame interpolation. Does not enlarge the picture.", "video-restore", ["video/*"], 1),
72
+ model("atelier-x", "Atelier X", "Still, then Motion X. Two credits.", "video-studio", ["video/*"], 4),
73
+ model("voice", "Voice", "Speech denoise and bandwidth extension to 48 kHz. Not for music.", "audio-clean", ["audio/*"], 1)
103
74
  ];
104
- var IMAGE_MODELS = MODELS.filter((m) => m.category !== "video-upscale");
105
- var VIDEO_MODELS = MODELS.filter((m) => m.category === "video-upscale");
75
+ var IMAGE_MODELS = MODELS.filter((m) => m.category.startsWith("image"));
76
+ var VIDEO_MODELS = MODELS.filter((m) => m.category.startsWith("video"));
77
+ var AUDIO_MODELS = MODELS.filter((m) => m.category.startsWith("audio"));
106
78
  var DEFAULT_IMAGE_MODEL = "flare";
107
79
  var DEFAULT_VIDEO_MODEL = "motion";
80
+ var DEFAULT_AUDIO_MODEL = "voice";
108
81
  // Annotate the CommonJS export names for ESM import in node:
109
82
  0 && (module.exports = {
83
+ AUDIO_MODELS,
84
+ DEFAULT_AUDIO_MODEL,
110
85
  DEFAULT_IMAGE_MODEL,
111
86
  DEFAULT_VIDEO_MODEL,
112
87
  IMAGE_MODELS,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/models.ts"],"sourcesContent":["import type { ModelDefinition } from \"./types.js\";\n\n// Synced with https://api.upres.ai/v1/openapi.json (spec v1.1.0).\n// A job names one of six models. Which backend serves a model is ours to\n// choose and can change without notice — that is how a failing vendor\n// stops being your outage.\nexport const MODELS: ModelDefinition[] = [\n {\n id: \"flare\",\n name: \"Flare\",\n description: \"Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"prism\",\n name: \"Prism\",\n description: \"Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"lumen\",\n name: \"Lumen\",\n description: \"Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4, 8], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"mirage\",\n name: \"Mirage\",\n description: \"Invents plausible new detail rather than recovering what was there. Most dramatic, least faithful. Good for art, wrong for documents.\",\n category: \"image-enhance\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4, 8], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"motion\",\n name: \"Motion\",\n description: \"Fast 4K finish for AI-generated video (Sora, Kling, Runway). Frame-consistent, does not invent faces.\",\n category: \"video-upscale\",\n price: \"Counts against monthly video minutes\",\n inputTypes: [\"video/*\"],\n params: [\n { name: \"video\", type: \"string\", required: true, description: \"Video URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"motion-x\",\n name: \"Motion X\",\n description: \"Cinema-grade video upscale for film and commercials. Noticeably slower and dearer per second than Motion.\",\n category: \"video-upscale\",\n price: \"Counts against monthly video minutes\",\n inputTypes: [\"video/*\"],\n params: [\n { name: \"video\", type: \"string\", required: true, description: \"Video URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n];\n\nexport const IMAGE_MODELS = MODELS.filter((m) => m.category !== \"video-upscale\");\nexport const VIDEO_MODELS = MODELS.filter((m) => m.category === \"video-upscale\");\nexport const DEFAULT_IMAGE_MODEL = \"flare\";\nexport const DEFAULT_VIDEO_MODEL = \"motion\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,IAAM,SAA4B;AAAA,EACvC;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY,CAAC,SAAS;AAAA,IACtB,QAAQ;AAAA,MACN,EAAE,MAAM,SAAS,MAAM,UAAU,UAAU,MAAM,aAAa,oBAAoB;AAAA,MAClF,EAAE,MAAM,SAAS,MAAM,WAAW,UAAU,OAAO,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,aAAa,mBAAmB;AAAA,IAClH;AAAA,EACF;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY,CAAC,SAAS;AAAA,IACtB,QAAQ;AAAA,MACN,EAAE,MAAM,SAAS,MAAM,UAAU,UAAU,MAAM,aAAa,oBAAoB;AAAA,MAClF,EAAE,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IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY,CAAC,SAAS;AAAA,IACtB,QAAQ;AAAA,MACN,EAAE,MAAM,SAAS,MAAM,UAAU,UAAU,MAAM,aAAa,oBAAoB;AAAA,MAClF,EAAE,MAAM,SAAS,MAAM,WAAW,UAAU,OAAO,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,aAAa,mBAAmB;AAAA,IAClH;AAAA,EACF;AACF;AAEO,IAAM,eAAe,OAAO,OAAO,CAAC,MAAM,EAAE,aAAa,eAAe;AACxE,IAAM,eAAe,OAAO,OAAO,CAAC,MAAM,EAAE,aAAa,eAAe;AACxE,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;","names":[]}
1
+ {"version":3,"sources":["../src/models.ts"],"sourcesContent":["import type { ModelDefinition } from \"./types.js\";\n\n// Synced with the public aliases in upres.ai server/contract/models.ts.\n// A job names one alias. Which backend serves it is ours to choose and can\n// change without notice — that is how a failing vendor stops being your outage.\n// Aliases with max scale 1 do not enlarge; the API stores scale 1 for them.\n\nfunction scaleParam(maxScale: number): ModelDefinition[\"params\"] {\n if (maxScale <= 1) return [];\n const options: number[] = [];\n for (let step = 2; step <= maxScale; step *= 2) options.push(step);\n return [\n {\n name: \"scale\",\n type: \"integer\",\n required: false,\n default: 4,\n options,\n description: \"Scale multiplier. Ignored when the alias does not enlarge.\",\n },\n ];\n}\n\nfunction model(\n id: string,\n name: string,\n description: string,\n category: ModelDefinition[\"category\"],\n inputTypes: string[],\n maxScale: number,\n): ModelDefinition {\n const fileParam =\n category.startsWith(\"video\")\n ? { name: \"video\", type: \"string\" as const, required: true, description: \"Video URL or file\" }\n : category.startsWith(\"audio\")\n ? { name: \"audio\", type: \"string\" as const, required: true, description: \"Audio URL or file\" }\n : { name: \"image\", type: \"string\" as const, required: true, description: \"Image URL or file\" };\n return {\n id,\n name,\n description,\n category,\n price: \"One credit per stage that runs\",\n inputTypes,\n params: [fileParam, ...scaleParam(maxScale)],\n };\n}\n\nexport const MODELS: ModelDefinition[] = [\n model(\"flare\", \"Flare\", \"Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.\", \"image-upscale\", [\"image/*\"], 4),\n model(\"prism\", \"Prism\", \"Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.\", \"image-upscale\", [\"image/*\"], 4),\n model(\"lumen\", \"Lumen\", \"Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.\", \"image-upscale\", [\"image/*\"], 8),\n model(\"mirage\", \"Mirage\", \"Invents plausible new detail rather than recovering what was there. Good for art, wrong for documents.\", \"image-upscale\", [\"image/*\"], 8),\n model(\"hush\", \"Hush\", \"Faithful denoise. Same size as the source, nothing invented.\", \"image-clean\", [\"image/*\"], 1),\n model(\"keen\", \"Keen\", \"Deblur and sharpen. Same size as the source, does not invent texture.\", \"image-restore\", [\"image/*\"], 1),\n model(\"visage\", \"Visage\", \"Restores faces and leaves the rest of the frame alone. Does not enlarge.\", \"image-restore\", [\"image/*\"], 1),\n 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),\n model(\"motion\", \"Motion\", \"Fast 4K finish for AI-generated video. Frame-consistent, does not invent faces.\", \"video-upscale\", [\"video/*\"], 4),\n model(\"motion-x\", \"Motion X\", \"Cinema-grade video upscale. Noticeably slower and dearer per second than Motion.\", \"video-upscale\", [\"video/*\"], 4),\n model(\"still\", \"Still\", \"Temporal video denoise. Resolution stays put.\", \"video-clean\", [\"video/*\"], 1),\n model(\"cadence\", \"Cadence\", \"Frame interpolation. Does not enlarge the picture.\", \"video-restore\", [\"video/*\"], 1),\n model(\"atelier-x\", \"Atelier X\", \"Still, then Motion X. Two credits.\", \"video-studio\", [\"video/*\"], 4),\n model(\"voice\", \"Voice\", \"Speech denoise and bandwidth extension to 48 kHz. Not for music.\", \"audio-clean\", [\"audio/*\"], 1),\n];\n\nexport const IMAGE_MODELS = MODELS.filter((m) => m.category.startsWith(\"image\"));\nexport const VIDEO_MODELS = MODELS.filter((m) => m.category.startsWith(\"video\"));\nexport const AUDIO_MODELS = MODELS.filter((m) => m.category.startsWith(\"audio\"));\nexport const DEFAULT_IMAGE_MODEL = \"flare\";\nexport const DEFAULT_VIDEO_MODEL = \"motion\";\nexport const DEFAULT_AUDIO_MODEL = \"voice\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,SAAS,WAAW,UAA6C;AAC/D,MAAI,YAAY,EAAG,QAAO,CAAC;AAC3B,QAAM,UAAoB,CAAC;AAC3B,WAAS,OAAO,GAAG,QAAQ,UAAU,QAAQ,EAAG,SAAQ,KAAK,IAAI;AACjE,SAAO;AAAA,IACL;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT;AAAA,MACA,aAAa;AAAA,IACf;AAAA,EACF;AACF;AAEA,SAAS,MACP,IACA,MACA,aACA,UACA,YACA,UACiB;AACjB,QAAM,YACJ,SAAS,WAAW,OAAO,IACvB,EAAE,MAAM,SAAS,MAAM,UAAmB,UAAU,MAAM,aAAa,oBAAoB,IAC3F,SAAS,WAAW,OAAO,IACzB,EAAE,MAAM,SAAS,MAAM,UAAmB,UAAU,MAAM,aAAa,oBAAoB,IAC3F,EAAE,MAAM,SAAS,MAAM,UAAmB,UAAU,MAAM,aAAa,oBAAoB;AACnG,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,QAAQ,CAAC,WAAW,GAAG,WAAW,QAAQ,CAAC;AAAA,EAC7C;AACF;AAEO,IAAM,SAA4B;AAAA,EACvC,MAAM,SAAS,SAAS,yEAAyE,iBAAiB,CAAC,SAAS,GAAG,CAAC;AAAA,EAChI,MAAM,SAAS,SAAS,yFAAyF,iBAAiB,CAAC,SAAS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  declare const MODELS: ModelDefinition[];
4
4
  declare const IMAGE_MODELS: ModelDefinition[];
5
5
  declare const VIDEO_MODELS: ModelDefinition[];
6
+ declare const AUDIO_MODELS: ModelDefinition[];
6
7
  declare const DEFAULT_IMAGE_MODEL = "flare";
7
8
  declare const DEFAULT_VIDEO_MODEL = "motion";
9
+ declare const DEFAULT_AUDIO_MODEL = "voice";
8
10
 
9
- export { DEFAULT_IMAGE_MODEL, DEFAULT_VIDEO_MODEL, IMAGE_MODELS, MODELS, VIDEO_MODELS };
11
+ export { AUDIO_MODELS, DEFAULT_AUDIO_MODEL, DEFAULT_IMAGE_MODEL, DEFAULT_VIDEO_MODEL, IMAGE_MODELS, MODELS, VIDEO_MODELS };
package/dist/models.d.ts CHANGED
@@ -3,7 +3,9 @@ import { ModelDefinition } from './types.js';
3
3
  declare const MODELS: ModelDefinition[];
4
4
  declare const IMAGE_MODELS: ModelDefinition[];
5
5
  declare const VIDEO_MODELS: ModelDefinition[];
6
+ declare const AUDIO_MODELS: ModelDefinition[];
6
7
  declare const DEFAULT_IMAGE_MODEL = "flare";
7
8
  declare const DEFAULT_VIDEO_MODEL = "motion";
9
+ declare const DEFAULT_AUDIO_MODEL = "voice";
8
10
 
9
- export { DEFAULT_IMAGE_MODEL, DEFAULT_VIDEO_MODEL, IMAGE_MODELS, MODELS, VIDEO_MODELS };
11
+ export { AUDIO_MODELS, DEFAULT_AUDIO_MODEL, DEFAULT_IMAGE_MODEL, DEFAULT_VIDEO_MODEL, IMAGE_MODELS, MODELS, VIDEO_MODELS };
package/dist/models.js CHANGED
@@ -1,83 +1,56 @@
1
1
  // src/models.ts
2
+ function scaleParam(maxScale) {
3
+ if (maxScale <= 1) return [];
4
+ const options = [];
5
+ for (let step = 2; step <= maxScale; step *= 2) options.push(step);
6
+ return [
7
+ {
8
+ name: "scale",
9
+ type: "integer",
10
+ required: false,
11
+ default: 4,
12
+ options,
13
+ description: "Scale multiplier. Ignored when the alias does not enlarge."
14
+ }
15
+ ];
16
+ }
17
+ function model(id, name, description, category, inputTypes, maxScale) {
18
+ 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" };
19
+ return {
20
+ id,
21
+ name,
22
+ description,
23
+ category,
24
+ price: "One credit per stage that runs",
25
+ inputTypes,
26
+ params: [fileParam, ...scaleParam(maxScale)]
27
+ };
28
+ }
2
29
  var MODELS = [
3
- {
4
- id: "flare",
5
- name: "Flare",
6
- description: "Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.",
7
- category: "image-upscale",
8
- price: "Included in plan quota",
9
- inputTypes: ["image/*"],
10
- params: [
11
- { name: "image", type: "string", required: true, description: "Image URL or file" },
12
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
13
- ]
14
- },
15
- {
16
- id: "prism",
17
- name: "Prism",
18
- description: "Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.",
19
- category: "image-upscale",
20
- price: "Included in plan quota",
21
- inputTypes: ["image/*"],
22
- params: [
23
- { name: "image", type: "string", required: true, description: "Image URL or file" },
24
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
25
- ]
26
- },
27
- {
28
- id: "lumen",
29
- name: "Lumen",
30
- description: "Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.",
31
- category: "image-upscale",
32
- price: "Included in plan quota",
33
- inputTypes: ["image/*"],
34
- params: [
35
- { name: "image", type: "string", required: true, description: "Image URL or file" },
36
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4, 8], description: "Scale multiplier" }
37
- ]
38
- },
39
- {
40
- id: "mirage",
41
- name: "Mirage",
42
- description: "Invents plausible new detail rather than recovering what was there. Most dramatic, least faithful. Good for art, wrong for documents.",
43
- category: "image-enhance",
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, 8], description: "Scale multiplier" }
49
- ]
50
- },
51
- {
52
- id: "motion",
53
- name: "Motion",
54
- description: "Fast 4K finish for AI-generated video (Sora, Kling, Runway). Frame-consistent, does not invent faces.",
55
- category: "video-upscale",
56
- price: "Counts against monthly video minutes",
57
- inputTypes: ["video/*"],
58
- params: [
59
- { name: "video", type: "string", required: true, description: "Video URL or file" },
60
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
61
- ]
62
- },
63
- {
64
- id: "motion-x",
65
- name: "Motion X",
66
- description: "Cinema-grade video upscale for film and commercials. Noticeably slower and dearer per second than Motion.",
67
- category: "video-upscale",
68
- price: "Counts against monthly video minutes",
69
- inputTypes: ["video/*"],
70
- params: [
71
- { name: "video", type: "string", required: true, description: "Video URL or file" },
72
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
73
- ]
74
- }
30
+ model("flare", "Flare", "Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.", "image-upscale", ["image/*"], 4),
31
+ model("prism", "Prism", "Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.", "image-upscale", ["image/*"], 4),
32
+ model("lumen", "Lumen", "Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.", "image-upscale", ["image/*"], 8),
33
+ model("mirage", "Mirage", "Invents plausible new detail rather than recovering what was there. Good for art, wrong for documents.", "image-upscale", ["image/*"], 8),
34
+ model("hush", "Hush", "Faithful denoise. Same size as the source, nothing invented.", "image-clean", ["image/*"], 1),
35
+ model("keen", "Keen", "Deblur and sharpen. Same size as the source, does not invent texture.", "image-restore", ["image/*"], 1),
36
+ model("visage", "Visage", "Restores faces and leaves the rest of the frame alone. Does not enlarge.", "image-restore", ["image/*"], 1),
37
+ 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),
38
+ model("motion", "Motion", "Fast 4K finish for AI-generated video. Frame-consistent, does not invent faces.", "video-upscale", ["video/*"], 4),
39
+ model("motion-x", "Motion X", "Cinema-grade video upscale. Noticeably slower and dearer per second than Motion.", "video-upscale", ["video/*"], 4),
40
+ model("still", "Still", "Temporal video denoise. Resolution stays put.", "video-clean", ["video/*"], 1),
41
+ model("cadence", "Cadence", "Frame interpolation. Does not enlarge the picture.", "video-restore", ["video/*"], 1),
42
+ model("atelier-x", "Atelier X", "Still, then Motion X. Two credits.", "video-studio", ["video/*"], 4),
43
+ model("voice", "Voice", "Speech denoise and bandwidth extension to 48 kHz. Not for music.", "audio-clean", ["audio/*"], 1)
75
44
  ];
76
- var IMAGE_MODELS = MODELS.filter((m) => m.category !== "video-upscale");
77
- var VIDEO_MODELS = MODELS.filter((m) => m.category === "video-upscale");
45
+ var IMAGE_MODELS = MODELS.filter((m) => m.category.startsWith("image"));
46
+ var VIDEO_MODELS = MODELS.filter((m) => m.category.startsWith("video"));
47
+ var AUDIO_MODELS = MODELS.filter((m) => m.category.startsWith("audio"));
78
48
  var DEFAULT_IMAGE_MODEL = "flare";
79
49
  var DEFAULT_VIDEO_MODEL = "motion";
50
+ var DEFAULT_AUDIO_MODEL = "voice";
80
51
  export {
52
+ AUDIO_MODELS,
53
+ DEFAULT_AUDIO_MODEL,
81
54
  DEFAULT_IMAGE_MODEL,
82
55
  DEFAULT_VIDEO_MODEL,
83
56
  IMAGE_MODELS,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/models.ts"],"sourcesContent":["import type { ModelDefinition } from \"./types.js\";\n\n// Synced with https://api.upres.ai/v1/openapi.json (spec v1.1.0).\n// A job names one of six models. Which backend serves a model is ours to\n// choose and can change without notice — that is how a failing vendor\n// stops being your outage.\nexport const MODELS: ModelDefinition[] = [\n {\n id: \"flare\",\n name: \"Flare\",\n description: \"Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"prism\",\n name: \"Prism\",\n description: \"Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"lumen\",\n name: \"Lumen\",\n description: \"Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4, 8], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"mirage\",\n name: \"Mirage\",\n description: \"Invents plausible new detail rather than recovering what was there. Most dramatic, least faithful. Good for art, wrong for documents.\",\n category: \"image-enhance\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4, 8], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"motion\",\n name: \"Motion\",\n description: \"Fast 4K finish for AI-generated video (Sora, Kling, Runway). Frame-consistent, does not invent faces.\",\n category: \"video-upscale\",\n price: \"Counts against monthly video minutes\",\n inputTypes: [\"video/*\"],\n params: [\n { name: \"video\", type: \"string\", required: true, description: \"Video URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"motion-x\",\n name: \"Motion X\",\n description: \"Cinema-grade video upscale for film and commercials. Noticeably slower and dearer per second than Motion.\",\n category: \"video-upscale\",\n price: \"Counts against monthly video minutes\",\n inputTypes: [\"video/*\"],\n params: [\n { name: \"video\", type: \"string\", required: true, description: \"Video URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n];\n\nexport const IMAGE_MODELS = MODELS.filter((m) => m.category !== \"video-upscale\");\nexport const VIDEO_MODELS = MODELS.filter((m) => m.category === \"video-upscale\");\nexport const DEFAULT_IMAGE_MODEL = \"flare\";\nexport const DEFAULT_VIDEO_MODEL = \"motion\";\n"],"mappings":";AAMO,IAAM,SAA4B;AAAA,EACvC;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY,CAAC,SAAS;AAAA,IACtB,QAAQ;AAAA,MACN,EAAE,MAAM,SAAS,MAAM,UAAU,UAAU,MAAM,aAAa,oBAAoB;AAAA,MAClF,EAAE,MAAM,SAAS,MAAM,WAAW,UAAU,OAAO,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,aAAa,mBAAmB;AAAA,IAClH;AAAA,EACF;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY,CAAC,SAAS;AAAA,IACtB,QAAQ;AAAA,MACN,EAAE,MAAM,SAAS,MAAM,UAAU,UAAU,MAAM,aAAa,oBAAoB;AAAA,MAClF,EAAE,MAAM,SAAS,MAAM,WAAW,UAAU,OAAO,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,aAAa,mBAAmB;AAAA,IAClH;AAAA,EACF;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY,CAAC,SAAS;AAAA,IACtB,QAAQ;AAAA,MACN,E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EACF;AACF;AAEO,IAAM,eAAe,OAAO,OAAO,CAAC,MAAM,EAAE,aAAa,eAAe;AACxE,IAAM,eAAe,OAAO,OAAO,CAAC,MAAM,EAAE,aAAa,eAAe;AACxE,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;","names":[]}
1
+ {"version":3,"sources":["../src/models.ts"],"sourcesContent":["import type { ModelDefinition } from \"./types.js\";\n\n// Synced with the public aliases in upres.ai server/contract/models.ts.\n// A job names one alias. Which backend serves it is ours to choose and can\n// change without notice — that is how a failing vendor stops being your outage.\n// Aliases with max scale 1 do not enlarge; the API stores scale 1 for them.\n\nfunction scaleParam(maxScale: number): ModelDefinition[\"params\"] {\n if (maxScale <= 1) return [];\n const options: number[] = [];\n for (let step = 2; step <= maxScale; step *= 2) options.push(step);\n return [\n {\n name: \"scale\",\n type: \"integer\",\n required: false,\n default: 4,\n options,\n description: \"Scale multiplier. Ignored when the alias does not enlarge.\",\n },\n ];\n}\n\nfunction model(\n id: string,\n name: string,\n description: string,\n category: ModelDefinition[\"category\"],\n inputTypes: string[],\n maxScale: number,\n): ModelDefinition {\n const fileParam =\n category.startsWith(\"video\")\n ? { name: \"video\", type: \"string\" as const, required: true, description: \"Video URL or file\" }\n : category.startsWith(\"audio\")\n ? { name: \"audio\", type: \"string\" as const, required: true, description: \"Audio URL or file\" }\n : { name: \"image\", type: \"string\" as const, required: true, description: \"Image URL or file\" };\n return {\n id,\n name,\n description,\n category,\n price: \"One credit per stage that runs\",\n inputTypes,\n params: [fileParam, ...scaleParam(maxScale)],\n };\n}\n\nexport const MODELS: ModelDefinition[] = [\n model(\"flare\", \"Flare\", \"Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.\", \"image-upscale\", [\"image/*\"], 4),\n model(\"prism\", \"Prism\", \"Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.\", \"image-upscale\", [\"image/*\"], 4),\n model(\"lumen\", \"Lumen\", \"Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.\", \"image-upscale\", [\"image/*\"], 8),\n model(\"mirage\", \"Mirage\", \"Invents plausible new detail rather than recovering what was there. Good for art, wrong for documents.\", \"image-upscale\", [\"image/*\"], 8),\n model(\"hush\", \"Hush\", \"Faithful denoise. Same size as the source, nothing invented.\", \"image-clean\", [\"image/*\"], 1),\n model(\"keen\", \"Keen\", \"Deblur and sharpen. Same size as the source, does not invent texture.\", \"image-restore\", [\"image/*\"], 1),\n model(\"visage\", \"Visage\", \"Restores faces and leaves the rest of the frame alone. Does not enlarge.\", \"image-restore\", [\"image/*\"], 1),\n 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),\n model(\"motion\", \"Motion\", \"Fast 4K finish for AI-generated video. Frame-consistent, does not invent faces.\", \"video-upscale\", [\"video/*\"], 4),\n model(\"motion-x\", \"Motion X\", \"Cinema-grade video upscale. Noticeably slower and dearer per second than Motion.\", \"video-upscale\", [\"video/*\"], 4),\n model(\"still\", \"Still\", \"Temporal video denoise. Resolution stays put.\", \"video-clean\", [\"video/*\"], 1),\n model(\"cadence\", \"Cadence\", \"Frame interpolation. Does not enlarge the picture.\", \"video-restore\", [\"video/*\"], 1),\n model(\"atelier-x\", \"Atelier X\", \"Still, then Motion X. Two credits.\", \"video-studio\", [\"video/*\"], 4),\n model(\"voice\", \"Voice\", \"Speech denoise and bandwidth extension to 48 kHz. Not for music.\", \"audio-clean\", [\"audio/*\"], 1),\n];\n\nexport const IMAGE_MODELS = MODELS.filter((m) => m.category.startsWith(\"image\"));\nexport const VIDEO_MODELS = MODELS.filter((m) => m.category.startsWith(\"video\"));\nexport const AUDIO_MODELS = MODELS.filter((m) => m.category.startsWith(\"audio\"));\nexport const DEFAULT_IMAGE_MODEL = \"flare\";\nexport const DEFAULT_VIDEO_MODEL = \"motion\";\nexport const DEFAULT_AUDIO_MODEL = \"voice\";\n"],"mappings":";AAOA,SAAS,WAAW,UAA6C;AAC/D,MAAI,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GAAG,CAAC;AAAA,EACrI,MAAM,WAAW,WAAW,mGAAmG,gBAAgB,CAAC,SAAS,GAAG,CAAC;AAAA,EAC7J,MAAM,UAAU,UAAU,mFAAmF,iBAAiB,CAAC,SAAS,GAAG,CAAC;AAAA,EAC5I,MAAM,YAAY,YAAY,oFAAoF,iBAAiB,CAAC,SAAS,GAAG,CAAC;AAAA,EACjJ,MAAM,SAAS,SAAS,iDAAiD,eAAe,CAAC,SAAS,GAAG,CAAC;AAAA,EACtG,MAAM,WAAW,WAAW,sDAAsD,iBAAiB,CAAC,SAAS,GAAG,CAAC;AAAA,EACjH,MAAM,aAAa,aAAa,sCAAsC,gBAAgB,CAAC,SAAS,GAAG,CAAC;AAAA,EACpG,MAAM,SAAS,SAAS,oEAAoE,eAAe,CAAC,SAAS,GAAG,CAAC;AAC3H;AAEO,IAAM,eAAe,OAAO,OAAO,CAAC,MAAM,EAAE,SAAS,WAAW,OAAO,CAAC;AACxE,IAAM,eAAe,OAAO,OAAO,CAAC,MAAM,EAAE,SAAS,WAAW,OAAO,CAAC;AACxE,IAAM,eAAe,OAAO,OAAO,CAAC,MAAM,EAAE,SAAS,WAAW,OAAO,CAAC;AACxE,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["// Auto-generated from https://api.upres.ai/v1/openapi.json\n\nexport type JobStatus = \"pending\" | \"processing\" | \"completed\" | \"failed\";\n\nexport type ModelCategory = \"image-upscale\" | \"image-enhance\" | \"video-upscale\";\n\nexport interface Job {\n id: string;\n status: JobStatus;\n model: string;\n scale: number;\n result_url: string | null;\n error: string | null;\n original_filename: string;\n created_at: string;\n updated_at: string;\n}\n\nexport interface JobCreateRequest {\n image_url?: string;\n model?: string;\n scale?: number;\n}\n\nexport interface JobListResponse {\n data: Job[];\n has_more: boolean;\n next_cursor: string | null;\n}\n\nexport interface ApiError {\n error: string;\n quota?: number;\n used?: number;\n}\n\nexport interface ModelParam {\n name: string;\n type: \"string\" | \"number\" | \"integer\" | \"boolean\";\n required: boolean;\n description: string;\n default?: string | number | boolean;\n options?: (string | number)[];\n range?: string;\n}\n\nexport interface ModelDefinition {\n id: string;\n name: string;\n description: string;\n category: ModelCategory;\n price: string;\n inputTypes: string[];\n params: ModelParam[];\n}\n\nexport interface UpresConfig {\n apiKey?: string;\n baseUrl?: string;\n}\n\nexport interface UpscaleOptions {\n model?: string;\n scale?: number;\n resolution?: string;\n output?: string;\n wait?: boolean;\n}\n\nexport interface BatchOptions extends UpscaleOptions {\n concurrency?: number;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["// Auto-generated from https://api.upres.ai/v1/openapi.json\n\nexport type JobStatus = \"pending\" | \"processing\" | \"completed\" | \"failed\";\n\nexport type ModelCategory =\n | \"image-upscale\"\n | \"image-clean\"\n | \"image-restore\"\n | \"image-studio\"\n | \"video-upscale\"\n | \"video-clean\"\n | \"video-restore\"\n | \"video-studio\"\n | \"audio-clean\";\n\nexport interface Job {\n id: string;\n status: JobStatus;\n model: string;\n scale: number;\n result_url: string | null;\n error: string | null;\n original_filename: string;\n created_at: string;\n updated_at: string;\n}\n\nexport interface JobCreateRequest {\n image_url?: string;\n model?: string;\n scale?: number;\n}\n\nexport interface JobListResponse {\n data: Job[];\n has_more: boolean;\n next_cursor: string | null;\n}\n\nexport interface ApiError {\n error: string;\n quota?: number;\n used?: number;\n}\n\nexport interface ModelParam {\n name: string;\n type: \"string\" | \"number\" | \"integer\" | \"boolean\";\n required: boolean;\n description: string;\n default?: string | number | boolean;\n options?: (string | number)[];\n range?: string;\n}\n\nexport interface ModelDefinition {\n id: string;\n name: string;\n description: string;\n category: ModelCategory;\n price: string;\n inputTypes: string[];\n params: ModelParam[];\n}\n\nexport interface UpresConfig {\n apiKey?: string;\n baseUrl?: string;\n}\n\nexport interface UpscaleOptions {\n model?: string;\n scale?: number;\n resolution?: string;\n output?: string;\n wait?: boolean;\n}\n\nexport interface BatchOptions extends UpscaleOptions {\n concurrency?: number;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
package/dist/types.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  type JobStatus = "pending" | "processing" | "completed" | "failed";
2
- type ModelCategory = "image-upscale" | "image-enhance" | "video-upscale";
2
+ type ModelCategory = "image-upscale" | "image-clean" | "image-restore" | "image-studio" | "video-upscale" | "video-clean" | "video-restore" | "video-studio" | "audio-clean";
3
3
  interface Job {
4
4
  id: string;
5
5
  status: JobStatus;
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  type JobStatus = "pending" | "processing" | "completed" | "failed";
2
- type ModelCategory = "image-upscale" | "image-enhance" | "video-upscale";
2
+ type ModelCategory = "image-upscale" | "image-clean" | "image-restore" | "image-studio" | "video-upscale" | "video-clean" | "video-restore" | "video-studio" | "audio-clean";
3
3
  interface Job {
4
4
  id: string;
5
5
  status: JobStatus;