Robotics and industrial automation systems generate massive volumes of technical documentation: robot programs, PLC logic, sensor data logs, maintenance records, safety assessments, and process specifications. Chinese LLMs like DeepSeek V4, GLM-4, and Qwen3 can process this complex engineering data to generate code, analyze failures, optimize processes, and create documentation. TokenEase's unified API provides automation engineers and system integrators with cost-effective access to these powerful models.
Generate and optimize robot motion programs from task descriptions, workpiece specifications, and cell layout constraints.
import requests
def generate_robot_program(task_description, robot_model, workpiece_specs, cell_constraints, safety_requirements):
response = requests.post(
"https://tokenease.io/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_TOKENEASE_API_KEY"},
json={
"model": "deepseek-v4",
"messages": [
{"role": "system", "content": "You are a robotics engineer. Generate robot programs in the specified robot language (RAPID, KRL, Fanuc TP, etc.). Include safety checks, collision avoidance, and cycle time optimization. Comment code extensively."},
{"role": "user", "content": f"Safety: {safety_requirements}\nCell: {cell_constraints}\nWorkpiece: {workpiece_specs}\nRobot: {robot_model}\nTask:\n{task_description}\n\nGenerate program."}
]
}
)
return response.json()["choices"][0]["message"]["content"]
task = "Pick aluminum housing from inbound conveyor, place in CNC fixture, signal cycle start, wait for completion signal, remove finished part, place on outbound conveyor. Cycle time target: <45 seconds."
robot = "ABB IRB 2600, 6-axis, payload 20kg, reach 1.65m, RAPID language"
workpiece = "Aluminum housing, 2.5kg, dimensions 300x200x150mm, fragile sealing surface on top face, must maintain orientation"
cell = "Inbound conveyor: 800mm height, parts at 500mm spacing. CNC fixture: 1200mm height, 400mm from robot base. Outbound conveyor: 900mm height, 600mm from fixture. Robot mounted on pedestal, base at 300mm height."
safety = "Light curtain at cell entrance. E-stop accessible from operator station. Part present sensors on both conveyors. Force limit 50N during pick/place."
program = generate_robot_program(task, robot, workpiece, cell, safety)
Generate PLC ladder logic or structured text from process descriptions, and troubleshoot existing logic from fault descriptions.
def generate_plc_logic(process_description, i_o_list, safety_interlocks, plc_platform):
response = requests.post(
"https://tokenease.io/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_TOKENEASE_API_KEY"},
json={
"model": "qwen3-235b",
"messages": [
{"role": "system", "content": f"You are a PLC programmer. Generate {plc_platform} code from process descriptions. Include safety interlocks, fault handling, and diagnostic comments. Follow IEC 61131-3 standards."},
{"role": "user", "content": f"Platform: {plc_platform}\nInterlocks: {safety_interlocks}\nI/O:\n{i_o_list}\nProcess:\n{process_description}\n\nGenerate PLC logic."}
]
}
)
return response.json()["choices"][0]["message"]["content"]
process = """
Automated bottle filling station:
1. Bottle present sensor triggers filling sequence
2. Filling valve opens for 3.5 seconds (500ml fill)
3. Level sensor verifies fill (must detect liquid within 5 seconds of valve open)
4. Capping actuator extends for 2 seconds
5. Cap presence sensor verifies capping
6. Conveyor advances to next station
7. If any step fails, stop and alarm
"""
io = """
DI: BottlePresent (I0.0), LevelSensor (I0.1), CapPresent (I0.2), EStop (I0.3)
DO: FillValve (Q0.0), CapActuator (Q0.1), Conveyor (Q0.2), AlarmHorn (Q0.3)
AI: FillPressure (AIW0) - must be >2.5 bar during fill
"""
interlocks = "E-stop immediately stops all outputs. Conveyor must not run if guard door open (DI I0.4). Fill valve must not open if no bottle present."
platform = "Siemens S7-1200, TIA Portal, Ladder Logic (LAD)"
plc = generate_plc_logic(process, io, interlocks, platform)
Analyze sensor logs and diagnostic data to identify anomalies, predict failures, and recommend maintenance actions.
def analyze_sensor_data(sensor_readings, system_context, normal_operating_ranges, anomaly_history):
response = requests.post(
"https://tokenease.io/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_TOKENEASE_API_KEY"},
json={
"model": "glm-4-plus",
"messages": [
{"role": "system", "content": "Analyze industrial sensor data to identify anomalies, diagnose root causes, and recommend maintenance or operational adjustments. Consider sensor cross-correlations and process relationships."},
{"role": "user", "content": f"History: {anomaly_history}\nRanges: {normal_operating_ranges}\nContext: {system_context}\nData:\n{sensor_readings}\n\nAnalyze and recommend."}
]
}
)
return response.json()["choices"][0]["message"]["content"]
readings = """
2026-08-22 08:00: Motor current 12.5A (normal 10-12A), Vibration X: 3.2 mm/s (normal <4), Vibration Y: 2.8 mm/s (normal <4), Temperature: 68C (normal <75)
2026-08-22 08:15: Motor current 14.2A, Vibration X: 5.1 mm/s, Vibration Y: 4.6 mm/s, Temperature: 72C
2026-08-22 08:30: Motor current 15.8A, Vibration X: 7.8 mm/s, Vibration Y: 6.9 mm/s, Temperature: 78C
2026-08-22 08:45: Motor current 16.5A, Vibration X: 9.2 mm/s, Vibration Y: 8.1 mm/s, Temperature: 82C
"""
context = "CNC spindle motor, 15kW, 12,000 RPM max. Currently running 8,000 RPM milling operation. Last bearing replacement: 14 months ago. Last maintenance: 3 months ago (cleaned, lubricated)."
ranges = "Normal: Current 10-12A, Vibration X/Y <4 mm/s, Temp <75C. Warning: Current >13A, Vibration >5 mm/s, Temp >75C. Alarm: Current >15A, Vibration >8 mm/s, Temp >80C."
history = "Bearing degradation in similar motors typically shows: current increase first, then vibration increase, then temperature rise. Motor replaced at 18 months average due to bearing wear in this application."
anomaly = analyze_sensor_data(readings, context, ranges, history)
Generate safety risk assessments and documentation for robotic cells following ISO 10218 and ANSI/RIA standards.
def generate_safety_assessment(cell_description, robot_specifications, hazards_identified, mitigation_measures, applicable_standards):
response = requests.post(
"https://tokenease.io/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_TOKENEASE_API_KEY"},
json={
"model": "kimi-k2",
"messages": [
{"role": "system", "content": "Generate robot safety risk assessments following ISO 10218-1/2 and ANSI/RIA R15.06. Include hazard identification, risk estimation, risk reduction measures, and residual risk assessment."},
{"role": "user", "content": f"Standards: {applicable_standards}\nMitigations: {mitigation_measures}\nHazards: {hazards_identified}\nRobot: {robot_specifications}\nCell:\n{cell_description}\n\nGenerate assessment."}
]
}
)
return response.json()["choices"][0]["message"]["content"]
cell = "Collaborative welding cell: Human operator loads fixtures, robot performs MIG welding. Shared workspace during loading, robot operates autonomously during welding. Cell size 4x3m, fenced perimeter with interlocked gate."
robot = "FANUC CR-15iA collaborative robot, payload 15kg, reach 1,449mm, equipped with force/torque sensing, speed limited to 250mm/s in collaborative mode"
hazards = "Crushing between robot and fixture, welding arc flash, hot metal spatter, fumes, unexpected robot motion during loading, trapped by robot in workspace"
mitigations = "Force limiting to 150N, safety-rated monitored stop, protective fencing with interlocks, welding curtains, fume extraction, PPE requirements, two-hand enable for operator"
standards = "ISO 10218-1:2011, ISO 10218-2:2011, ANSI/RIA R15.06-2012, ISO/TS 15066:2016"
safety = generate_safety_assessment(cell, robot, hazards, mitigations, standards)
Generate detailed work instructions, setup procedures, and changeover documentation from engineering specifications and process requirements.
def generate_work_instruction(process_specification, equipment_list, quality_requirements, operator_skill_level):
response = requests.post(
"https://tokenease.io/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_TOKENEASE_API_KEY"},
json={
"model": "deepseek-v4",
"messages": [
{"role": "system", "content": "Generate clear, step-by-step manufacturing work instructions. Include safety warnings, quality checks, setup procedures, and troubleshooting guidance. Use visual language where appropriate."},
{"role": "user", "content": f"Skill: {operator_skill_level}\nQuality: {quality_requirements}\nEquipment: {equipment_list}\nProcess:\n{process_specification}\n\nGenerate work instruction."}
]
}
)
return response.json()["choices"][0]["message"]["content"]
spec = "Automated assembly station: Install circuit board into housing, insert 4 screws, apply adhesive sealant, perform functional test, apply barcode label. Changeover from Product A to Product B: housing size changes (150mm to 180mm), screw positions change, test parameters change."
equipment = "ABB IRB 1200 robot, Desoutter screwdrivers (4x), Nordson adhesive dispenser, Keysight functional tester, Zebra barcode printer"
quality = "Screw torque: 2.5 +/- 0.2 Nm. Adhesive bead: 2mm width, continuous, no gaps. Functional test: all 12 test points pass within +/- 5% tolerance. Barcode readable by scanner."
skill = "Level 2 operators: trained on robot cell operation, 6+ months experience, authorized for changeover procedures"
instruction = generate_work_instruction(spec, equipment, quality, skill)
Analyze failure reports, maintenance data, and process logs to identify root causes and document corrective actions.
def analyze_failure_mode(failure_description, process_data, maintenance_history, design_specifications, previous_occurrences):
response = requests.post(
"https://tokenease.io/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_TOKENEASE_API_KEY"},
json={
"model": "qwen3-235b",
"messages": [
{"role": "system", "content": "Analyze automation system failures using structured problem-solving methods (5-Why, Fishbone, FMEA). Identify root causes, assess systemic issues, and recommend corrective and preventive actions."},
{"role": "user", "content": f"Previous: {previous_occurrences}\nDesign: {design_specifications}\nMaintenance: {maintenance_history}\nProcess: {process_data}\nFailure:\n{failure_description}\n\nAnalyze and recommend."}
]
}
)
return response.json()["choices"][0]["message"]["content"]
failure = "Robot intermittently drops parts during pick operation. Occurs approximately 1 in 50 cycles. No clear pattern - random throughout shift. Vacuum gripper pressure shows normal during operation."
process = "Pick from vibratory bowl feeder, transfer 300mm to fixture, place with 0.1mm accuracy. Cycle time 4.2 seconds. Vacuum grip: 2x suction cups, 400mm diameter, -0.6 bar vacuum."
maintenance = "Vacuum pump serviced 2 months ago. Suction cups replaced 1 month ago. No issues found during last preventive maintenance. Vacuum sensor calibrated 3 months ago."
design = "Part weight: 45g, smooth surface (no texture), slightly oily from upstream machining. Gripper design: 2-point contact, vacuum cups positioned at center of gravity. Safety factor: 3x part weight."
previous = "Similar issue occurred 6 months ago: resolved by cleaning suction cups (oil buildup). Issue returned 3 weeks ago after new machining supplier introduced."
rca = analyze_failure_mode(failure, process, maintenance, design, previous)
Get $1 free credits (1M tokens) to generate robot programs and analyze sensor data.
Start with TokenEase →