Quy trình tích hợp và sử dụng LLM cho các Service
1. Tạo Virtual Key
Chuẩn bị các thông tin:
bundleIdLLM API KeyProviderModel(optional)
Tạo Virtual Key và associate với bundleId.
2. Whitelist Bundle ID
Có 2 cách sử dụng LLM:
2.1 Sử dụng LLM Node Workflow
Cập nhật config.yaml trong BE-AI-Wrapper để whitelist bundleId.
- module: llm
baseUrl: http://localhost:3000
targetService: llm-litellm
timeout: 60000
whitelist:
- bundleId: dont.ask.me.ailabs
apiKey: sk-ahZknGwTovl5Ef8D6UWzdg
endpoints:
- endpoint: /api/v5/llm/generate
method: POST
Sau khi cập nhật:
- Deploy hoặc reload BE-AI-Wrapper để cấu hình whitelist có hiệu lực.
- Sử dụng LLM Node Workflow như bình thường.
2.2 Chatbot / BE Business
Không cần đi qua Workflow.
Sử dụng các thông tin sau để gọi trực tiếp đến AI-Backend-LLM-Gateway:
- Endpoint
- Model
- Virtual Key
Note
Cách tạo Virtual Key
Qua Admin UI
-
Vào sidebar AI GATEWAY → chọn tab Virtual Keys.
-
Nhấn + Create New Key.
-
Điền các thông tin:
Key Ownership
- Owned By: Service Account / User / Agent
- Team (nếu có)
Key Details
-
Key Name
Nên đặt theo convention để dễ nhận diện bundleId.
Ví dụ:
bundleid-<service-name> -
Models
Chọn model/provider được cấp hoặc All Team Models.
Optional Settings
Mở phần Optional Settings → Metadata và nhập:
{
"bundleId": "<actual-bundleId>"
}
bundleIdđược lưu trongmetadatavì hiện tại hệ thống chưa có fieldbundleIdriêng.
Có thể cấu hình thêm nếu cần:
- Max Budget
- TPM Limit
- RPM Limit
- Nhấn Create.
Lưu ý: Virtual Key chỉ hiển thị một lần sau khi tạo. Hãy copy và lưu lại ngay.