Skip to main content
POST
/
v1
/
finetune
Finetune
curl --request POST \
  --url https://api.us1.bfl.ai/v1/finetune \
  --header 'Content-Type: application/json' \
  --header 'x-key: <api-key>' \
  --data '{
  "file_data": "<string>",
  "finetune_comment": "my-first-finetune",
  "trigger_word": "TOK",
  "mode": "general",
  "iterations": 300,
  "learning_rate": 0.0025005,
  "captioning": true,
  "priority": "quality",
  "finetune_type": "full",
  "lora_rank": 32,
  "webhook_url": "<string>",
  "webhook_secret": "<string>"
}'
"<any>"

Authorizations

x-key
string
header
required

Body

application/json
file_data
string
required

Base64-encoded ZIP file containing training images and, optionally, corresponding captions.

finetune_comment
string
required

Comment or name of the fine-tuned model. This will be added as a field to the finetune_details.

Example:

"my-first-finetune"

mode
enum<string>
required

Mode for the fine-tuned model. Allowed values are 'general', 'character', 'style', 'product'. This will affect the caption behaviour. General will describe the image in full detail.

Available options:
general,
character,
style,
product
trigger_word
string
default:TOK

Trigger word for the fine-tuned model.

Example:

"TOK"

iterations
integer
default:300

Number of iterations for fine-tuning.

Required range: 100 <= x <= 1000
learning_rate
number | null

Learning rate for fine-tuning. If not provided, defaults to 1e-5 for full fine-tuning and 1e-4 for lora fine-tuning.

Required range: 0.000001 <= x <= 0.005
captioning
boolean
default:true

Whether to enable captioning during fine-tuning.

priority
enum<string>
default:quality

Priority of the fine-tuning process. 'speed' will prioritize iteration speed over quality, 'quality' will prioritize quality over speed.

Available options:
speed,
quality,
high_res_only
finetune_type
enum<string>
default:full

Type of fine-tuning. 'lora' is a standard LoRA Adapter, 'full' is a full fine-tuning mode, with a post hoc lora extraction.

Available options:
lora,
full
lora_rank
enum<integer>
default:32

Rank of the fine-tuned model. 16 or 32. If finetune_type is 'full', this will be the rank of the extracted lora model.

Available options:
16,
32
webhook_url
string<uri> | null

URL to receive webhook notifications

Required string length: 1 - 2083
webhook_secret
string | null

Optional secret for webhook signature verification

Response

Successful Response

The response is of type any.