Skip to content

feat: codemode-imagegen package, create, edit and models across seven providers (SHFT-2966) - #103

Merged
Michaelliv merged 5 commits into
mainfrom
feat/SHFT-2966-imagegen-package
Nov 23, 2026
Merged

Michaelliv merged 5 commits into
mainfrom
feat/SHFT-2966-imagegen-package

Conversation

@Michaelliv

@Michaelliv Michaelliv commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Adds @shiftlabs/codemode-imagegen: one plugin, imagegen, that makes and edits images through the image provider the connection chooses.

Actions

  • imagegen.create({ prompt, model?, width?, height?, numImages? })
  • imagegen.edit({ prompt, images, model?, width?, height?, numImages? })
  • imagegen.models({ query?, limit? })

create and edit write each image to the host's output directory and return { provider, model, images: [{ path, mimeType, byteLength, width?, height? }] }. The size reported is read from the bytes.

Design

  • The connection resolves the provider (provider, else the first with a key). No action has a provider input.
  • One static credential with an optional part per provider, each placed only on that provider's targets, so a key goes to its own provider alone.
  • A provider is data plus generate, and a host adds its own with imagegen([mine, ...PROVIDERS]).
  • Size is in pixels for every provider and is translated to the nearest size, aspect ratio or bounded pixels each model takes.
  • Models are the package's list with the provider's live list laid over it, kept ten minutes per connection. A named model is checked before anything is made.
  • fal and Replicate read each model's published input schema to find its prompt, count, size and image fields.
  • An image to edit is identified by its bytes, never its file name: PNG, JPEG or WebP.
  • On Replicate an image to edit is uploaded as a file and the model gets its address. On fal it goes inside the request.

Providers

openai, google, xai, recraft, together, fal, replicate, in that order.

Checked against each provider's own docs on 23 Nov 2026. Corrections from that check are in this PR: retired OpenAI and Together models, Together's address and side range, OpenAI's 1:3 to 3:1 aspect bound, fal's status_url/response_url, Replicate's aborted state and search tags, Recraft's utility models.

Also in this PR

readLocalFile moves from codemode-plugins/_shared to @shiftlabs/codemode so a package can use it. The nine bundled callers import it from there.

Not proven

No image has been made with a working key. Request shapes come from provider docs and stubbed hosts. Least certain:

  • Together's GET /v1/models is not in its docs or SDK (a failure falls back to the built-in list), and its docs do not say whether edits accept data URLs.
  • Replicate's upload hand-off (urls.get) is taken from its JavaScript client, not its HTTP reference.
  • Replicate's search tag names are documented by one example.

The bundled together and openai plugins carry the same stale models: SHFT-2983.

Tests

46 in the package; all repository gates pass.

@Michaelliv
Michaelliv merged commit 5dacc9b into main Nov 23, 2026
1 check passed
@Michaelliv
Michaelliv deleted the feat/SHFT-2966-imagegen-package branch November 23, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant