## Basic model info - Model name: bria/bria fibo-2 - Model description: Bria FIBO 2 generates and edits images through VGL, a structured JSON scene description that is returned with every image so a result can be reproduced or refined field by field. text-to-image works from a prompt, a reference image or a VGL document, in 21 aspect ratios at about one megapixel, with four photographic style presets; edit follows a plain-language instruction across up to four images, optionally limited to a mask. Trained on licensed data. $0.04 per image. - Endpoint name: edit ## Model schema The model schema is defined in the OpenAPI schema: [OpenAPI Schema](https://oapi.sunra.ai/main/bria/fibo-2/latest.json) ### Model input schema The model input schema is: ```json { "description": "Input schema for FIBO 2 instruction-based editing with up to four images.", "properties": { "aspect_ratio": { "anyOf": [ { "enum": [ "1:1", "1:2", "1:3", "1:4", "1:5", "2:1", "2:3", "3:1", "3:2", "3:4", "4:1", "4:3", "4:5", "5:1", "5:4", "9:16", "9:21", "10:16", "16:9", "16:10", "21:9" ], "type": "string" }, { "type": "null" } ], "description": "Output aspect ratio, about one megapixel. Applies only with two or more images; left unset the output keeps the first image's ratio, and a single image always keeps its own.", "title": "Aspect Ratio", "x-sr-order": 401 }, "seed": { "anyOf": [ { "maximum": 2147483647, "minimum": 0, "type": "integer" }, { "type": "null" } ], "description": "Random seed for reproducibility (the model uses 5555 when omitted).", "title": "Seed", "x-sr-order": 501 }, "images": { "description": "1-4 images to edit (public URLs). Order matters: is the first.", "items": { "anyOf": [ { "format": "uri", "maxLength": 2083, "minLength": 1, "type": "string" }, { "type": "string" } ] }, "maxItems": 4, "minItems": 1, "title": "Images", "type": "array", "x-sr-order": 301 }, "instruction": { "anyOf": [ { "maxLength": 4000, "type": "string" }, { "type": "null" } ], "description": "The edit, in free-form English. Refer to the images as , and so on, in the order they are sent (e.g. 'put the jacket from on the person in '). Required unless vgl carries an edit_instruction.", "title": "Instruction", "x-sr-order": 201 }, "mask": { "anyOf": [ { "format": "uri", "maxLength": 2083, "minLength": 1, "type": "string" }, { "type": "string" }, { "type": "null" } ], "description": "Optional mask marking the region to regenerate: white where the model should edit, black elsewhere. Single-image requests only; must be the same size as the image.", "title": "Mask", "x-sr-order": 302 }, "vgl": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "description": "Advanced: a VGL document. On its own it is the edit as-is and must contain edit_instruction (e.g. the vgl returned by a previous edit). With an instruction, it is the first image's VGL, used as the baseline the edit is written from.", "title": "Vgl", "x-sr-order": 402 } }, "required": [ "images" ], "title": "EditInput", "type": "object" } ``` ### Model output schema The model output schema is: ```json { "anyOf": [ { "description": "Generated image plus the VGL scene description it was rendered from.", "properties": { "image": { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" }, "vgl": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "description": "VGL the image was rendered from; send it back as vgl to reproduce or refine the image.", "title": "Vgl" } }, "required": [ "image" ], "title": "TextToImageOutput", "type": "object" }, { "description": "Edited image plus the VGL the edit ran.", "properties": { "image": { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" }, "vgl": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "description": "VGL the edit ran, including its edit_instruction; send it back as vgl to reproduce the edit.", "title": "Vgl" } }, "required": [ "image" ], "title": "EditOutput", "type": "object" } ], "title": "Response Get Request Result Requests Request Id Get" } ``` ## Example inputs and outputs Use the following example inputs and outputs to understand the model. ### Input example ```json { "aspect_ratio": null, "seed": null, "images": [ ], "instruction": null, "mask": null, "vgl": null } ``` ### Output example ```json { } ``` ## Model code examples ### JavaScript ```javascript import { sunra } from "@sunra/client"; const result = await sunra.subscribe("bria/fibo-2/edit", { input: { instruction: null, images: [], mask: null, aspect_ratio: null, vgl: null, seed: null }, logs: true, onQueueUpdate: (update) => { console.log(`Status Update: ${update.status}, Request ID: ${update.request_id}`); }, }); console.log(result.data); console.log(result.requestId); ``` ### Python ```python import sunra_client result = sunra_client.subscribe( "bria/fibo-2/edit", arguments={ "instruction": None, "images": [], "mask": None, "aspect_ratio": None, "vgl": None, "seed": None }, with_logs=True, on_enqueue=print, on_queue_update=print, ) print(result) ``` ### Java ```java import ai.sunra.client.*; import java.util.Map; import com.google.gson.JsonObject; var client = SunraClient.withEnvCredentials(); var response = client.subscribe( "bria/fibo-2/edit", SubscribeOptions.builder() .input(Map.of( "instruction", null, "images", , "mask", null, "aspect_ratio", null, "vgl", null, "seed", null)) .resultType(JsonObject.class) .onQueueUpdate(update -> System.out.printf( "\nStatus Update: %s, Request ID: %s%n", update.getStatus(), update.getRequestId() )) .logs(true) .build() ); System.out.println("Completed!"); System.out.println(response.getData()); ``` ### Kotlin ```kotlin import ai.sunra.client.kt.* import com.google.gson.JsonObject val client = createSunraClient() val response = client.subscribe( endpointId = "bria/fibo-2/edit", input = mapOf( "instruction" to null, "images" to , "mask" to null, "aspect_ratio" to null, "vgl" to null, "seed" to null), options = ai.sunra.client.kt.SubscribeOptions(logs = true), onUpdate = { update -> println("\nStatus Update: ${update.status}, Request ID: ${update.requestId}") } ) println("Completed!") println(response.data) ``` ### Curl ```bash curl --request POST \ --url https://api.sunra.ai/v1/queue/bria/fibo-2/edit \ --header "Authorization: Key $SUNRA_KEY" \ --header "Content-Type: application/json" \ --data '{"instruction":null,"images":[],"mask":null,"aspect_ratio":null,"vgl":null,"seed":null}' ``` ## Model readme >