Discover how Chinese LLMs like DeepSeek-V4, GLM-4, and Qwen3 are transforming water treatment, utility management, leak detection, and regulatory compliance. Access all models through a single API at TokenEase.
Water utilities manage critical infrastructure serving billions of people worldwide. From drinking water treatment to wastewater processing, stormwater management to pipe network maintenance, the sector generates vast operational data and complex regulatory requirements. Chinese LLMs offer powerful capabilities for analyzing water quality data, optimizing treatment processes, and ensuring compliance. This guide explores six practical applications with complete TokenEase API code examples.
Continuous monitoring of water quality parameters is essential for public health protection. LLMs can analyze multi-parameter sensor data to detect anomalies, identify contamination sources, and recommend corrective actions.
import requests
water_quality_data = """
Treatment plant: Municipal drinking water, 150,000 population served
Source: River intake, 5km upstream of plant
Current readings (24h average):
- Turbidity: 3.2 NTU (baseline: 1.8, alert: 4.0)
- pH: 6.9 (range: 6.5-8.5)
- Dissolved oxygen: 7.8 mg/L
- Total organic carbon: 4.2 mg/L (baseline: 2.5)
- Nitrates: 12 mg/L (limit: 50)
- Chlorine residual: 0.8 mg/L (target: 0.5-1.0)
- E. coli: 0 CFU/100mL
Weather: Heavy rainfall 48h ago, river flow increased 40%
Upstream activities: Agricultural runoff zone, 2 industrial discharge permits
"""
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 water quality engineer specializing in drinking water treatment. Analyze monitoring data to assess water quality status, detect anomalies, trace potential sources, and recommend operational adjustments following WHO guidelines and local regulations."},
{"role": "user", "content": f"Analyze this water quality data and provide: 1) Overall quality assessment with trend analysis, 2) Anomaly identification and probable causes, 3) Source attribution for elevated parameters, 4) Recommended operational adjustments, 5) Regulatory compliance status, 6) Public health risk assessment, 7) Sampling and monitoring recommendations.\n\n{water_quality_data}"}
],
"temperature": 0.3,
"max_tokens": 2500
}
)
print(response.json()["choices"][0]["message"]["content"])
Water and wastewater treatment involves complex chemical and biological processes. LLMs can analyze process data to optimize chemical dosing, energy consumption, and sludge management while maintaining effluent quality.
import requests
process_data = """
Wastewater treatment plant: Activated sludge, 50,000 m3/day capacity
Current operating parameters:
- Influent BOD: 280 mg/L (design: 250)
- Influent TSS: 220 mg/L (design: 200)
- MLSS: 3,200 mg/L (target: 3,000-3,500)
- F/M ratio: 0.28 (optimal: 0.2-0.4)
- SRT: 12 days (target: 10-15)
- DO in aeration: 2.1 mg/L (target: 2.0-2.5)
- Effluent BOD: 18 mg/L (limit: 20)
- Effluent TSS: 22 mg/L (limit: 30)
- Chemical usage: Alum 120 kg/day, Polymer 45 kg/day
- Energy: 0.85 kWh/m3 (benchmark: 0.75)
Sludge: 8.5 m3/day dewatered, disposal cost $85/ton
"""
response = requests.post(
"https://tokenease.io/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_TOKENEASE_API_KEY"},
json={
"model": "glm-4",
"messages": [
{"role": "system", "content": "You are a wastewater process engineer specializing in activated sludge optimization. Analyze process data to recommend operational improvements that reduce costs, improve effluent quality, and enhance energy efficiency."},
{"role": "user", "content": f"Analyze this process data and provide: 1) Process performance assessment vs design and regulatory targets, 2) Optimization opportunities with expected impact, 3) Chemical dosing adjustment recommendations, 4) Energy reduction strategies, 5) Sludge management improvements, 6) Risk factors and mitigation, 7) 30-day action plan with priorities.\n\n{process_data}"}
],
"temperature": 0.3,
"max_tokens": 2500
}
)
print(response.json()["choices"][0]["message"]["content"])
Non-revenue water from leaks costs utilities billions annually. LLMs can analyze pressure data, flow patterns, and maintenance records to prioritize leak repairs and predict pipe failures.
import requests
network_data = """
Water distribution network: 450km of pipes, 85-year-old system
Pipe materials: 40% cast iron, 35% ductile iron, 20% PVC, 5% asbestos cement
Recent incidents (last 90 days):
- 12 burst mains (average repair cost $8,500)
- 28 reported leaks (average repair cost $1,200)
- 3 major breaks in cast iron pipes installed 1935-1945
Pressure data: 5 zones showing pressure drops >15% during peak demand
Flow analysis: Night flow minimum 18% of daytime (benchmark: 12%)
Customer complaints: 45 reports of low pressure, 12 of discolored water
SCADA alerts: 3 flow meters showing unexplained flow variations
Planned replacement program: 15km/year, $4.2M annual budget
"""
response = requests.post(
"https://tokenease.io/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_TOKENEASE_API_KEY"},
json={
"model": "qwen3",
"messages": [
{"role": "system", "content": "You are a water distribution network engineer specializing in leak detection and asset management. Analyze network data to identify high-risk areas, prioritize repairs, and optimize capital replacement programs."},
{"role": "user", "content": f"Analyze this network data and provide: 1) Leak loss estimate and financial impact, 2) Priority repair locations with reasoning, 3) Pipe failure risk assessment by segment, 4) Optimal replacement sequencing, 5) Pressure zone optimization recommendations, 6) SCADA alert investigation priorities, 7) 5-year capital improvement plan.\n\n{network_data}"}
],
"temperature": 0.3,
"max_tokens": 2500
}
)
print(response.json()["choices"][0]["message"]["content"])
Water utilities must comply with complex and evolving regulations. LLMs can track regulatory changes, ensure reporting accuracy, and generate compliance documentation for audits and permits.
import requests
compliance_context = """
Utility: Regional water authority, 12 treatment facilities
Permits: NPDES discharge permits for 8 WWTPs, SDWA for 12 WTPs
Recent regulatory updates:
- New PFAS maximum contaminant levels: PFOA 4 ppt, PFOS 4 ppt
- Revised lead and copper rule: stricter sampling requirements
- New stormwater MS4 permit: enhanced monitoring for 6 municipalities
- Emerging contaminants monitoring: 6-month quarterly reporting pilot
Enforcement history: 1 consent decree (2024), 3 NOVs in past 2 years
Current monitoring program: 150 parameters across all facilities
Reporting burden: 45 regulatory reports annually, 2.5 FTE dedicated
"""
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 water regulatory compliance manager. Track regulatory requirements, assess compliance status, generate permit applications and reports, and develop proactive compliance strategies following EPA and state regulations."},
{"role": "user", "content": f"Generate a compliance management assessment including: 1) Regulatory gap analysis by facility, 2) Priority compliance actions for next 12 months, 3) PFAS compliance roadmap with cost estimates, 4) Monitoring program optimization, 5) Reporting automation opportunities, 6) Training needs assessment, 7) Budget recommendation for compliance activities.\n\n{compliance_context}"}
],
"temperature": 0.3,
"max_tokens": 2500
}
)
print(response.json()["choices"][0]["message"]["content"])
Climate change is increasing the frequency and intensity of storm events. LLMs can analyze rainfall forecasts, drainage capacity, and historical flood data to predict flooding and optimize stormwater system responses.
import requests
stormwater_context = """
Municipality: Coastal city, 250,000 population
Stormwater system: 280km of drains, 12 pump stations, 8 detention basins
Forecast: 72-hour storm event, 150mm rainfall predicted (100-year storm = 180mm)
System capacity: Design for 5-year storm, 85% capacity at 10-year event
Vulnerable areas: 3 neighborhoods with chronic flooding, 2 schools in floodplain
Historical: Last major flood (2024) caused $12M damage, 48-hour recovery
Green infrastructure: 15 bioswales, 8 permeable pavement projects (pilot)
Emergency response: 6-hour mobilization protocol, mutual aid agreements
"""
response = requests.post(
"https://tokenease.io/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_TOKENEASE_API_KEY"},
json={
"model": "glm-4",
"messages": [
{"role": "system", "content": "You are a stormwater management engineer specializing in flood prediction and climate adaptation. Analyze storm scenarios to predict flooding, recommend system responses, and develop long-term resilience strategies."},
{"role": "user", "content": f"Generate a storm event response plan including: 1) Flood risk assessment by zone with probability, 2) Pre-storm preparation checklist, 3) Real-time response protocols during event, 4) Pump station and gate operation schedule, 5) Evacuation trigger criteria, 6) Post-event damage assessment framework, 7) Green infrastructure performance evaluation, 8) Long-term system upgrade recommendations.\n\n{stormwater_context}"}
],
"temperature": 0.3,
"max_tokens": 2500
}
)
print(response.json()["choices"][0]["message"]["content"])
Water utilities must communicate effectively with customers during normal operations and emergencies. LLMs can draft customer notifications, answer inquiries, and manage crisis communications during boil water advisories or service disruptions.
import requests
crisis_context = """
Incident: Main break on primary transmission line
Impact: 35,000 households without water, estimated 24-hour repair
Cause: 60-year-old cast iron pipe failure, corrosion-induced
Current status: Crews mobilized, bypass being established
Water quality: Pressure loss requires boil water advisory
Affected areas: 3 neighborhoods, 2 hospitals, 1 school district
Timeline: Break detected 06:00, repair expected complete 06:00 tomorrow
Alternative supply: Water tankers deployed to 5 locations
"""
response = requests.post(
"https://tokenease.io/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_TOKENEASE_API_KEY"},
json={
"model": "qwen3",
"messages": [
{"role": "system", "content": "You are a water utility communications director. Draft clear, accurate, and empathetic customer communications for service disruptions, boil water advisories, and emergency situations. Ensure regulatory compliance and public safety messaging."},
{"role": "user", "content": f"Generate a crisis communication package including: 1) Initial public alert (SMS/social media, 160 chars), 2) Detailed customer notification (email, 300 words), 3) Boil water advisory with clear instructions, 4] Press release for media, 5) Internal staff communication, 6) Hospital/school specific notifications, 7) Recovery and all-clear messaging template, 8) FAQ document for customer service team.\n\n{crisis_context}"}
],
"temperature": 0.4,
"max_tokens": 2500
}
)
print(response.json()["choices"][0]["message"]["content"])
Access DeepSeek-V4, GLM-4, Qwen3, and 20+ other models through a single API.