dsh-fal-imagegen: Direct Image Generation via fal.ai Queue in DSH

Preface

In DeepSeek Harness (DSH), a common approach to let the Agent generate images is to wrap another layer of an OpenAI-compatible gateway that translates fal.ai’s queue protocol into the generic Chat Completions or Images API. With an extra forwarding layer, debugging requires checking the gateway configuration, the fal endpoint slug, and DSH tool parameters all at once, and error points get scattered.

dsh-fal-imagegen (maintainer Enchanted0911, GitHub: Enchanted0911/dsh-fal-imagegen) takes a different path: the Agent tool directly does POST https://queue.fal.run/<slug>, submits tasks using the Authorization: Key <key_id>:<key_secret> form from the fal documentation, polls the queue ticket, and consumes { images: [{ url, width, height }] }. The settings page provides a FAL_KEY card, consistent with the dsh-fal-imagegen: section in ~/.dsh/settings.yaml. The npm package version is 0.2.1, license MIT.

What This Is

In one sentence: a fal.ai-native text-to-image / image-to-image plugin for DSH—a settings card plus four Agent tools, without going through an OpenAI-compatible middle layer.

It is categorized as “model inference”: inference requests are sent to the fal queue, and results come back to the conversation in two forms—attachments and local files.

Core Features

Native fal Protocol

The toolchain works according to fal queue semantics: submit → get status_url / response_url → poll → parse images[]. The key format is the full string key_id:key_secret copied from the fal.ai → Keys page.

Settings Card

The entry point is Settings → Plugins; the name displays as “fal 生图” or “fal imagegen” according to the DSH language (consistent with Settings → General → Language; English when no match is found). The card has the same interactions as built-in plugins: collapse, dirty state, field-level reset, save/discard.

Main configuration items (default values in the table below):

Field Default Meaning
enabled true Master switch (tools + system prompt announcement)
falKey empty FAL_KEY; leaving it empty means not modifying the saved key
defaultTextToImageModel openai/gpt-image-2.5/flare/text-to-image Text-to-image endpoint
defaultImageToImageModel openai/gpt-image-2.5/flare/edit Image-to-image endpoint
defaultImageSize 1:1 Ratio, WxH, or auto
quality high auto / low / medium / high / xhigh / max
outputFormat png png / jpeg / webp
timeoutSeconds 300 Total timeout per request (submit + queue + fetch)
saveDir empty Disk directory; if empty, <DSH_HOME>/fal-imagegen
announceToAgent true Whether to announce this plugin in the Agent system prompt

Agent Tools

Tool Purpose
fal_generate_image Text-to-image; async by default, parameters include prompt / model / size / quality / count / wait
fal_get_image_task Query progress by task_id or fal request_id; list recent tasks when no id is given
fal_edit_image Image-to-image, synchronous; requires prompt and an attachment reference or disk image_path
fal_list_image_models List built-in aliases, current defaults, and the output directory

Generated images are attached to the conversation (rendered next to the tool call) and written to the output directory; the returned path can be passed directly to fal_edit_image’s image_path.

Asynchronous Text-to-Image

By default, the Agent no longer waits the entire turn for the fal queue:

  1. fal_generate_image returns { status: "queued", task_id, request_id, ... } immediately after submission.
  2. A background collector polls the queue, downloads the images, writes the attachment, and copies them to the output directory.
  3. fal_get_image_task reports queued / running / completed / failed; with wait_seconds set to 0–120 it can block and wait, returning images[] with attachment_id and local path upon completion.
  4. When the old blocking behavior is needed, pass wait=true to fal_generate_image.

Task records are kept in the current dsh process (roughly retained for 6 hours, latest 64 entries); after a background wait times out, the next query automatically retries. fal_edit_image remains synchronous to facilitate chained editing.

Model Aliases

Built-in aliases have been matched against fal endpoint schemas; unknown slugs containing / are passed through as-is; a text-to-image slug mistakenly used for editing will be rejected. A partial list:

Alias Text-to-Image Image-to-Image
gpt-image-2.5-flare (default, also accepts gpt-image-2.5 / gpt-image-2.5-flash) openai/gpt-image-2.5/flare/text-to-image openai/gpt-image-2.5/flare/edit
flux-2-flash fal-ai/flux-2/flash fal-ai/flux-2/flash/edit
nano-banana-2 fal-ai/nano-banana-2 fal-ai/nano-banana-2/edit

For the full table, see the Model aliases section in the repository README.

Installation and Activation

Installation via the npm package is recommended (CLI-managed profiles):

dsh plugin --profile web add dsh-fal-imagegen

After installation, the DSH process of the corresponding profile needs to be restarted.

The desktop profile is managed by the DSH Desktop app (dsh plugin --profile desktop will be rejected): it should be installed via Settings → Plugins → market, or manually registered under ~/.dsh/profiles/des… following the README (for the truncated part, refer to the original GitHub text).

Once enabled, first fill in falKey in the settings card or settings.yaml, and confirm that enabled is true.

Typical Usage

The following steps can be reproduced in an Agent conversation (the exact wording depends on the model; the tool names are fixed).

Text-to-image (async, recommended)

  1. Call fal_generate_image, e.g. with a prompt describing the scene, and optionally model alias, size, quality.
  2. Note the returned task_id.
  3. Call fal_get_image_task, passing in task_id; set wait_seconds if you need to wait for completion.
  4. Use images[].path or the attachment id in the completed result for subsequent steps.

Image-to-image (synchronous)

  1. Prepare the source image: a conversation attachment reference, or a image_path saved to disk from the previous step.
  2. Call fal_edit_image, passing prompt and the source image parameters.
  3. Use the returned image path within the same turn to continue editing.

View defaults and aliases

Calling fal_list_image_models lets you check the current default endpoint, the alias list, and the output directory.

Use Cases and Notes

Suitable for developers who already have a fal.ai API set up and want to use queue-based image generation/editing natively within a DSH Agent. The async default is better suited to long queues, avoiding a single generation holding up the Agent turn; short-chain image-to-image still uses the synchronous fal_edit_image.

Before installing, it is recommended to read the GitHub repository source code and the MIT license yourself. The plugin runs with the user and network permissions of the current dsh process: the key is written to local configuration, images are written to saveDir or the default directory, and outbound requests are made to queue.fal.run. The community plugin directory SkillHub entry has no official affiliation with DeepSeek / High-Flyer and serves only as discovery and indexing.

The DSH ecosystem emphasizes “everything is a plugin”; this plugin belongs to the community “model inference” category of extensions. Star counts and popularity are subject to real-time data on the repository page.

Links

  • Directory page: https://www.skillhub.cn/plugins/Enchanted0911/dsh-fal-imagegen
  • GitHub: https://github.com/Enchanted0911/dsh-fal-imagegen
  • npm: dsh-fal-imagegen@0.2.1
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye