Skip to main content

Interface: EditImageOptions

Defined in: packages/agentos/src/api/editImage.ts:47

Options for an editImage call.

Example​

const result = await editImage({
provider: 'openai',
image: 'data:image/png;base64,...',
prompt: 'Add a rainbow in the sky.',
mode: 'img2img',
strength: 0.6,
});

Properties​

apiKey?​

optional apiKey: string

Defined in: packages/agentos/src/api/editImage.ts:101

Override the provider API key instead of reading from env vars. Refused when no provider is named (by provider, a model such as 'openai:gpt-image-2.5-sunburst' or the global default), and when the model's provider: prefix names another provider than provider: it is never sent to a provider the call did not name for it.


baseUrl?​

optional baseUrl: string

Defined in: packages/agentos/src/api/editImage.ts:108

Override the provider base URL, refused where apiKey is. An empty or whitespace-only value is unset: it is not refused, the global default's URL and then the provider's base-URL variable apply as they do with no baseUrl, and with none the edit goes to the provider's own endpoint.


capabilities?​

optional capabilities: string[]

Defined in: packages/agentos/src/api/editImage.ts:134

Required provider capabilities for mature/private-adult routing. Drives UncensoredModelCatalog filtering (the catalog interface is exported from @framers/agentos/core/llm/routing/UncensoredModelCatalog), so callers can ask for 'face-consistency' when editing a character's outfit, or 'img2img' when the source is a scene the author wants preserved. Ignored for safe/standard tiers.


image​

image: string | Buffer

Defined in: packages/agentos/src/api/editImage.ts:66

Source image as a base64 data URL, raw base64 string, Buffer, local file path, or HTTP/HTTPS URL.


mask?​

optional mask: string | Buffer

Defined in: packages/agentos/src/api/editImage.ts:73

Optional mask for inpainting. White pixels mark regions to be edited; black pixels mark regions to keep. Accepts the same formats as image.


mode?​

optional mode: ImageEditMode

Defined in: packages/agentos/src/api/editImage.ts:80

Edit mode.

  • 'img2img' (default) — prompt-guided transformation.
  • 'inpaint' — mask-guided regional editing.
  • 'outpaint' — extend image borders.

model?​

optional model: string

Defined in: packages/agentos/src/api/editImage.ts:61

Model identifier. Prefer the plain model name with provider set; the combined "provider:model" string is also accepted. When omitted, the provider's own edit default applies, not its text-to-image default: OpenAI gpt-image-2.5-sunburst, Stability sd3.5-medium, Replicate stability-ai/sdxl (or black-forest-labs/flux-fill-pro with a mask).

Example​

`"gpt-image-2.5-sunburst"` (with `provider: 'openai'`), `"sd3.5-medium"`

n?​

optional n: number

Defined in: packages/agentos/src/api/editImage.ts:93

Number of output images.


negativePrompt?​

optional negativePrompt: string

Defined in: packages/agentos/src/api/editImage.ts:87

Negative prompt describing content to avoid.


policyTier?​

optional policyTier: "safe" | "standard" | "mature" | "private-adult"

Defined in: packages/agentos/src/api/editImage.ts:125

Content policy tier. When 'mature' or 'private-adult', the edit is rerouted through PolicyAwareImageRouter to pick an uncensored community model (e.g. IP-Adapter FaceID SDXL for face-consistent edits, SDXL for generic img2img) and disable_safety_checker: true is applied automatically to the Replicate request so the model's own NSFW filter does not veto the prompt.

'safe' and 'standard' tiers fall back to whatever provider / model the caller supplied (or env-detected defaults), keeping the existing censored path intact.


prompt​

prompt: string

Defined in: packages/agentos/src/api/editImage.ts:68

Text prompt describing the desired changes.


provider?​

optional provider: string

Defined in: packages/agentos/src/api/editImage.ts:52

Provider name (e.g. "openai", "stability", "stable-diffusion-local"). When omitted, auto-detection via env vars is attempted.


providerOptions?​

optional providerOptions: Record<string, unknown> | ImageProviderOptionBag

Defined in: packages/agentos/src/api/editImage.ts:110

Arbitrary provider-specific options.


seed?​

optional seed: number

Defined in: packages/agentos/src/api/editImage.ts:91

Seed for reproducibility (provider-dependent support).


size?​

optional size: string

Defined in: packages/agentos/src/api/editImage.ts:89

Output size (e.g. "1024x1024").


strength?​

optional strength: number

Defined in: packages/agentos/src/api/editImage.ts:85

How much to deviate from the source image. 0 = identical, 1 = completely new. Default 0.75.


usageLedger?​

optional usageLedger: AgentOSUsageLedgerOptions

Defined in: packages/agentos/src/api/editImage.ts:112

Optional usage ledger configuration.