Interface SegmentOptions

Public options accepted by the high-level segment helper.

interface SegmentOptions {
    image: string | Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>;
    provider?: SegmentationProviderId;
    model?: string;
    prompt?: string;
    points?: SegmentationPoint[];
    box?: SegmentationBox;
    automatic?: boolean;
    maxMasks?: number;
    minScore?: number;
    providerOptions?: Record<string, unknown> | SegmentationProviderOptionBag;
    userId?: string;
}

Properties

image: string | Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>

Source image as raw bytes or a file path.

Provider id. Defaults to 'replicate'.

model?: string

Model id override. Provider default is used when omitted.

prompt?: string

Open-vocabulary text prompt (routes to GroundedSAM).

Point prompts (foreground/background clicks).

Bounding-box prompt.

automatic?: boolean

"Segment everything" when true.

maxMasks?: number

Cap on returned masks (automatic/text can produce many).

minScore?: number

Confidence floor; masks scoring below this are dropped.

providerOptions?: Record<string, unknown> | SegmentationProviderOptionBag

Provider-specific passthrough options.

userId?: string

Caller id for usage tracking.