@brotu/ai 0.5.0 → 0.6.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/CATALOG.md +298 -4
- package/README.md +5 -4
- package/dist/adapters/topaz.adapter.d.ts +71 -0
- package/dist/adapters/topaz.adapter.d.ts.map +1 -0
- package/dist/catalog.cjs +102 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +1 -1
- package/dist/{chunk-3MC3RDAJ.js → chunk-QQIHMDJC.js} +107 -2
- package/dist/client.d.ts +12 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +674 -32
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +544 -4
- package/dist/ports/content-generator.port.d.ts +12 -0
- package/dist/ports/content-generator.port.d.ts.map +1 -1
- package/dist/providers/topaz.models.d.ts +24 -0
- package/dist/providers/topaz.models.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -750,7 +750,7 @@ var imageOmni = {
|
|
|
750
750
|
prompt: input.prompt
|
|
751
751
|
};
|
|
752
752
|
if (images.length > 0) {
|
|
753
|
-
body.image_list = images.map((
|
|
753
|
+
body.image_list = images.map((image2) => ({ image: image2 }));
|
|
754
754
|
}
|
|
755
755
|
if (elements.length > 0) {
|
|
756
756
|
body.element_list = elements.map((id) => ({ element_id: id }));
|
|
@@ -1152,6 +1152,105 @@ var QWEN_CATALOG = [
|
|
|
1152
1152
|
)
|
|
1153
1153
|
];
|
|
1154
1154
|
|
|
1155
|
+
// src/providers/topaz.models.ts
|
|
1156
|
+
var VIDEO_RES = ["720p", "1080p", "4k"];
|
|
1157
|
+
function video(id, name, kind, description) {
|
|
1158
|
+
return [id, { name, vendorModel: id, surface: "video", kind, description }];
|
|
1159
|
+
}
|
|
1160
|
+
function image(id, name, vendorModel, imagePath, description) {
|
|
1161
|
+
return [
|
|
1162
|
+
id,
|
|
1163
|
+
{ name, vendorModel, surface: "image", imagePath, description }
|
|
1164
|
+
];
|
|
1165
|
+
}
|
|
1166
|
+
var ENTRIES = [
|
|
1167
|
+
// Precision video upscale (Proteus family)
|
|
1168
|
+
video("prob-4", "Proteus", "upscale", "Default video upscale. Preserves the source."),
|
|
1169
|
+
video("pnat-1", "Proteus Natural", "upscale", "Softer Proteus. 2\xD7 only."),
|
|
1170
|
+
video("rhea-1", "Rhea", "upscale", "High-fidelity 4\xD7 upscale for fine detail."),
|
|
1171
|
+
video("thd-3", "Theia Fine Tune Detail", "upscale", "More aggressive detail."),
|
|
1172
|
+
video("thf-4", "Theia Fine Tune Fidelity", "upscale", "Lighter touch, closer to the source."),
|
|
1173
|
+
video("thm-2", "Themis 2", "upscale", "Motion deblur."),
|
|
1174
|
+
video("aaa-9", "Artemis Aliasing / Moire", "upscale", "Aliasing and moire cleanup."),
|
|
1175
|
+
video("ahq-12", "Artemis High Quality", "upscale", "Artemis for clean footage."),
|
|
1176
|
+
video("amq-13", "Artemis Medium Quality", "upscale", "Artemis for typical compression."),
|
|
1177
|
+
video("amqs-2", "Artemis Medium Halo", "upscale", "Medium halo reduction."),
|
|
1178
|
+
video("alq-13", "Artemis Low Quality", "upscale", "Artemis for degraded sources."),
|
|
1179
|
+
video("alqs-2", "Artemis Strong Halo", "upscale", "Strong halo reduction."),
|
|
1180
|
+
video("iris-3", "Iris Medium Quality", "upscale", "Face recovery, medium quality."),
|
|
1181
|
+
video("iris-2", "Iris Low Quality", "upscale", "Face recovery, low quality."),
|
|
1182
|
+
video("dtv-4", "Dione TV", "upscale", "Deinterlace broadcast footage."),
|
|
1183
|
+
video("ddv-3", "Dione DV", "upscale", "Deinterlace camcorder footage."),
|
|
1184
|
+
video("dtvs-2", "Dione Robust", "upscale", "Deinterlace degraded interlaced sources."),
|
|
1185
|
+
video("dtd-4", "Dione Dehalo", "upscale", "Deinterlace with halo cleanup."),
|
|
1186
|
+
video("dtds-2", "Dione Robust Dehalo", "upscale", "Deinterlace, degraded, with halo cleanup."),
|
|
1187
|
+
video("ghq-5", "Gaia High Quality", "upscale", "CGI and animation, high quality."),
|
|
1188
|
+
video("gcg-5", "Gaia CG", "upscale", "General CGI and renders."),
|
|
1189
|
+
video("nyx-3", "Nyx", "upscale", "Default video denoise."),
|
|
1190
|
+
video("nxl-1", "Nyx XL", "upscale", "Heavy video denoise."),
|
|
1191
|
+
video("nxhf-1", "Nyx High Fidelity", "upscale", "Light denoise, keep texture."),
|
|
1192
|
+
video("nxf-1", "Nyx Fast", "upscale", "Fast video denoise."),
|
|
1193
|
+
video("color-1", "Video Colorization", "upscale", "Black-and-white to color."),
|
|
1194
|
+
// Generative / creative video
|
|
1195
|
+
video("slp-2.6", "Starlight Precise 2.6", "upscale", "Generative upscale to 4K. Faces, texture, text."),
|
|
1196
|
+
video("slhq-1", "Starlight HQ", "upscale", "Maximum quality generative enhance."),
|
|
1197
|
+
video("slf-2", "Starlight Fast 2", "upscale", "Faster generative upscale."),
|
|
1198
|
+
video("slm-1", "Starlight Mini", "upscale", "Archival and interlaced restoration."),
|
|
1199
|
+
video("wonder-1", "Starlight Sharp", "upscale", "Local-first sharpening restore."),
|
|
1200
|
+
video("ast-2", "Astra 2", "upscale", "Creative GenAI video upscale."),
|
|
1201
|
+
// Frame interpolation — not upscalers
|
|
1202
|
+
video("aion-1", "Aion", "interpolation", "Extreme slow motion on complex, high-res motion."),
|
|
1203
|
+
video("apo-8", "Apollo", "interpolation", "Default slow-mo and frame-rate conversion."),
|
|
1204
|
+
video("apf-2", "Apollo Fast", "interpolation", "Faster Apollo."),
|
|
1205
|
+
video("chr-2", "Chronos", "interpolation", "Interpolation for harder motion."),
|
|
1206
|
+
video("chf-3", "Chronos Fast", "interpolation", "Faster Chronos."),
|
|
1207
|
+
// Image — Gigapixel / enhance
|
|
1208
|
+
image("standard-v2", "Standard 2", "Standard V2", "/image/v1/enhance/async", "Default image upscale."),
|
|
1209
|
+
image("high-fidelity-v2", "High Fidelity 2", "High Fidelity V2", "/image/v1/enhance/async", "Maximum source preservation."),
|
|
1210
|
+
image("low-resolution-v2", "Low Resolution 2", "Low Resolution V2", "/image/v1/enhance/async", "Tiny or heavily compressed sources."),
|
|
1211
|
+
image("cgi", "Art & CGI", "CGI", "/image/v1/enhance/async", "Illustrations, renders, game art."),
|
|
1212
|
+
image("text-refine", "Text & Shapes", "Text Refine", "/image/v1/enhance/async", "Documents, screenshots, type."),
|
|
1213
|
+
// Image — generative enhance
|
|
1214
|
+
image("standard-max", "Standard Max", "Standard MAX", "/image/v1/enhance-gen/async", "Default generative image upscale."),
|
|
1215
|
+
image("wonder", "Wonder", "Wonder", "/image/v1/enhance-gen/async", "One-click generative restore."),
|
|
1216
|
+
image("wonder-3.5", "Wonder 3.5", "Wonder 3.5", "/image/v1/enhance-gen/async", "Highest-quality generative image upscale."),
|
|
1217
|
+
image("redefine", "Redefine", "Redefine", "/image/v1/enhance-gen/async", "Prompt-guided generative enhance."),
|
|
1218
|
+
image("recovery-v2", "Recover 3", "Recovery V2", "/image/v1/enhance-gen/async", "Heavily damaged sources."),
|
|
1219
|
+
image("bloom-2", "Bloom 2", "Bloom 2", "/image/v1/enhance-gen/async", "Creative upscale for GenAI images."),
|
|
1220
|
+
image("denoise-max", "Denoise Max", "Denoise Max", "/image/v1/denoise-gen/async", "Highest-quality image denoise.")
|
|
1221
|
+
];
|
|
1222
|
+
var TOPAZ_MODELS = Object.fromEntries(
|
|
1223
|
+
ENTRIES.flatMap(([id, binding]) => {
|
|
1224
|
+
const rows = [[id, binding]];
|
|
1225
|
+
if (binding.surface === "image" && binding.vendorModel !== id) {
|
|
1226
|
+
rows.push([binding.vendorModel, binding]);
|
|
1227
|
+
}
|
|
1228
|
+
return rows;
|
|
1229
|
+
})
|
|
1230
|
+
);
|
|
1231
|
+
function nodeTypes(binding) {
|
|
1232
|
+
if (binding.surface === "image") return ["image_upscale"];
|
|
1233
|
+
return binding.kind === "interpolation" ? ["video_gen"] : ["video_upscale"];
|
|
1234
|
+
}
|
|
1235
|
+
var TOPAZ_CATALOG = ENTRIES.map(([id, binding]) => ({
|
|
1236
|
+
id,
|
|
1237
|
+
name: binding.name,
|
|
1238
|
+
category: binding.surface,
|
|
1239
|
+
inputType: binding.surface === "video" ? "video_required" : "image_required",
|
|
1240
|
+
nodeTypes: nodeTypes(binding),
|
|
1241
|
+
creditsPerUnit: 0,
|
|
1242
|
+
creditUnit: binding.surface === "video" ? "second" : "image",
|
|
1243
|
+
supportedResolutions: binding.surface === "video" ? [...VIDEO_RES] : void 0,
|
|
1244
|
+
provider: "topaz",
|
|
1245
|
+
description: binding.description
|
|
1246
|
+
}));
|
|
1247
|
+
var TOPAZ_VIDEO_MODELS = Object.fromEntries(
|
|
1248
|
+
ENTRIES.filter(([, binding]) => binding.surface === "video")
|
|
1249
|
+
);
|
|
1250
|
+
var TOPAZ_IMAGE_MODELS = Object.fromEntries(
|
|
1251
|
+
ENTRIES.filter(([, binding]) => binding.surface === "image")
|
|
1252
|
+
);
|
|
1253
|
+
|
|
1155
1254
|
// src/catalog.ts
|
|
1156
1255
|
var PROVIDER_BASE_URLS = {
|
|
1157
1256
|
byteplus: "https://ark.ap-southeast.bytepluses.com",
|
|
@@ -1160,6 +1259,7 @@ var PROVIDER_BASE_URLS = {
|
|
|
1160
1259
|
google: "https://generativelanguage.googleapis.com",
|
|
1161
1260
|
openai: "https://api.openai.com",
|
|
1162
1261
|
qwen: "https://dashscope-intl.aliyuncs.com",
|
|
1262
|
+
topaz: "https://api.topazlabs.com",
|
|
1163
1263
|
brotu: "https://api.brotu.app"
|
|
1164
1264
|
};
|
|
1165
1265
|
var DEFAULT_BROTU_API_URL = PROVIDER_BASE_URLS.brotu;
|
|
@@ -1177,7 +1277,8 @@ var BUILT_IN = [
|
|
|
1177
1277
|
...QWEN_CATALOG,
|
|
1178
1278
|
...OPENAI_CATALOG,
|
|
1179
1279
|
...GOOGLE_CATALOG,
|
|
1180
|
-
...ELEVENLABS_CATALOG
|
|
1280
|
+
...ELEVENLABS_CATALOG,
|
|
1281
|
+
...TOPAZ_CATALOG
|
|
1181
1282
|
];
|
|
1182
1283
|
var catalog = BUILT_IN;
|
|
1183
1284
|
var catalogMap = byId(BUILT_IN);
|
|
@@ -1316,6 +1417,10 @@ export {
|
|
|
1316
1417
|
QWEN_AUDIO_MODELS,
|
|
1317
1418
|
QWEN_TEXT_MODELS,
|
|
1318
1419
|
QWEN_CATALOG,
|
|
1420
|
+
TOPAZ_MODELS,
|
|
1421
|
+
TOPAZ_CATALOG,
|
|
1422
|
+
TOPAZ_VIDEO_MODELS,
|
|
1423
|
+
TOPAZ_IMAGE_MODELS,
|
|
1319
1424
|
DEFAULT_BROTU_API_URL,
|
|
1320
1425
|
registerModels,
|
|
1321
1426
|
resetCatalog,
|
package/dist/client.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import type { AIModelConfig } from "./constants/model.types";
|
|
|
3
3
|
import { type AIError, type Generation, type Result } from "./helpers/result";
|
|
4
4
|
import { type Job, type JobSnapshot } from "./lib/jobs";
|
|
5
5
|
import { type WebhookConfig } from "./lib/webhook";
|
|
6
|
-
import type { AudioGenerationParams, CostEstimate, GenerationOutput, GenerationParams, GenerationType, ImageGenerationParams, TextGenerationParams, VideoGenerationParams } from "./ports/content-generator.port";
|
|
6
|
+
import type { AudioGenerationParams, CostEstimate, GenerationOutput, GenerationParams, GenerationType, ImageGenerationParams, ImageUpscaleParams, TextGenerationParams, VideoGenerationParams, VideoUpscaleParams } from "./ports/content-generator.port";
|
|
7
7
|
import { type AvatarInput, type ImageOmniInput, type MotionControlInput, type OmniVideoInput, type OutpaintingInput } from "./providers/kling.models";
|
|
8
8
|
import type { BrotuAIOptions } from "./types";
|
|
9
9
|
/** Providers this package ships an adapter for. */
|
|
10
|
-
export declare const NATIVE_PROVIDERS: readonly ["byteplus", "elevenlabs", "google", "kling", "openai", "qwen"];
|
|
10
|
+
export declare const NATIVE_PROVIDERS: readonly ["byteplus", "elevenlabs", "google", "kling", "openai", "qwen", "topaz"];
|
|
11
11
|
export interface BrotuAI {
|
|
12
12
|
image: {
|
|
13
13
|
/** Queue the work and return a handle. Only the submit is awaited. */
|
|
@@ -20,11 +20,21 @@ export interface BrotuAI {
|
|
|
20
20
|
* models stay in the list, with `reason`, so the gap is visible.
|
|
21
21
|
*/
|
|
22
22
|
list(): ModelAvailability[];
|
|
23
|
+
/**
|
|
24
|
+
* Enhance a still you already have. `imageUrl` is required; `prompt` is
|
|
25
|
+
* optional. Waits for the result — image upscale is usually seconds.
|
|
26
|
+
*/
|
|
27
|
+
upscale(params: ImageUpscaleParams): Promise<Result<Generation>>;
|
|
23
28
|
};
|
|
24
29
|
video: {
|
|
25
30
|
submit(params: VideoGenerationParams): Promise<Result<Job>>;
|
|
26
31
|
generate(params: VideoGenerationParams): Promise<Result<Generation>>;
|
|
27
32
|
list(): ModelAvailability[];
|
|
33
|
+
/**
|
|
34
|
+
* Enhance a video you already have. `videoUrl` is required; `prompt` is
|
|
35
|
+
* optional. Returns a handle — video upscale takes minutes.
|
|
36
|
+
*/
|
|
37
|
+
upscale(params: VideoUpscaleParams): Promise<Result<Job>>;
|
|
28
38
|
};
|
|
29
39
|
text: {
|
|
30
40
|
submit(params: TextGenerationParams): Promise<Result<Job>>;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAQA,OAAO,EAGN,QAAQ,EACR,KAAK,iBAAiB,EAGtB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EACN,KAAK,OAAO,EAGZ,KAAK,UAAU,EAEf,KAAK,MAAM,EACX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEN,KAAK,GAAG,EACR,KAAK,WAAW,EAEhB,MAAM,YAAY,CAAC;AAE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