locmodel-image
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PYTHONUTF8 | No | Recommended value "1" to enable Python UTF-8 mode, especially on Windows. | |
| LOCMODEL_SD_PORT | No | Pin the LocModel / sd-server engine port when automatic discovery is unreliable, for example "8790". | |
| PYTHONIOENCODING | No | Recommended value "utf-8" for MCP stdio communication, especially on Windows. | |
| LOCMODEL_IMAGE_CONFIG | No | Path to the locmodel-image configuration file. If omitted, the default ~/.locmodel-image/config.json is used when present. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Local offline image, video and lip-sync generation via LocModel. Pick the tool that matches the sub-panel the user means, they are NOT interchangeable: generate_image / edit_image / redraw_image for the 画图 tab; generate_video (text- or image-to-video, webm/webp/avi) for 视频 → 生成视频; lipsync_generate (portrait + audio -> mp4 whose mouth follows the song) for 视频 → 对口型视频. Lip sync needs weights the user installs inside LocModel; without them the job fails outright, so call lipsync_status before promising anything. generate_video is asynchronous: call it with wait_seconds=0, then poll job_status. Call engine_doctor first if image generation fails.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| generate_imageA | Generate images with the LOCAL LocModel / stable-diffusion.cpp engine (offline, no cloud cost). Pass an already-optimised English prompt; the tool returns absolute image paths plus the seed used for reproduction. Sizing: when the tool picks the size: 576k-pixel minimum area, long edge <= 1536px, multiple of 8. An explicit width/height is honoured as requested -- only the engine's hard limits (64-4096px per edge) can shrink it, and big canvases come back with a VRAM warning instead of being resized. One 1024x1024 image takes roughly 20-60 s on a mid-range GPU. |
| ref_editA | Edit a photo by reference: same local engine, but the ref_images channel is forced on, which keeps the subject's identity intact instead of re-imagining it (a plain generate_image with one reference also works; this tool simply cannot fall back). Describe ONLY the change you want -- 'same person, change the hairstyle to a short bob'. The canvas follows reference #1 by default. Strength, mask and negative prompt do not exist on this channel; use redraw_image when you need them. |
| locmodel_statusB | Inspect the local engine: port and discovery source, loaded model, engine-reported generation defaults, VRAM and the active size policy. |
| list_modelsA | List the models the local engine reports (A1111-compatible /sdapi/v1/sd-models). |
| engine_doctorA | Self-check: python, engine reachability, model, VRAM vendor, output directory writability, available helper tools. Use this first when generation fails. |
| engine_discoverA | Force engine port re-discovery (use after restarting LocModel, which may pick a different port). |
| set_workflow_paramsA | Remember workflow parameters for the rest of this session (CFG, steps, sampler, scheduler, flow_shift, eta, hi-res fix, VAE tiling, LoRA ...). Use it for batch runs where every image shares the same look, instead of repeating params on each call. Values are sent in the HTTP payload per job -- they never touch LocModel's config.json, which the GUI rewrites. Returns the effective parameter table with defaults, ranges and the source of each default. Call reset_workflow_params to drop everything and fall back to the LocModel GUI panel settings. |
| get_workflow_paramsA | List every workflow parameter this tool accepts, with its default value, valid range / options, the payload path it maps to, and whether the default came from the live engine or from the built-in fallback. Use it before setting parameters so you do not guess a name or a range. |
| reset_workflow_paramsA | Clear the session parameter set (all of it, or the listed keys) so generation goes back to the LocModel GUI panel settings. This is the one-command restore. |
| edit_imageA | EDIT an existing local image: repaint only the masked area (inpainting) while the rest stays pixel-identical -- the tool re-composes the result on the CPU, so outside-mask pixels cannot drift. Give either mask_image or regions. Models are chosen by priority (qwen-image-edit > flux2-klein > qwen-image); the loaded model wins when it can region-edit. Returns absolute PNG paths for the agent to inspect. |
| redraw_imageA | REDRAW an existing local image from a new prompt, keeping its composition and size (whole-image img2img). The character of the picture changes but the geometry stays. Use edit_image instead when only part of the picture should change. |
| list_edit_modelsA | List every model that can be used for editing, with family, priority rank, whether it supports region editing, and which one would be picked automatically right now. Call this before editing when you are unsure what is installed. |
| load_modelA | Load / switch the model in the local engine, and wait until the engine reports it. Use it when the model you need for an edit is not the one currently loaded. |
| lipsync_statusA | Check whether LocModel's built-in lipsync (对口型视频) pipeline is ready: GUI sub-panel 视频 → 对口型视频, InfiniteTalk + Wan2.1-I2V-14B-480P, its own venv and model dir. This pipeline is INDEPENDENT from the sd-server engine, so engine_doctor / locmodel_status do not cover it. Call this before lipsync_generate; if the dedicated models are not mounted inside LocModel the whole task fails and there is no fallback. |
| lipsync_generateA | Generate a singing / talking head video: one portrait image + one audio file -> mp4 whose mouth follows the song. Same pipeline as GUI 视频 → 对口型视频 (InfiniteTalk, Wan2.1-I2V-14B-480P fp8 or GGUF, Demucs vocal separation, chinese-wav2vec2). Requires the dedicated models and runtime downloaded and mounted inside LocModel first (about 24.2 GB models + 6 GB CUDA torch); without them the job fails outright. Slow: a 1-minute song takes tens of minutes even on a 4090. |
| generate_videoA | Generate a video with the engine-native endpoint POST /sdcpp/v1/vid_gen — this is LocModel GUI 视频 → 生成视频 (text/image to video, e.g. Wan2.2-TI2V, Wan2.1, LTX), NOT the lip-sync sub-panel. Returns a job_id immediately (wait_seconds=0) because a clip takes minutes; poll with job_status. Do NOT use it for 对口型视频 -> use lipsync_generate. |
| job_statusA | Poll a vid_gen job created by generate_video (GET /sdcpp/v1/jobs/{id}) and save the finished video. The engine keeps results for ~600 s only. |
| cancel_jobA | Cancel a queued or running vid_gen job (POST /sdcpp/v1/jobs/{id}/cancel). LocModel 3.3.0 returns 410, 3.6.x supports it. |
| list_recipesB | List engine recipes (GET /sdcpp/v1/recipes) with slots / required_any / size_multiple / defaults. kind='video' keeps only video recipes — use it to see which video models the engine can drive. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 19 tools
Most tools have clearly distinct purposes, and the descriptions actively cross-reference each other (e.g. edit_image vs redraw_image, lipsync_generate vs generate_video, ref_edit vs generate_image). A couple of boundaries are softer: list_models vs list_edit_models vs list_recipes all enumerate models/recipes, and locmodel_status vs engine_doctor are both health/inspection tools, though their scopes are spelled out. ref_edit honestly overlaps generate_image-with-reference, which introduces a minor selection choice.
Many tools follow a clean verb_noun pattern (generate_image, edit_image, load_model, cancel_job, get/set/reset_workflow_params), but ordering is mixed: lipsync_generate and engine_discover are noun-first, while generate_image and edit_image are verb-first, and several are noun_noun status tools (job_status, lipsync_status, engine_doctor). It remains readable but the convention is not uniform across the set.
19 tools is on the heavy side, but the server genuinely spans distinct subsystems (image gen, editing, video jobs, an independent lip-sync pipeline, engine management, workflow params), so most tools earn their place. A few inspection tools (three status tools, three list tools) could theoretically be consolidated, but each targets a different subsystem the descriptions say are not interchangeable.
Coverage is broad and coherent: text-to-image, three distinct editing modes, model listing/loading, engine diagnostics and re-discovery, video generation with job polling/cancel, lip-sync generation with a readiness check, and full set/get/reset of workflow parameters. Minor gaps exist—there's no tool to enumerate or manage all jobs at once (only poll by id), and no output-file cleanup/upscale operations—but core workflows are fully covered.