Skip to main content
POST
/
v1
/
async
/
images
/
edits
Create async image edit
curl --request POST \
  --url http://localhost:8080/v1/async/images/edits \
  --header 'Content-Type: multipart/form-data' \
  --form 'model=<string>' \
  --form image='@example-file' \
  --form 'prompt=<string>' \
  --form mask='@example-file' \
  --form type=inpainting \
  --form n=5 \
  --form size=256x256 \
  --form response_format=url \
  --form stream=false \
  --form background=transparent \
  --form input_fidelity=low \
  --form partial_images=1 \
  --form quality=auto \
  --form output_format=png \
  --form num_inference_steps=123 \
  --form seed=123 \
  --form output_compression=50 \
  --form 'negative_prompt=<string>' \
  --form 'user=<string>' \
  --form 'fallbacks={
  "provider": "openai",
  "model": "<string>"
}'
{
  "id": "<string>",
  "status": "pending",
  "created_at": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z",
  "completed_at": "2023-11-07T05:31:56Z",
  "status_code": 123,
  "result": "<unknown>",
  "error": {
    "event_id": "<string>",
    "type": "<string>",
    "is_bifrost_error": true,
    "status_code": 123,
    "error": {
      "type": "<string>",
      "code": "<string>",
      "message": "<string>",
      "param": "<string>",
      "event_id": "<string>"
    },
    "extra_fields": {
      "provider": "openai",
      "model_requested": "<string>",
      "request_type": "<string>"
    }
  }
}

Headers

x-bf-async-job-result-ttl
integer
default:3600

Time-to-live in seconds for the job result after completion. Defaults to 3600 (1 hour). After expiry, the job result is automatically cleaned up.

Body

multipart/form-data
model
string
required

Model identifier in format provider/model

image
file
required

Image file to edit. Use field name image for a single file or image[] for multiple files.

prompt
string

Text prompt describing the edit. Required unless type is background_removal.

mask
file

Optional mask image for inpainting (transparent areas indicate regions to edit)

type
enum<string>

Type of edit operation

Available options:
inpainting,
outpainting,
background_removal
n
integer

Number of images to generate

Required range: 1 <= x <= 10
size
enum<string>

Size of the output image

Available options:
256x256,
512x512,
1024x1024,
1536x1024,
1024x1536,
auto
response_format
enum<string>
default:url

Format of the response

Available options:
url,
b64_json
stream
boolean
default:false

When true, stream the response via Server-Sent Events

background
enum<string>

Background type for the image

Available options:
transparent,
opaque,
auto
input_fidelity
enum<string>

How closely to follow the original image

Available options:
low,
high
partial_images
integer

Number of partial images to generate when streaming

Required range: 0 <= x <= 3
quality
enum<string>

Quality of the output image

Available options:
auto,
high,
medium,
low,
standard
output_format
enum<string>

Output image format

Available options:
png,
webp,
jpeg
num_inference_steps
integer

Number of inference steps

seed
integer

Seed for reproducible editing

output_compression
integer

Compression level (0-100%)

Required range: 0 <= x <= 100
negative_prompt
string

What to avoid in the edit

user
string

User identifier for tracking

fallbacks
object[]

Fallback models to try if primary model fails

Response

Job accepted for processing

Response returned when creating or polling an async job

id
string
required

Unique identifier for the async job

status
enum<string>
required

The status of an async job

Available options:
pending,
processing,
completed,
failed
created_at
string<date-time>
required

When the job was created

expires_at
string<date-time>

When the job result expires and will be cleaned up

completed_at
string<date-time>

When the job completed (successfully or with failure)

status_code
integer

HTTP status code of the completed operation

result
any

The result of the completed operation (shape depends on the request type)

error
object

Error response from Bifrost