Repository navigation
Description
Summary
The ImageEdit tool cannot target a specific region of an image: it only accepts image, prompt, quality, and size, so every edit relies on the image model localizing the change from the prompt alone. This works with the GPT image models but can repaint areas the user did not ask to change, and dall-e-2 cannot edit at all without a mask or transparency.
The rest of the stack is already mask-ready - this is a CLI-only gap:
- The gateway streams the optional
maskmultipart file straight through to the provider (api/routes.go, covered bytests/api_images_multipart_test.go). - SDK v1.33.0 exposes
CreateImageEditMultipartBody.Mask *openapi_types.Fileand sends it as themaskmultipart part. - The CLI tool definition in
internal/agent/tools/image_edit.gosimply does not offer the parameter.
Proposal: add an optional mask parameter to the ImageEdit tool - a local PNG file path, validated like image, whose fully transparent areas (alpha = 0) mark the editable region; all other pixels are preserved exactly. Wire it to the SDK's existing Mask field. Per the Images API, the mask must be a valid PNG with the same dimensions as the input image.
Out of scope / future work: having the agent generate masks automatically would require vision or segmentation capabilities and should be a separate feature request. This issue covers user-supplied mask files only, which needs no vision support.
No cross-repo changes required (gateway and SDK already support masks). A docs ticket for inference-gateway/docs should accompany the implementing PR.
Acceptance Criteria
-
ImageEditaccepts an optionalmaskargument: a local file path to a PNG whose transparent areas indicate where the image should be edited -
Validaterejects a non-PNG or missing mask file with a clear error message -
Executesends the mask via the SDK'sCreateImageEditMultipartBody.Maskfield; omittingmaskbehaves exactly as today - Tool description (
prompts.yamldefault) documents the mask semantics (transparent = editable, same dimensions as the image, PNG only) - Unit tests cover mask validation and the mask-attached request path
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
edenreich commentedon Aug 4, 2026
@infer Can you work on this? use /go /go-concurrency /bubbles-v2 /bubbletea-v2 /lipgloss /ponytail:ponytail
inference-gateway-maintainer commentedon Aug 4, 2026
Model:
ollama_cloud/deepseek-v4-flash· View JobTodos
Pull Request
#1008
The agent finished without pushing its work. The runner salvaged it into the pull request linked above - review it and mark it ready, or close it if it is not useful.
Let me commit and push what I have, then create the draft PR.
Model:
ollama_cloud/deepseek-v4-flash· Exit Code:0· Duration: 14m 44sTokens: 11,525,570 in · 29,010 out · 11,554,580 total (140 requests)
Tool calls: 149 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
fix: resolve #988
inference-gateway-releaser commentedon Aug 5, 2026
🎉 This issue has been resolved in version 0.162.0 🎉
The release is available on:
Your semantic-release bot 📦🚀