Marlin, Klipper & AI: How to Connect Your 3D Printer to ASI Biont (Guide with 12 Scenarios)

3D printing has moved beyond hobbyist toys: factories use dozens of networked printers, and a single failed print can cost hours and material. Marlin and Klipper are the two most popular open-source firmware families, but they offer very different APIs for external control. By connecting your printer to an AI agent like ASI Biont, you get an assistant that can monitor temperatures, detect errors, and even adjust G-code — all through a chat interface.

ASI Biont does not require a custom integration for each device. It connects to any hardware using execute_python — the AI itself writes Python code using pyserial, paramiko, paho-mqtt, pymodbus, aiohttp, or opcua-asyncio. You simply describe your device in chat (port, IP, API key), and ASI Biont generates the script. All operations happen through a natural dialogue; there are no control panels or "Add Device" buttons.

Marlin vs Klipper: What You Need to Know

Firmware Host API Use case
Marlin OctoPrint (or direct USB) OctoPrint REST API Legacy printers, simple setups
Klipper Moonraker (Raspberry Pi) Moonraker JSON API + WebSocket High-speed printing, advanced control

Moonraker became an official part of Klipper in 2020, and its documentation lists endpoints like /printer/print/start and /printer/objects/query. OctoPrint's API docs are equally well-defined. The firmware itself (Marlin or Klipper) is irrelevant if the printer is exposed through these APIs.

Selecting the Right Connection Method

Method When to use Example library
HTTP API Moonraker/OctoPrint aiohttp
MQTT Real-time events paho-mqtt
Serial (Hardware Bridge) Direct Marlin USB industrial_command()
execute_python Universal fallback any Python lib

For most integrations, the fastest route is over HTTP using Moonraker or OctoPrint. If your printer publishes MQTT telemetry, you can also use paho-mqtt for event streams. For a direct serial connection (e.g., Marlin over USB), ASI Biont's Hardware Bridge (bridge.py) is required. The bridge uses the industrial_command() function:

from bridge import industrial_command
response = industrial_command(protocol='serial', command='M105', port='COM3', baudrate=115200)

Note that bridge.py is only available from the ASI Biont dashboard, not from public repositories. The launch command looks like:

python bridge.py --token=XXX --ports=COM3 --baud 115200 --rate=10

How a Typical Integration Looks in Chat

Imagine you want to start a print from your phone. You type to ASI Biont:

Start a print of benchy.gcode on my Klipper printer at 192.168.1.50:7125.

The agent will generate a script like this:

import requests
requests.post('http://192.168.1.50:7125/printer/print/start?filename=benchy.gcode')

That's it. The integration layer is invisible; you just get the result message in chat.

12 Practical Scenarios for 3D Printer Automation

Here are twelve common tasks with the exact code snippets that ASI Biont can generate and run on demand.

# Scenario Example command
1 Start a print requests.post('http://IP:7125/printer/print/start?filename=benchy.gcode')
2 Pause print requests.post('http://IP:7125/printer/print/pause')
3 Resume print requests.post('http://IP:7125/printer/print/resume')
4 Cancel print requests.post('http://IP:7125/printer/print/cancel')
5 Set extruder temperature requests.post('http://IP:7125/printer/gcode/script?script=SET_HEATER_TEMPERATURE HEATER=extruder TARGET=210')
6 Extrude 50mm of filament requests.post('http://IP:7125/printer/gcode/script?script=G1 E50 F300')
7 Home all axes requests.post('http://IP:7125/printer/gcode/script?script=G28')
8 Get nozzle and bed temps requests.get('http://IP:7125/printer/objects/query?extruder=temperature&heater_bed=temperature')
9 Get print progress requests.get('http://IP:7125/printer/objects/query?print_stats=print_duration')
10 Check printer cooling fan requests.get('http://IP:7125/printer/objects/query?fan=value')
11 Send error alert to Telegram requests.post('https://api.telegram.org/botTOKEN/sendMessage', json={'chat_id':'ID','text':'Print failed'})
12 Send error alert to Slack requests.post('https://hooks.slack.com/services/XXX', json={'text':'Print failed'})

These are only building blocks. Because ASI Biont writes code on the fly, you can combine them into complex workflows: "Cancel the print, turn on the LED, and message me on Telegram if the bed temperature drops below 50°C." The agent will call the appropriate Moonraker endpoints or use MQTT/WebSocket events.

Safety Tips

  • Store API keys (Moonraker, Telegram, Slack) as secrets in ASI Biont.
  • For direct serial access, prefer industrial_command() over raw socket commands.
  • If your printer crashes, use execute_python with a short async script instead of an infinite loop (30s timeout).

Conclusion

Connecting a Marlin or Klipper 3D printer to ASI Biont is not just about remote control — it's about giving your printer a brain. With automatic error handling, G-code analysis, and chat-based management, you can reduce failed prints and free up time. The integration takes seconds because the AI writes the code for you. Try it on asibiont.com and build your first automation scenario today.

← All posts

Comments