Plus plan

Edit with AI

Change part of a picture by telling the AI what you want
POST
/v1/ai/generation/edit

About this tool

You add a picture and describe the change, for example make the sky a sunset or remove an object. You can choose the kind of change, such as replacing the background, removing something or filling an area. If you mark an area, everything outside it stays exactly as it was. The AI can make mistakes, so check the result.
For example, you want to remove the glasses from a portrait without opening a photo editor.

How to use it

  1. Choose this tool.
  2. Add your picture with Upload or drag and drop.
  3. Describe what should change.
  4. Optionally choose the kind of change and mark the area to change.
  5. Press Generate, then download the result.

What you get back

You get a new, edited picture. You can download it.
TEST IT LIVE

Try Edit with AI in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
AI
Plan
Plus
Method
POST
Endpoint
/v1/ai/generation/edit
Tool ID
ai.generation.edit
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Ai
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/ai/generation/edit" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'files=@document.pdf' \
  -F 'on_unsupported=error' \
  -F 'instructions=example' \
  -F 'mode=edit'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.ai.generation.edit({
    "files": 'document.pdf',
    "on_unsupported": "error",
    "instructions": "example",
    "mode": "edit"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->ai()->generation()->edit([
    'files' => 'document.pdf',
    'on_unsupported' => 'error',
    'instructions' => 'example',
    'mode' => 'edit',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Edit, replace background, remove/replace objects, generative fill. An optional region keeps all pixels outside it byte-identical. Readiness: unbenchmarked (see GET /v1/ai/capabilities/generation.edit).

Classification: ai. Deterministic stages: upload content sniffing, input image normalisation (Sharp), generated image validation and re-encoding (Sharp), signed-URL output, region-locked compositing (pixels outside the region are restored from the original).

Edit with AI works from text and settings, so no file is needed. The required inputs are instructions.

Not on the Free plan: Edit with AI is available on the Plus plan and above. Free accounts can upgrade any time to use it. Each run uses credits from your monthly allowance.

Send a POST request to /v1/ai/generation/edit with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.