pixlstash-lmstudio

Public

62 Downloads

README

pixlstash-lmstudio

An LM Studio plugin that illustrates the model's chat replies with pictures from a PixlStash server. The model decides when to illustrate by calling a single tool; the plugin runs the semantic search, downloads a matching picture, and renders it inline in the assistant's reply.

Roleplay reply illustrated inline with a PixlStash image

How it works

  • Registers as an LM Studio prediction-loop handler that drives the user-selected model via model.act() with one tool: show_pixlstash_image.
  • The model composes a vivid scene/character query as the tool argument.
  • The plugin searches PixlStash (GET /api/v1/pictures/search), filters to renderable formats, picks one of the top-N results that hasn't already been shown in this chat, downloads it into the chat working directory, optionally downscales it to a max height, and writes a markdown image into its own assistant content block.
  • The picture renders inline because LM Studio displays markdown images whose src is a local file in the chat working directory.
  • A per-chat "Max images per response" cap and a chat-wide no-duplicates rule prevent runaway tool calls.

The model never has to echo any markdown — the plugin renders the image itself — so this works with roleplay fine-tunes that won't repeat tool results.

More examples

Another illustrated reply
A further illustrated reply

Install

Prerequisites

  • LM Studio (the lms CLI ships with the app — make sure it's on your PATH, usually at ~/.lmstudio/bin).
  • A PixlStash server you have a READ-scoped share token for (PixlStash → User Settings → Tokens).

From the LM Studio Hub (end users)

Browse to pixlstash-lmstudio on the LM Studio Hub, or pull it via the CLI:

lms clone pikselkroken/pixlstash-lmstudio

The plugin will appear in LM Studio's plugin list. Open the plugin's gear icon and fill in the PixlStash base URL + your READ share token (and turn on Ignore HTTPS certificate errors if your PixlStash uses a self-signed cert). That's it — start a chat and the model can now call show_pixlstash_image.

From source

Running the plugin from source, the project layout, and publishing instructions live in CONTRIBUTING.md.

Configure

Per-chat PixlStash settings in LM Studio's sidebar

Global (plugin gear icon, shared across all chats):

SettingDefaultWhat it does
PixlStash base URLhttp://localhost:9537Where PixlStash lives. Use https://… for TLS.
READ share token(empty)A READ-scoped token from PixlStash → User Settings → Tokens.
Ignore HTTPS certificate errorsoffAccept self-signed certs (local servers only).

Per chat (per-conversation settings panel):

SettingDefaultWhat it does
Pick from top N results10Random pool size for each search.
Minimum semantic score0.5PixlStash search threshold.
Image to injectFullFull image vs. 256×256 thumbnail.
Max image height (px)512Downscale taller full-mode images (0 = no resize).
Max images per response1Hard cap on tool calls per reply (0 = unlimited).
Allowed formatsjpg/jpeg/png/webpRestrict to LM Studio-renderable formats.
Required / excluded tags—Tag-based include/exclude filters.
Minimum user score0PixlStash per-picture rating floor.
Limit to characters / sets / project—Scope the search to specific PixlStash entities by name.

System-prompt hint

The plugin works best when your system prompt mentions the tool — for example:

When a visual would help illustrate a scene, character, or object, call show_pixlstash_image with a short, vivid description. You don't need to repeat any markdown; just narrate around it.

Contributing

Bug reports, feature requests, and pull requests welcome — see CONTRIBUTING.md for the dev setup, project layout, and publishing workflow.

License

MIT © Pikselkroken