Recraft V4.1 lands in Image Gin, and the freeze that charged us for nothing is gone
Recraft billed us for an image, then Obsidian froze before saving it. Image Gin now runs on Recraft V4.1 and writes images straight to disk.
Why Care?
Image Gin's headline command, Generate images for current file, asks Recraft for a banner, a portrait, a square, and whatever custom sizes you've defined, then drops them into your vault and links them in frontmatter. On October 6th it froze Obsidian solid. We assumed the API account had run dry. It hadn't: Recraft took the request, charged 40 credits, and handed back a perfectly good image. Then Image Gin hung before the file reached the disk.
That's the worst kind of bug: it costs you money and gives you nothing. Fixing it also exposed a quieter problem. We were still calling Recraft V3, and Recraft's newer models reject half of what we were sending.
What's New?
Recraft V4.1 is the default model. It's sharper, follows prompts better, takes prompts up to 10,000 characters, and costs $0.035 an image. The settings dropdown now lists the whole current lineup: V4.1, Pro (2K), Utility, Flash ($0.007, about 1.3 seconds), Vector (editable SVG), and the new V4 Styles line. V3 and V2 remain as legacy options.
Styles from reference images. V4 models drop Recraft's curated style menu. In its place you can paste a custom style ID or a list of up to ten style reference URLs, and pick flexible or precise matching. None of these had a settings field before.
Size presets work on every model. Each preset is sent as the nearest of Recraft's 14 supported aspect ratios (
2:1,9:16,4:3, …) instead of exact pixels. Exact pixel sizes differ per model and anything off the list gets rejected.No more freeze path. Downloaded image bytes go straight into the vault, the same way the Ideogram integration already does it.
Honest file names. Recraft sends WebP (and SVG for vector models). Files used to be saved as
.pngregardless; now the extension matches the bytes.Real error messages. If Recraft rejects a request, you see Recraft's explanation, not a generic "request failed".
Fails before it bills. Choosing a V4 Styles model without a style stops with a notice before any request goes out.
What went wrong, briefly
The plugin's log told the story. The request went out, a 200 came back with "credits": 40, the plugin logged "Downloading image from…", and then nothing. We re-fetched the same image URL by hand: 2.5 MB of WebP in half a second. So the network was fine and the stall was ours.
The old save path took the downloaded bytes, encoded them as a base64 string, and returned that string. It then decoded the string back into bytes one character at a time on Obsidian's main thread, wrote the result with a .png name, and repeated all of it for every selected size. The Ideogram integration, which has never frozen, does none of this: bytes in, bytes out. Recraft now uses the same path.
The full hypothesis log is in [[Recraft-Generation-Froze-Obsidian-and-the-V4-1-Upgrade]].
Under the hood
| Before (V3) | After (V4.1) | |
model | recraftv3 | recraftv4_1 (configurable) |
size | 2048x1024 (a V3-only pixel size) | 2:1 (valid on every model) |
| style | style + substyle (rejected by V4.1) | style_id or style_reference_urls, plus style_match |
| download | ArrayBuffer → base64 → atob loop → bytes | ArrayBuffer → vault |
| non-2xx | requestUrl throws a generic error | throw: false; Recraft's body goes into the notice |
| extension | always .png | from content-type, falling back to magic bytes |
RecraftImageService.buildStyleParams() chooses parameters by model family:
V2/V3: curated style, or a custom style ID
V4/V4.1: a style ID, else reference URLs, else no style
Flash: no style at all
V4 Styles: a style is required, otherwise it throws
When reference images are attached, Recraft returns a reusable style_id. We log it so it can be pasted into settings, which skips the $0.005 style-creation charge on later requests.
What's next
Verify in the vault. Switch the model to V4.1 Flash, select only Banner, and run it. The
losslessvault is still saved onrecraftv3, and saved settings win over the new default.Tests. Image Gin has never had any. A small harness with no new dependencies (esbuild plus Node's built-in test runner) is next. It will pin down the request shape for each model family against Recraft's docs.
Provider recipes. There are more image APIs every month. The issue doc sketches how Image Gin could read provider definitions from the vault's
zz-cf-lib/folder, the way Perplexed reads its templates and preambles. Adding or updating a provider would become a markdown edit instead of a plugin release.