{"slug": "bambu-lab-cli-for-slicing-and-printing-3d-models", "title": "Bambu Lab CLI for slicing and printing 3D models", "summary": "Developer voska released bambu, an open-source command-line tool that slices, sends and monitors Bambu Lab 3D prints over a local network without a cloud account or Bambu Connect. The tool drives the Bambu Studio CLI with printer-specific presets, gates `print send` behind a `--confirm` flag and preflight checks, and requires a printer in LAN Only mode with Developer Mode enabled, which Bambu Lab's January 2025 \"Authorization Control\" firmware made necessary for unsigned third-party control commands. It ships as a single static binary for macOS, Linux and Windows, offers `--json` output and stable exit codes for AI agents, and is tested only on the X1 Carbon, with the X1/X1E/P1/A1/H2/P2S series expected to work but untested.", "body_md": "Migrating the Python Print Operator? See the [command and configuration guide](https://github.com/voska/bambu/blob/main/docs/operator-migration.md).\n\nSlice, check, send and monitor **Bambu Lab** prints from the terminal over your LAN. It's built for humans and for AI agents.\n\n- **Headless slicing:** it drives the Bambu Studio CLI with the correct system presets for your printer and nozzle, plus recipes and`--set` overrides.\n- **Safety first:**  - Preflight gates check that the printer is idle, the right filament is in the slot, the plate and nozzle match, Developer Mode is on, and there's enough filament.\n  - `print send` refuses to run without`--confirm` .\n  - No command ever changes printer settings.\n- **LAN only:** MQTT and FTPS go directly to the printer. No cloud account, no Bambu Connect.\n- **Agent-friendly:**`--json` everywhere (NDJSON for streams), stable exit codes,`schema` introspection, and no prompts with`--no-input` .\n- **Single static binary** for macOS, Linux and Windows.\n\n``` bash\n$ bambu status\nworkshop (192.168.1.50)  IDLE / idle   dev_mode=true  sdcard=true  liveview=true\n  temps    nozzle 26/0  bed 24/0   nozzle 0.4 mm hardened_steel\n  errors   none\n  AMS A1   PLA    PLA Matte    #FF6A13  33% (~330 g)\n  AMS A2   PETG   PETG Basic   #FFFFFF  80% (~800 g)\n  protect  first_layer=true spaghetti=true halt=true (medium)\n\n$ bambu slice bracket.stl --recipe functional-petg\nsliced  bracket-functional-petg\n  time      35m 38s  (2138 s)\n  filament  13.22 g PETG (GFG00)   layers 113\n  temps     bed 70 C (textured_plate)   nozzle 252 C, first layer 252 C\n  3mf       ./bracket-functional-petg.gcode.3mf\n\n$ bambu print send bracket-functional-petg.gcode.3mf --slot A2 --dry-run   # preflight + exact payload, sends nothing\n$ bambu print send bracket-functional-petg.gcode.3mf --slot A2 --confirm   # after you've checked the plate is clear\n$ bambu monitor --snapshot-at-layer 2\n```\n\n- **A Bambu Lab printer in LAN Only mode with Developer Mode enabled.** Since the January 2025 \"Authorization Control\" firmware, the printer rejects unsigned third-party control commands otherwise.\n  - On the printer, go to **Settings → LAN Only** , enable**LAN Only Mode** , then**Developer Mode** . Note the**access code** shown there.\n  - Developer Mode disconnects the printer from Bambu Cloud and the Handy app. That's Bambu's tradeoff, not ours.\n  - Status (`bambu status` ) is read-only and works without Developer Mode. FTPS upload and control need it.\n- On the printer, go to \n- **[Bambu Studio](https://bambulab.com/en/download/studio)** installed, for`slice` .\n- **`ffmpeg`** , for camera snapshots.\n- **Tested models:** X1 Carbon. The X1/X1E/P1/A1/H2/P2S series use the same LAN protocol and should work, but they are untested. Camera snapshots are X1/H2/P2S-series only for now; P1/A1 use a different camera protocol.\n\n```\nbrew install voska/tap/bambu            # macOS / Linux\ngo install github.com/voska/bambu/cmd/bambu@latest\n```\n\nBinaries for macOS, Linux and Windows are on [Releases](https://github.com/voska/bambu/releases).\n\n```\n# 1. Add the printer (IP + serial from the printer's Settings, or use discovery)\nbambu printer discover                       # listens for the printer's SSDP broadcast (UDP 2021)\nbambu printer add workshop --host 192.168.1.50 --serial 00M00A000000000 --model X1C --nozzle 0.4 --plate textured_plate\n\n# 2. Store the access code in the OS keychain (read from stdin; verified against the printer, read-only)\nbambu auth set workshop                      # prompts; or: echo CODE | bambu auth set workshop\n\n# 3. Check\nbambu auth status --check\nbambu slicer info\nbambu status\n```\n\n**Config:** `~/.config/bambu/config.toml` (`%AppData%\\bambu\\config.toml` on Windows, or `$BAMBU_CONFIG`). Printers are named, and `--printer`/` BAMBU_PRINTER` picks one. `bambu` only reads and writes `config.toml`, so it coexists with other tools that use `~/.config/bambu/config.json`.\n\n**Access code:** looked up in this order:\n\n1. The OS keychain (service `bambu` , account = the printer serial)\n2. `BAMBU_ACCESS_CODE`\n3. Bambu Studio's `BambuStudio.conf` , as a last-resort fallback\n\nIt is never printed, and never written to the config.\n\n```\nbambu recipe list                                   # prototype-pla, solid-pla, functional-pla, functional-petg\nbambu slice part.3mf --recipe solid-pla             # STL / 3MF / OBJ\nbambu slice part.stl --recipe prototype-pla --set wall_loops=3 --filament \"Bambu PLA Matte\"\nbambu camera snapshot -o plate.jpg                  # look at the plate\nbambu preflight part-solid-pla.gcode.3mf --slot 4   # PASS/WARN/FAIL gates\nbambu print send part-solid-pla.gcode.3mf --slot 4 --confirm\nbambu monitor --snapshot-at-layer 2 --exec 'notify-send \"$BAMBU_EVENT $BAMBU_STATE\"'\n```\n\nA two-filament job changes colour at a layer height, and the AMS swaps by itself: no pause, nobody at the printer.\n\n```\nbambu slice sign.3mf --recipe prototype-pla \\\n  --filament \"Generic PLA\" --color FFFFFF --filament \"Bambu PLA Matte\" --color 000000 \\\n  --filament-change-z 4.0                           # white through Z 4.0, black from the next layer up\nbambu print send sign-prototype-pla.gcode.3mf --slot A4 --slot A1 --dry-run   # one slot per filament, in order\n```\n\n- `--filament-change-z` must be a layer top.`slice` reads the change back from the G-code and fails (exit 11) if Bambu Studio didn't place it.\n- The summary has grams per filament, including purge and prime-tower waste, and `filament_changes` .\n- To change colour by hand at a pause (e.g. a spool that isn't in the job), `bambu filament load --slot A1 --confirm` swaps the toolhead to another AMS slot remotely, then`bambu print resume --confirm` .\n\nRecipes name presets generically (`\"0.20mm Standard\"`, `\"Bambu PLA Basic\"`), and `bambu` resolves the right system preset for your printer model and nozzle.\n\n| recipe | for | settings | \n|---|---|---|\n| `prototype-pla` | fit/form checks | PLA Basic, 0.20 Standard, 2 walls, 15% gyroid | \n| `solid-pla` | solid PLA parts | Generic PLA, 6 walls (inner 0.45), 100% zig-zag | \n| `functional-pla` | strong PLA parts | 6 walls @ 0.45, 100% zig-zag, 5 top/bottom, elephant-foot 0.15 | \n| `functional-petg` | strong/warm/outdoor parts | as functional-pla in PETG Basic; 252 °C, 70 °C bed, fan ≤ 30% | \n\n- **No recipe adds a brim.** Brims are opt-in:`--set brim_type=outer_only --set brim_width=5` .\n- **Custom recipes:** drop JSON files in`~/.config/bambu/recipes/` . The same name overrides a built-in. See`bambu recipe show solid-pla` .\n- **`--set key=value`** takes any Bambu Studio setting key. Unknown keys are rejected before slicing. At 100% infill, patterns the slicer rejects (grid, gyroid, …) switch to zig-zag automatically.\n\n1. **`preflight` checks before anything is sent:**  - the printer is idle, with no blocking errors (informational HMS codes like \"Inspecting first layer\" are ignored)\n  - Developer Mode is on and an SD card is present\n  - the 3MF is intact and sliced for this printer model, with one `--slot` per filament\n  - the nozzle diameter and plate match\n  - each slot is loaded with its filament's type (a different product of that type is a WARN)\n  - each slot has enough filament (unknown remaining is a WARN), and the temperatures are sane\n  - the printer's AI protections are on (WARN only) and FTPS login works\n2. **`print send`** re-runs preflight and refuses on any FAIL. It requires`--confirm` , uploads over FTPS, reads the file back to verify its MD5, then starts the job with bed leveling, flow calibration, vibration compensation and first-layer inspection**on** .\n3. **`print pause|resume|stop`** require`--confirm` .`resume` exits 0 only once the printer reports RUNNING. It refuses mid-filament-change, and with an empty toolhead on the X1 series.\n4. **`filament load`** requires`--confirm` and works only while paused or idle. When paused, the toolhead must hold an AMS filament and the slot must hold the same material. It exits 0 only once the printer reports that slot in the toolhead.\n\n`bambu` has no command that changes printer settings.\n\n`bambu exit-codes`\n\n| code | meaning | \n|---|---|\n| 0 | success | \n| 1 | error | \n| 2 | usage | \n| 3 | empty | \n| 4 | auth required / code refused | \n| 5 | not found | \n| 6 | forbidden (Developer Mode off) | \n| 8 | retryable (unreachable/timeout) | \n| 9 | gate failed (preflight FAIL, missing `--confirm` , busy) | \n| 10 | config error / slicer not found | \n| 11 | slice failed | \n| 12 | print failed | \n| 13 | print paused, needs a human | \n| 14 | monitor timeout | \n\n- `bambu schema --json` returns the full command tree with flags.`bambu schema print send` returns one command.\n- Every command takes `--json` . Errors come back as`{\"error\":{\"code\",\"name\",\"message\",\"hint\"}}` , and the`hint` says what to do next.\n- `status --watch --json` and`monitor --json` stream NDJSON events.\n- There's an agent skill in [`skills/bambu/SKILL.md`](https://github.com/voska/bambu/blob/main/skills/bambu/SKILL.md) . The recommended flow: status → slice → dry-run → show the human the summary, preview and snapshot →`--confirm` only after explicit approval.\n\n- \n**Bambu Studio** is discovered in this order:\n  1. `BAMBU_STUDIO_PATH` /`[slicer] path`\n  2. `/Applications/BambuStudio.app` (macOS)\n  3. `bambu-studio` in the usual Linux paths, Flatpak, or an extracted AppImage\n  4. `Program Files\\Bambu Studio` (Windows)\n Only macOS is tested. A packed AppImage can't be read, so extract it ( `--appimage-extract` ) or set`[slicer] resources` .\n- \n**Presets are flattened by `bambu`.** The Bambu Studio CLI does not resolve` inherits` /`include` in preset files. Unflattened presets slice \"successfully\" with a generic 200×200 bed and no printer start G-code.\n- \n**STEP is not supported by the Bambu Studio CLI.** Export STL or 3MF instead.\n- \n**OrcaSlicer** isn't supported yet. Its 2.4.x CLI has the same`inherits` problem (fixed upstream after 2.4.2).\n\nThe LAN protocol details come from these open projects' public documentation and code. No code was copied.\n\n- [OpenBambuAPI](https://github.com/Doridian/OpenBambuAPI) (GFDL docs): MQTT, FTPS and video.\n- [ha-bambulab](https://github.com/greghesp/ha-bambulab) (MIT): HMS decoding, stage names,`print.fun` Developer Mode bit,`project_file` usage.\n- [bambulabs_api](https://github.com/BambuTools/bambulabs_api) (MIT): implicit FTPS with TLS session reuse.\n- [Bambu Studio](https://github.com/bambulab/BambuStudio) (AGPL-3.0): preset resolution order and AMS mapping format were read from its source;`bambu` invokes the installed app and ships none of its files.\n\nNot affiliated with Bambu Lab. \"Bambu Lab\" is a trademark of its owner.\n\nMIT", "url": "https://wpnews.pro/news/bambu-lab-cli-for-slicing-and-printing-3d-models", "canonical_source": "https://github.com/voska/bambu", "published_at": "2026-10-24 22:42:57+00:00", "updated_at": "2026-10-24 23:12:54.045506+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools"], "entities": ["Bambu Lab", "Bambu Studio", "voska", "X1 Carbon", "Bambu Connect", "GitHub"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/bambu-lab-cli-for-slicing-and-printing-3d-models", "markdown": "https://wpnews.pro/news/bambu-lab-cli-for-slicing-and-printing-3d-models.md", "text": "https://wpnews.pro/news/bambu-lab-cli-for-slicing-and-printing-3d-models.txt", "jsonld": "https://wpnews.pro/news/bambu-lab-cli-for-slicing-and-printing-3d-models.jsonld"}}