Separate binary image storage from the n8n job table

When an n8n workflow calls CometAPI’s image-generation endpoint, the image is not the same kind of data as the job metadata around it. Keep those responsibilities separate: let the job table track what was requested and where the finished asset lives, while binary storage holds the image itself.

The CometAPI image branch

The official CometAPI n8n guide sends the image request to:

https://api.cometapi.com/v1/images/generations

In the guide’s example, the response image is read from data[0].b64_json. That base64 value is the handoff point for the next n8n step—not a field to copy into a long-lived job row.

A practical branch is:

  1. Call CometAPI and confirm that the expected image data exists.
  2. Convert the base64 payload into an n8n binary item.
  3. Upload that binary item to object storage, such as S3 or Google Drive.
  4. Upsert the job record with the resulting file URL in result_url.
  5. Mark the job complete only after the storage step succeeds.

This keeps the record useful for orchestration: prompt or request metadata, status, timestamps, and result_url remain easy to query, while the potentially large image travels through a storage-oriented path.

Make the handoff explicit

Treat generation and upload as two different failure boundaries. If CometAPI returns an image but the upload fails, the job has not failed at generation; it has failed at persistence. Record that distinction and retry the upload according to the workflow’s policy instead of automatically requesting a second image. Otherwise a temporary storage problem can create duplicate creative outputs and make the job table misleading.

The guide’s example uses an image/png binary item, but a workflow should verify the actual format before assigning a MIME type or choosing a file extension. Model behavior and response support still need live verification for the model selected by the implementation; the documented endpoint and response field are not a promise that every image model behaves identically.

The result is a clean boundary for downstream creative work: CometAPI generates the image, n8n moves the binary asset to durable storage, and the job table records the reference that later steps can consume. The design is deliberately narrower than a claim about universal model support, storage performance, or cost savings—those require separate testing.

For a voice interface that triggers this CometAPI image branch, I would separate “asset stored” from “still relevant to the current turn.” A user could request an image, then interrupt with a different prompt while the first generation or upload is still running. Successful persistence alone should not let the older result replace the newer request on screen—or trigger a spoken “your image is ready.”

A proposed application-side guard is to carry a session ID and turn revision alongside the job ID, then check that revision again immediately before presenting the stored asset or queuing its spoken announcement. If the turn has been superseded, retain the asset reference according to the application’s retention policy but suppress that delivery. This does not require assuming that CometAPI can cancel an in-flight generation; cancellation of presentation is a separate decision.

The useful test is deliberately out-of-order completion: request A, interrupt with B, let B finish first, then finish A. Both storage records may be valid, but only B should update the active turn. That tests interruption correctness rather than just whether the image reached object storage.