Hello everyone! Today I'm bringing you an ultra-practical tutorial - how to integrate domestic large models in OpenClaw to build a multi-model AI gateway that meets domestic compliance requirements.
Why Choose Domestic Large Models?
When deploying AI applications domestically, data security and compliance are the primary considerations. Domestic large models not only have fast response speeds and low costs, but more importantly, they can ensure data doesn't leave the country, fully complying with laws and regulations such as the "Network Security Law" and "Data Security Law".
Pre-Setup
Hardware Environment
- Tencent Cloud Lighthouse Server (recommended 2 cores 4GB+ configuration)
- Ubuntu 20.04 LTS system
- OpenClaw basic environment installed
Software Dependencies
- Node.js 18+
- Docker (optional, for containerized deployment)
- Latest version of OpenClaw
Domestic Large Model API Preparation
We need to prepare API keys for the following domestic large models:
- Tongyi Qianwen (Qwen): Obtain from Alibaba Cloud Bailian Platform
- Ernie Bot: Obtain from Baidu Intelligent Cloud Qianfan Large Model Platform
- Xunfei Spark: Obtain from Xunfei Open Platform
- GLM (Zhipu AI): Obtain from Zhipu AI Open Platform
⚠️ Important Reminder: All API keys must be securely stored through Tencent Cloud Key Management Service (KMS) or environment variables, never hardcode them in code!
Step 1: Configure OpenClaw Multi-Model Support
Add multi-model configuration in OpenClaw configuration file:
1 | models: |
Step 2: Implement Model Routing Logic
Create intelligent routing strategy to automatically select the most suitable model based on user needs:
1 | // model-router.js |
Step 3: Deploy to Tencent Cloud Lighthouse Server
Security Group Configuration
Ensure security group rules are correctly set:
- Open HTTP(80) and HTTPS(443) ports
- Restrict SSH(22) port to allow only specific IP access
- Close unnecessary ports
Environment Variables Setting
1 | # Set environment variables (through Tencent Cloud console or .env file) |
Start Service
1 | # Start OpenClaw service |
Step 4: Verify Multi-Model Functionality
Verify each model is working correctly through simple API tests:
1 | # Test Tongyi Qianwen |
Compliance Assurance Measures
Data Security
- All user data processed at Tencent Cloud domestic nodes
- Sensitive information automatically desensitized
- Chat history encrypted storage, retention period not exceeding 30 days
Content Review
- Integrated Tencent Cloud content security service
- Real-time filtering of illegal content
- Establish manual review backup mechanism
Real-Name Authentication
- Require users to complete mobile phone real-name verification
- Enterprise users must provide business license
- Establish user behavior log audit