A Python toolkit integrating LLM chat, Feishu/Lark bots, DNS management, SSL certificates, and more.
pip install chattool --upgradeMinimum supported Python version: 3.9.
Centralized configuration with automatic secret masking and hidden input for sensitive fields.
# Interactive init (sensitive fields hidden automatically)
chatenv init -i
# Init only specific service config
chatenv init -i -t openai
chatenv init -i -t feishu
# View config (secrets auto-masked)
chatenv cat
# Filter by type
chatenv cat -t feishu
# Set / get individual values
chatenv set OPENAI_API_KEY=sk-xxx
chatenv get OPENAI_API_KEY
# Profile management
chatenv save work && chatenv use workOpenAI-compatible chat objects with multi-turn dialogue, batch processing, async concurrency, and streaming.
from chattool import Chat
# Multi-turn dialogue
chat = Chat("Hello!")
resp = chat.get_response()
chat.user("How are you?")
chat.get_response()
chat.save("chat.json", mode="w")
# Async concurrency
import asyncio
base = Chat().system("You are a helpful assistant")
tasks = [base.copy().user(f"Topic {i}").async_get_response() for i in range(5)]
responses = asyncio.run(asyncio.gather(*tasks))
# Streaming
async for chunk in Chat().user("Write a poem").async_get_response_stream():
if chunk.delta_content:
print(chunk.delta_content, end="", flush=True)Send messages, start Echo/AI bots with one command. Supports text, image, file, and rich-text messages.
# Send messages
chattool lark send -r USER_ID -m "Hello"
chattool lark send -r USER_ID --image photo.png
chattool lark send -r USER_ID --file report.pdf
# Start Echo bot (WebSocket)
chattool serve lark echo
# Start AI conversation bot
chattool serve lark ai --model gpt-4o
# View bot info and permissions
chattool lark info
chattool lark scopesfrom chattool.tools.lark import LarkBot
bot = LarkBot()
bot.send_text("ou_xxx", "open_id", "Hello!")
bot.send_image_file("ou_xxx", "open_id", "photo.png")
@bot.on_message
def handle(ctx):
ctx.reply_text(f"Received: {ctx.text}")
bot.start()Unified DNS interface for Alibaba Cloud and Tencent Cloud, with DDNS and automatic SSL certificate renewal.
# Query / set DNS records
chattool dns get test.example.com
chattool dns set test.example.com -v 1.2.3.4
# DDNS (public / LAN IP)
chattool dns ddns -d example.com -r home --monitor
chattool dns ddns -d example.com -r nas --ip-type local --local-ip-cidr 192.168.1.0/24
# SSL certificate auto-renewal
chattool dns cert-update -d example.com -e admin@example.com --cert-dir ./certsSupports Tongyi, Hugging Face, LiblibAI, Pollinations.ai, and SiliconFlow.
# Install image dependencies
pip install "chattool[images]"
# Pollinations (requires POLLINATIONS_API_KEY)
chattool image pollinations list-models
chattool image pollinations generate "a cat in space" -o cat.png
# SiliconFlow (requires SILICONFLOW_API_KEY)
chattool image siliconflow list-models
chattool image siliconflow generate "a cute dog" -o dog.pngchattool nginx --list
chattool nginx proxy-pass --set SERVER_NAME=app.example.com --set PROXY_PASS=http://127.0.0.1:8080
chattool nginx websocket-proxy ./websocket.conf --set SERVER_NAME=ws.example.com --set PROXY_PASS=http://127.0.0.1:3000
chattool nginx -i| Tool | Command | Description |
|---|---|---|
| Network Scan | chattool network scan |
Scan LAN for active hosts and SSH ports |
| Nginx Config | chattool nginx |
Generate template-based reverse proxy and static site configs |
| MCP Server | chattool mcp info / chattool mcp inspect |
Inspect MCP server capabilities (JSON supported) |
| Screenshot | chattool serve capture |
Local webpage screenshot service |
| Cert Mgmt | chattool serve cert / chattool client cert |
SSL certificate distribution |
| Setup | chattool setup codex/claude/opencode |
Install or upgrade common agent CLIs; supports --install-only for pure install/upgrade flows without writing config |
| Workspace | chattool setup workspace |
Create a collaboration workspace around a core project with projects/ as the execution container and workspace-level files as the general-use protocol layer; supports --with-opencode-loop for a loop-aware OpenCode workspace variant |
| Skills | chattool skill install |
Install ChatTool skills to Codex / Claude / OpenCode |
| CC-Connect | chattool cc |
Quick cc-connect setup and start |
MIT License. See the LICENSE file for details.
5.3.0— Feishu/Lark bot (messaging, event routing, AI chat), CLI tools (chattool lark,chattool serve lark)5.0.0— DNS management (Aliyun/Tencent), DDNS, SSL cert auto-renewal, centralized env config4.1.0— UnifiedChatAPI (sync/async/stream), env-based configuration- For earlier changes, please refer to the repository commits.
