main.py ×
1 import brok_api
2 from brok_api import Chat, CodeGen, ImageGen
3
4 # Initialize BROK connection
5 client = brok_api.connect("localhost:12222")
6
7 # Generate code with AI
8 def generate_gcode(description: str) -> str:
9 """Generate G-code from natural language description."""
10 response = client.code.generate(
11 prompt=description,
12 language="gcode",
13 model="qwen-coder-32b"
14 )
15 return response.code
16
17 # Example usage
18 gcode = generate_gcode("Cut a 12 inch circle in 1/4 steel")
19 print(gcode)
Output
Ready. Press Run or ask BROK to execute code.
Code Assistant
Image Preview
Your generated images will appear here
Recent Generations
No images yet
Source (Optional)
Video Preview
Generated videos will appear here
Video generation takes 2-5 minutes
✎
Design Canvas
Draw, import, or AI-generate designs
Properties
AI Design
X
0.000
in
Y
0.000
in
Z
0.000
in
48.25" x 33.3"
Jog Controls
Machine Status
State
IDLE
THC
120.5V
Arc
OFF
Feed
100%
G-Code
No file loaded
; Load a G-code file to preview
Research Results
Ask a research question to get comprehensive answers with sources
Fire Pits
Signs
Brackets
design_v2.svg
firepit_36in.dxf
cut_program.nc
brok@system:~$
Welcome to BROK Terminal
Type 'help' for available commands, or use natural language.
Connected to: localhost:12222 | NATS: 42222 | Status: Online
brok@system:~$
247
Conversations Today
89
Images Generated
12
CNC Jobs
$1,847
Revenue (Week)
Service Control
LLM Workers
3/3 Online
Image Gen
Online
Video Gen
Online
CNC Controller
Online
NATS Mesh
Online
Qdrant
Online
Recent Orders
#1047
Custom Fire Pit 36"
Pending
$285
#1046
Metal Sign "Smith & Co"
In Progress
$125
#1045
Brackets (x20)
Complete
$340
GPU Status
GPU 0: NVIDIA RTX 5090
52°C
Running: Qwen2.5-14B-Instruct
GPU 1: NVIDIA RTX 5090
58°C
Running: Qwen2.5-Coder-32B
GPU 2: NVIDIA RTX A6000
45°C
Running: Qwen2.5-VL-7B, FLUX.1-dev
Services
NATS Mesh:42222
Chat API:12222
Qdrant:6333
Image Gen:8188
Video Gen:8189
Code Server:8190
CNC Control:8191
Embeddings:8192
Storage
NVMe 0 (System)
450 GB / 1 TB
NVMe 1 (Models)
1.44 TB / 2 TB
RAID Array
2.1 TB / 6 TB
Network
Uptime
14d 7h 23m
Requests/min
127
Active Sessions
3
Queue Depth
0