MCP/Tools/Images/edit_image
edit_image

Edit an existing image with an instruction

Low cost

Apply a natural-language instruction to an existing image - swap headlines, change colors, remove text, replace backgrounds - without regenerating the whole composition.

How it works

Pass an instruction plus a base image (from your media library by imageId, by URL, or as raw base64). The original goes to Claivra's image model as the image to edit, so its composition, framing and identity are preserved and only what the instruction names changes. Use it for surgical changes - 'remove the LOS ANGELES headline,' 'swap the car for a black Tesla,' 'change the CTA color to red.' Saves an edit-pair record so you can audit the before/after in your editor history.

Inputs

Name
Type
Required
Description
instruction
string
required
What to change about the image - written as a directive.
baseImageId
string
optional
Image ID from list_media or generate_image.
baseImageUrl
string
optional
Public URL of the image to edit.
baseImage
{ data, mimeType }
optional
Raw base64 of the image.
aspectRatio
string
optional
Output ratio - default 1:1.
model
'claivra-v1' | 'claivra-v2' | 'claivra-v3' | 'claivra-v4' | 'claivra-v5' | 'claivra-v6' | 'claivra-v7' | 'claivra-v8'
optional
Default claivra-v1, since editing is high-volume. claivra-v3, claivra-v4 and claivra-v8 cannot edit. claivra-v1 (2-5 credits; 1K/2K/4K; free plan): Cheapest photorealism - drafts, volume and believable photo backgrounds. claivra-v2 (1-34 credits; 1K/2K/4K, quality tiers): Dense layouts - posters, UI mockups and designs carrying a lot of small text. claivra-v3 (3 credits; native size, no logo): Exact typography - when a headline has to hold a specific typeface or lettering. claivra-v4 (2 credits; native size, no logo): Quick, punchy photoreal images when speed matters more than control. claivra-v5 (4-7 credits; 1K/2K/4K): Following a layout brief precisely, with crisp text and the brand logo - the best all-round choice for client ads. claivra-v6 (1-34 credits; 1K/2K/4K, quality tiers, transparent cutouts): The most realistic photography - real textures, lighting and materials. claivra-v7 (1-34 credits; 1K/2K/4K, quality tiers, transparent cutouts): Reworking an existing image with the tightest control over what changes. claivra-v8 (1 credit; native size, no logo): Fashion, lifestyle and editorial photography with a styled look - the lowest cost per image.
resolution
'1K' | '2K' | '4K'
optional
Output resolution (default 1K). Honored by claivra-v1, claivra-v2, claivra-v5, claivra-v6 and claivra-v7; claivra-v3, claivra-v4 and claivra-v8 native. Higher = more credits.
quality
'low' | 'medium' | 'high' | 'xhigh' | 'max'
optional
Quality tier for v2 (low | medium | high, default medium) or v6 (low..max, default high). Credits scale with the tier's real cost. Ignored by other models.
label
string
optional
Short label for the edit history.

Returns

{ editId, imageId, imageUrl, mimeType, model, creditsUsed }

Examples

Strip a location headline from a client ad

Client wants the same ad without the city name - surgical edit, original composition preserved, no re-generation cost spike.

{
  "instruction": "Remove the 'LOS ANGELES' headline entirely. Replace the city skyline in the background with a generic dark night cityscape. Keep cars, lighting, CTA pixel-identical.",
  "baseImageUrl": "https://cdn.claivra.com/file/claivra/.../edited/mcp-edit-1779016048391_0.jpeg",
  "aspectRatio": "1:1"
}