flux2klein
4B or 9B, plus an edit-LoRA toggle
- continue_from
- api_config
- moderation_status
- epochs
- workflow_id
- raw_json
The newest member of the training family: Flux 2 Klein LoRAs on Civitai's cloud, via Ostris's AI Toolkit. CivitaiTrainingAiToolkitFlux2klein takes a zip of training images and trains on the Klein variant of Flux 2, with two decisions up front: which size (4b or 9b) and whether you're training a normal LoRA or an edit LoRA (is_edit_training). Like its siblings it needs no local GPU - Buzz in, downloadable model per epoch out.
It lives in Civitai/Training/flux2klein, part of Civitai's official ComfyUI pack. The size choice is the classic capacity/speed trade: 4b is the light, quick-to-train option; 9b is the bigger, higher-fidelity base that costs more per step. Start at 4b unless you've specifically got the budget and the dataset quality to justify 9b. The is_edit_training flag switches the trainer into edit-LoRA mode - the kind that drives image editing workflows rather than pure style/character generation, and it expects training data structured for that (image + edit pairs rather than just images).
How it works
The node submits a training workflow (engine: ai-toolkit, ecosystem: flux2klein) to Civitai's Orchestration API. Your images go up as a hosted zip, the cloud runs AI Toolkit, and each epoch yields a downloadable checkpoint. The core input is training_data_json, a JSON object:
{"type": "zip", "sourceUrl": "urn:air:flux2klein:dataset:civitai:111@1", "count": 25}
sourceUrl is an AIR URN to the zip; count is the number of items, which is how the run is priced.
The inputs that matter
- model_variant (required) -
4b(default) or9b. - training_data_json (required) - the zip + count object.
- is_edit_training - flip on for edit-LoRA training with appropriately paired training data.
- epochs / steps - epochs = saved checkpoints, steps = total training length and the pricing driver. Set one, the other derives.
- trigger_word, network_dim / network_alpha, lr, noise_offset - the usual trainer dials, all optional.
The required-looking storage_buzz_per_epoch, default_steps, uses_step_pricing, max_batch_size fields are generated plumbing - leave them.
Outputs: moderation_status, epochs, plus the standard workflow_id and raw_json.
Installing it
This is one of ~160 nodes in Civitai Comfy Nodes, Civitai's official pack for their Orchestration API:
- ComfyUI Manager: Manager → Custom Nodes Manager → search Civitai Comfy Nodes → Install, then restart.
- CLI:
comfy node registry-install civitai-comfy-nodes - Source:
cd ComfyUI/custom_nodes && git clone https://github.com/civitai/civitai-comfy-nodes.git && pip install -r civitai-comfy-nodes/requirements.txt(justrequests).
You need a Civitai account with Buzz and credentials - a Civitai Auth node, CIVITAI_API_TOKEN (best for headless), or a stored key via the Civitai sidebar.
Where people get burned
- Edit training needs the right data.
is_edit_trainingwith ordinary image-only data will train, and underwhelm. Use pairs structured for edit learning, or leave it off. - 9b costs noticeably more. Steps are metered per step; the bigger model means a bigger bill per run. The node's cost report after each run keeps you honest.
- training_data_json must be valid JSON with
type,sourceUrl, andcount. - Moderation gates the model.
moderation_statusreports whether your LoRA passed Civitai's content review. - Early preview. The README warns of breaking changes without notice, and early community reports include bugs and slow jobs. Long trainings can hit the default 30-minute timeout - raise it via the Auth node or
CIVITAI_COMFY_TIMEOUT.
Klein is where a lot of the Flux 2 action is right now, and this node gets you training on it before most local setups have it working. Start at 4B, keep the dataset tight, and you'll have a LoRA by the time your coffee's cold.
Inputs (25)
| Name | Type | Default | Description |
|---|---|---|---|
| model_variant | COMBO | 4b | 2 options: 4b, 9b |
| training_data_json | STRING | Represents training data in various formats | |
| storage_buzz_per_epoch | FLOAT | 0.000–2147483647 | Per-epoch surcharge (buzz). Each epoch is a delivered checkpoint plus its preview samples, billed on top of the per-step training cost — so raising the epoch count raises the price by this much each. Override per ecosystem where per-epoch samples are expensive to compute (e.g. video). |
| default_steps | INT | 00–2147483647 | Default total step budget when neither Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Steps nor Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Epochs is supplied. Override per ecosystem where the default training length differs (e.g. video needs more steps, quickly-overtrained models need fewer). |
| uses_step_pricing | BOOLEAN | false | True when billing uses the per-step model. This is the default; the only exception is the legacy path where the caller supplied Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Epochs but no Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Steps (existing consumers), which keeps the historical flat per-epoch price. |
| max_batch_size | INT | 00–2147483647 | Ecosystem-specific maximum training batch size — the upper bound the user's Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.BatchSize is clamped to. Most ecosystems cap at 1. |
| samples_jsonopt | STRING | Sample generation configuration for training workflows | |
| epochsopt | INT | 11–200 | Number of training epochs — the number of saved checkpoints produced (each epoch yields one downloadable model). When omitted it is derived from Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Steps; when both are supplied, both are honored (epochs = checkpoint count, steps = total). |
| stepsopt | INT | 11–10000 | Total number of training steps. This is the primary control over training length and determines pricing. When supplied, Civitai.Orchestration.Grains.Workflows.Steps.Training.AIToolkit.AIToolkitTrainingInput.Epochs (the number of saved checkpoints) is derived from it; when omitted, steps are derived from epochs. |
| batch_sizeopt | INT | 11–4 | Training batch size. Defaults to 1; raise it (up to the ecosystem's maximum) to train faster at the cost of more GPU memory. A larger batch sees more images per step, so fewer steps are needed for a comparable result. Values above the ecosystem maximum are clamped down. |
| lropt | FLOAT | 0.000–1 | Sets the learning rate for the model. This is the learning rate when performing additional learning on each attention block (and other blocks depending on the setting). |
| text_encoder_lropt | FLOAT | 0.000–1 | Sets the learning rate for the text encoder. Only used when TrainTextEncoder is true. For models with multiple text encoders, this applies to all of them. |
| train_text_encoderopt | BOOLEAN | false | Whether to train the text encoder(s) alongside the model. Enabling this can improve prompt understanding but increases training time and memory usage. |
| lr_scheduleropt | COMBO | You can change the learning rate in the middle of learning. A scheduler is a setting for how to change the learning rate. | |
| optimizer_typeopt | COMBO | The optimizer determines how to update the neural net weights during training. Various methods have been proposed for smart learning, but the most commonly used in LoRA learning is "adamw8bit". | |
| network_dimopt | INT | 11–256 | The larger the Dim setting, the more learning information can be stored, but the possibility of learning unnecessary information other than the learning target increases. A larger Dim also increases LoRA file size. |
| network_alphaopt | INT | 11–256 | The smaller the Network alpha value, the larger the stored LoRA neural net weights. For example, with an Alpha of 16 and a Dim of 32, the strength of the weight used is 16/32 = 0.5, meaning that the learning rate is only half as powerful as the Learning Rate setting. If Alpha and Dim are the same number, the strength used will be 1 and will have no effect on the learning rate. |
| noise_offsetopt | FLOAT | 0.000–1 | Adds noise to training images. 0 adds no noise at all. A value of 1 adds strong noise. |
| flip_augmentationopt | BOOLEAN | false | If this option is turned on, the image will be horizontally flipped randomly. It can learn left and right angles, which is useful when you want to learn symmetrical people and objects. |
| shuffle_tokensopt | BOOLEAN | false | Randomly changes the order of your tags during training. The intent of shuffling is to improve learning. If you are using captions (sentences), this option has no meaning. |
| keep_tokensopt | INT | 00–10 | If your training images have tags, you can randomly shuffle them. However, if you have words that you want to keep at the beginning, you can use this option to specify "Keep the first 0 words at the beginning". This option does nothing if the Shuffle Tokens option is off. |
| trigger_wordopt | STRING | A trigger word that activates the trained LoRA when used in prompts. Only applicable to certain ecosystems (sd1, sdxl, flux1, chroma, zimagebase, zimageturbo, flux2klein). | |
| continue_fromopt | CIVITAI_AIR | Optional previously-trained LoRA to continue training from ("train further"). When set, the first epoch resumes from this model instead of the base model, and the new epochs build on top of it. | |
| is_edit_trainingopt | BOOLEAN | false | Whether this is image-edit training (uses control paths for reference images). When true, the training data zip should contain subfolders: main/, control_1/, control_2/, control_3/. |
| api_configopt | CIVITAI_CONFIG | Optional Civitai Auth connection; defaults to CIVITAI_API_TOKEN or stored OAuth login. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| moderation_status | STRING | — |
| epochs | STRING | — |
| workflow_id | STRING | — |
| raw_json | STRING | — |