new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

replicate/capabilities

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Replicate image models factory method

Create Replicate image models using the `.image()` factory method on the replicate provider instance.

Replicate image editing example

Example of transforming an existing image using Replicate: ```ts const imageBuffer = readFileSync('./input-image.png'); const { images } = await generateImage({ model: replicate.image('black-forest-labs/flux-fill-dev'), prompt: { text: 'Turn the cat into a golden retriever dog', images: [imageBuffer], }, providerOptions: { replicate: { guidance_scale: 7.5, num_inference_steps: 30, } satisfies ReplicateImageModelOptions, }, }); ```

Replicate inpainting with mask example

Example of inpainting specific parts of an image using a mask with Replicate: ```ts const image = readFileSync('./input-image.png'); const mask = readFileSync('./mask.png'); // White = inpaint, black = keep const { images } = await generateImage({ model: replicate.image('black-forest-labs/flux-fill-pro'), prompt: { text: 'A sunlit indoor lounge area with a pool containing a flamingo', images: [image], mask: mask, }, providerOptions: { replicate: { guidance_scale: 7.5, num_inference_steps: 30, } satisfies ReplicateImageModelOptions, }, }); ```

Replicate mask inpainting convention

For FLUX Fill models, white areas in the mask indicate where the image should be edited, and black areas indicate where to keep the original image.

Replicate Flux-2 multi-reference example

Example of multi-reference image generation with Flux-2 models: ```ts import { replicate } from '@ai-sdk/replicate'; import { generateImage } from 'ai'; const reference1 = readFileSync('./style-reference.png'); const reference2 = readFileSync('./subject-reference.png'); const { images } = await generateImage({ model: replicate.image('black-forest-labs/flux-2-pro'), prompt: { text: 'Combine the style and subjects from the reference images', images: [reference1, reference2], }, }); ```

Replicate Flux-2 input format handling

Flux-2 models use a different input format internally (`input_image`, `input_image_2`, etc.) which is handled automatically by the SDK. Flux-2 models do not support mask-based inpainting.

Replicate input image formats supported

Input images can be provided as Buffer, ArrayBuffer, Uint8Array, or base64-encoded strings.

Give your agent this brain