@ohmygame/fal 0.2.0 → 0.3.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.
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "$schema": "https://www.ohmygame.ai/schema/plugin-2.json",
3
3
  "id": "ohmygame/fal",
4
- "version": "0.2.0",
4
+ "beta": true,
5
+ "version": "0.3.0",
5
6
  "engines": {
6
- "ohmygame-api": "^2.5.0"
7
+ "ohmygame-api": "^2.27.0"
7
8
  },
8
9
  "displayName": "%plugin.name%",
9
10
  "description": "%plugin.description%",
@@ -60,7 +61,11 @@
60
61
  ],
61
62
  "maxReferenceImages": 0
62
63
  }
63
- ]
64
+ ],
65
+ "backgroundRemoval": {
66
+ "id": "fal-ai/birefnet",
67
+ "title": "BiRefNet"
68
+ }
64
69
  },
65
70
  "video": {
66
71
  "discoverModels": true,
package/README.md CHANGED
@@ -8,12 +8,13 @@ pictures, videos, audio and 3D models. It has no chat models.
8
8
  | Kind | Model | What it takes |
9
9
  | --- | --- | --- |
10
10
  | Image | FLUX.1 [schnell] (`fal-ai/flux/schnell`) | A prompt, in 1:1, 4:3, 3:4, 16:9 or 9:16 |
11
+ | Background removal | BiRefNet (`fal-ai/birefnet`) | One still PNG, JPEG or WebP; preserves dimensions and colors |
11
12
  | Video | Kling O3 (`fal-ai/kling-video/o3/standard/image-to-video`) | A first frame, an optional last frame, and 3, 5, 10 or 15 seconds |
12
13
  | Speech | MiniMax Speech-02 HD (`fal-ai/minimax/speech-02-hd`) | Up to 5,000 characters, in one of MiniMax's voices, as MP3 |
13
14
  | Sound effects, music | Stable Audio (`fal-ai/stable-audio`) | A description and up to 47 seconds, as WAV |
14
15
  | 3D | TRELLIS (`fal-ai/trellis`) | One picture of the object, as GLB |
15
16
 
16
- These are on from the start. To use more of fal.ai's models, open the fal.ai
17
+ Generation models are on from the start. Background removal has its own processing picker and does not change the default image model. To use more of fal.ai's models, open the fal.ai
17
18
  provider in Settings → Providers and choose **Load models** under a kind: the
18
19
  plugin reads fal.ai's most used models of that kind and what each one takes
19
20
  (aspect ratios, lengths, voices, how many pictures), and you turn on the ones
@@ -27,6 +28,45 @@ fal.ai's files are on, and OhMyGame adds the key to its requests. A video,
27
28
  audio file or 3D model a restart cut off is checked again on **Retry**, not
28
29
  paid for twice. fal.ai bills each request to your account.
29
30
 
30
- Needs OhMyGame with plugin API 2.5.0 or later.
31
+ Needs OhMyGame with plugin API 2.27.0 or later. Version 0.3.0 remains Beta.
31
32
 
32
33
  Published as `@ohmygame/fal` from [ohmygame-plugins](https://github.com/WhiteTowerAI/ohmygame-plugins).
34
+
35
+ ## Background removal
36
+
37
+ On an image's canvas toolbar, choose **Image tools → Remove background**
38
+ (中文:**图片工具 → 去除背景**), choose **BiRefNet**, then generate. Creation alone
39
+ does not send a paid request. The existing **AI image cutout** remains a prompted
40
+ redraw using an image generation model.
41
+
42
+ The plugin uses the [official BiRefNet queue API](https://fal.ai/models/fal-ai/birefnet/api),
43
+ General Use (Light), its default 1024×1024 operating resolution, PNG output,
44
+ `sync_mode: false` to retain request history and `refine_foreground: false`.
45
+ Operating resolution is internal to the model; the returned alpha must match the
46
+ source dimensions. OhMyGame applies that alpha to the normalized source RGB and
47
+ existing alpha, rejects resized/opaque/empty outputs and never substitutes a new
48
+ paid request after an uncertain failure. The source is limited to a still
49
+ PNG/JPEG/WebP up to 20 MiB and 64 million pixels; EXIF orientation and sRGB
50
+ normalization happen before submission. Edge quality still needs inspection on
51
+ your own artwork, especially hair, small sprites and existing transparency.
52
+
53
+ Closing the app or stopping locally keeps the queued task; **Retry** resumes it.
54
+ A failed result download or import keeps its receipt too. Do not create a second
55
+ node to recover an uncertain submission. Inputs are sent to fal.ai using the
56
+ existing key and approved hosts; no additional permissions or callback setup
57
+ are needed. An output on a host outside the existing allowlist fails explicitly;
58
+ report the hostname instead of granting a wildcard.
59
+
60
+ ### Local acceptance
61
+
62
+ - Upgrade with the current app; confirm the existing key, provider switch,
63
+ image default and model visibility are retained.
64
+ - Process a non-square JPG, a detailed PNG and a WebP; inspect foreground edges,
65
+ dimensions, source colors and transparent PNG export. Try an already
66
+ transparent source and confirm its existing alpha remains respected.
67
+ - Stop a queued cutout, then Retry; also quit/reopen during a queued job and
68
+ Retry. Confirm in fal.ai request history that the same request is resumed.
69
+ - Disconnect before downloading the result, reconnect and Retry; no second
70
+ submission should appear. Check explicit failure for invalid/opaque results.
71
+ - Confirm ordinary image generation and existing video/audio/3D selections
72
+ still work. BiRefNet must not appear among image generation defaults.
package/locales/en.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "plugin.name": "fal.ai",
3
3
  "plugin.description": "fal.ai's image, video, audio and 3D models, with your own API key.",
4
- "plugin.longDescription": "Adds fal.ai to Settings → Providers. Enter your API key here or in Settings: FLUX.1 [schnell] makes pictures, Kling O3 makes videos of 3 to 15 seconds from a first frame (and a last one if you give it), MiniMax Speech-02 HD reads text aloud, Stable Audio makes sound effects and music, and TRELLIS makes a 3D model from a picture. fal.ai bills each request to your account. To use more of fal.ai's models, choose Load models on its page in Settings and turn on the ones you want.",
4
+ "plugin.longDescription": "Adds fal.ai to Settings → Providers. Enter your API key here or in Settings: FLUX.1 [schnell] makes pictures, Kling O3 makes videos of 3 to 15 seconds from a first frame (and a last one if you give it), MiniMax Speech-02 HD reads text aloud, Stable Audio makes sound effects and music, and TRELLIS makes a 3D model from a picture. fal.ai bills each request to your account. To use more of fal.ai's models, choose Load models on its page in Settings and turn on the ones you want. BiRefNet removes image backgrounds from the canvas while preserving the source dimensions and colors. This is separate from AI redraw cutout and requires OhMyGame API 2.27.",
5
5
  "config.apiKey.title": "fal.ai API key",
6
6
  "config.apiKey.description": "From fal.ai → Dashboard → Keys."
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "plugin.name": "fal.ai",
3
3
  "plugin.description": "用你自己的 API key,使用 fal.ai 的图片、视频、音频和 3D 模型。",
4
- "plugin.longDescription": "把 fal.ai 加入 设置 → 服务商。在这里或设置里填好 API key:FLUX.1 [schnell] 生成图片,Kling O3 根据首帧(可加尾帧)生成 3 到 15 秒的视频,MiniMax Speech-02 HD 朗读文本,Stable Audio 生成音效和音乐,TRELLIS 根据图片生成 3D 模型。每次请求由 fal.ai 向你的账户计费。想用 fal.ai 的更多模型,在设置里它的页面点「读取模型」,再勾选要用的。",
4
+ "plugin.longDescription": "把 fal.ai 加入 设置 → 服务商。在这里或设置里填好 API key:FLUX.1 [schnell] 生成图片,Kling O3 根据首帧(可加尾帧)生成 3 到 15 秒的视频,MiniMax Speech-02 HD 朗读文本,Stable Audio 生成音效和音乐,TRELLIS 根据图片生成 3D 模型。每次请求由 fal.ai 向你的账户计费。想用 fal.ai 的更多模型,在设置里它的页面点「读取模型」,再勾选要用的。 BiRefNet 可在画布中去除图片背景,保留原图尺寸和颜色。它与 AI 重绘抠图独立,需要 OhMyGame API 2.27。",
5
5
  "config.apiKey.title": "fal.ai API key",
6
6
  "config.apiKey.description": "在 fal.ai → Dashboard → Keys 创建。"
7
7
  }
package/media/adapter.js CHANGED
@@ -499,7 +499,22 @@ async function listModels(kind, host) {
499
499
  export default {
500
500
  image: {
501
501
  models: (host) => listModels("image", host),
502
- start(input, host) {
502
+ async start(input, host) {
503
+ if (input.operation === "remove-background") {
504
+ if (input.model !== "fal-ai/birefnet" || !input.image || typeof input.image.file !== "string")
505
+ return { error: "Choose BiRefNet and one source image" };
506
+ const result = await submit("fal-ai/birefnet", {
507
+ image_url: { $mediaFile: input.image.file },
508
+ model: "General Use (Light)",
509
+ operating_resolution: "1024x1024",
510
+ output_format: "png",
511
+ sync_mode: false,
512
+ refine_foreground: false,
513
+ }, host, [["image", "url"]]);
514
+ // Stop waiting locally while preserving queue ownership for Retry.
515
+ if (result.task) delete result.task.cancel;
516
+ return result;
517
+ }
503
518
  if (input.modelData) return startListed("image", input, host);
504
519
  return submit(input.model, {
505
520
  prompt: input.prompt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmygame/fal",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "fal.ai's image, video, audio and 3D models, with your own API key.",
5
5
  "keywords": [
6
6
  "ohmygame-plugin",
@@ -26,7 +26,7 @@
26
26
  "pack": "ohmygame-plugin pack"
27
27
  },
28
28
  "devDependencies": {
29
- "@ohmygame/plugin-cli": "^2.5.0"
29
+ "@ohmygame/plugin-cli": "^2.27.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"