Documentation

Quickstart: Flux Kontext

Flux Kontext

Black Forest Labs has released FLUX Kontext with support on Bytecompute AI. These models allow you to generate and edit images through in-context image generation.

Unlike existing text-to-image models, FLUX.1 Kontext allows you to prompt with both text and images, and seamlessly extract and modify visual concepts to produce new, coherent renderings.

The two new models are Max for maximum image quality, and Pro for faster generation speed.

Generating an image

Here's how to use the new Kontext models:

Python Copy
from bytecompute import bytecompute

client = bytecompute()

imageCompletion = client.images.generate(
    model="black-forest-labs/FLUX.1-kontext-pro",
    width=1024,
    height=768,
    prompt="make his shirt yellow",
    image_url="https://github.com/nutlope.png",
)

print(imageCompletion.data[0].url)
TypeScript Copy
import bytecompute from "bytecompute-ai";

const bytecompute = new bytecompute();

async function main() {
  const response = await bytecompute.images.create({
    model: "black-forest-labs/FLUX.1-kontext-pro",
    width: 1024,
    height: 1024,
    prompt: "make his shirt yellow",
    image_url: "https://github.com/nutlope.png",
  });

  console.log(response.data[0].url);
}

main();