[ci skip] Add Modal GLM-5 model to OpenClaw, fix streaming and download reliability

- Add modal provider (GLM-5-FP8) as primary model with non-streaming mode
  (GLM-5 uses non-standard reasoning_content field incompatible with streaming)
- Add curl --retry flags to init container downloads for reliability
- Fallback chain: GLM-5 → Gemini 2.5 Flash → Llama 3.3 70B
This commit is contained in:
Viktor Barzin 2026-02-19 23:17:08 +00:00
parent 71d6590939
commit 5df615c31d
3 changed files with 21 additions and 7 deletions

View file

@ -160,6 +160,7 @@ variable "openclaw_skill_secrets" { type = map(string) }
variable "gemini_api_key" { type = string }
variable "llama_api_key" { type = string }
variable "brave_api_key" { type = string }
variable "modal_api_key" { type = string }
variable "k8s_users" {
type = map(any)
@ -707,6 +708,7 @@ module "kubernetes_cluster" {
gemini_api_key = var.gemini_api_key
llama_api_key = var.llama_api_key
brave_api_key = var.brave_api_key
modal_api_key = var.modal_api_key
k8s_users = var.k8s_users
ssh_private_key = var.ssh_private_key

View file

@ -128,6 +128,7 @@ variable "health_postgresql_password" { type = string }
variable "health_secret_key" { type = string }
variable "openclaw_ssh_key" { type = string }
variable "openclaw_skill_secrets" { type = map(string) }
variable "modal_api_key" { type = string }
variable "gemini_api_key" { type = string }
variable "llama_api_key" { type = string }
variable "brave_api_key" { type = string }
@ -1175,6 +1176,7 @@ module "openclaw" {
gemini_api_key = var.gemini_api_key
llama_api_key = var.llama_api_key
brave_api_key = var.brave_api_key
modal_api_key = var.modal_api_key
tier = local.tiers.aux
depends_on = [null_resource.core_services]

View file

@ -4,6 +4,7 @@ variable "ssh_key" {}
variable "gemini_api_key" { type = string }
variable "llama_api_key" { type = string }
variable "brave_api_key" { type = string }
variable "modal_api_key" { type = string }
variable "skill_secrets" { type = map(string) }
resource "kubernetes_namespace" "openclaw" {
@ -81,13 +82,14 @@ resource "kubernetes_config_map" "openclaw_config" {
contextTokens = 1000000
bootstrapMaxChars = 30000
model = {
primary = "llama-as-openai/Llama-3.3-70B-Instruct"
fallbacks = ["gemini/gemini-2.5-flash", "llama-as-openai/Llama-4-Scout-17B-16E-Instruct-FP8"]
primary = "modal/zai-org/GLM-5-FP8"
fallbacks = ["gemini/gemini-2.5-flash", "llama-as-openai/Llama-3.3-70B-Instruct"]
}
models = {
"llama-as-openai/Llama-3.3-70B-Instruct" = {}
"gemini/gemini-2.5-flash" = {}
"llama-as-openai/Llama-4-Scout-17B-16E-Instruct-FP8" = {}
"modal/zai-org/GLM-5-FP8" = { streaming = false }
"gemini/gemini-2.5-flash" = {}
"llama-as-openai/Llama-3.3-70B-Instruct" = {}
"llama-as-openai/Llama-4-Scout-17B-16E-Instruct-FP8" = {}
}
}
}
@ -117,6 +119,14 @@ resource "kubernetes_config_map" "openclaw_config" {
models = {
mode = "merge"
providers = {
modal = {
baseUrl = "https://api.us-west-2.modal.direct/v1"
api = "openai-completions"
apiKey = var.modal_api_key
models = [
{ id = "zai-org/GLM-5-FP8", name = "GLM-5", reasoning = false, input = ["text"], contextWindow = 128000, maxTokens = 8192, cost = { input = 0, output = 0, cacheRead = 0, cacheWrite = 0 } },
]
}
gemini = {
baseUrl = "https://generativelanguage.googleapis.com/v1beta"
api = "google-generative-ai"
@ -207,11 +217,11 @@ resource "kubernetes_deployment" "openclaw" {
# --- Run downloads and clone in parallel ---
# kubectl
(curl -sL "https://dl.k8s.io/release/v1.34.2/bin/linux/amd64/kubectl" -o /tools/kubectl && chmod +x /tools/kubectl) &
(curl -sL --retry 3 --retry-delay 5 "https://dl.k8s.io/release/v1.34.2/bin/linux/amd64/kubectl" -o /tools/kubectl && chmod +x /tools/kubectl) &
PID_KUBECTL=$!
# terraform
(curl -sL "https://releases.hashicorp.com/terraform/1.14.5/terraform_1.14.5_linux_amd64.zip" -o /tmp/tf.zip && unzip -q /tmp/tf.zip -d /tools && chmod +x /tools/terraform && rm /tmp/tf.zip) &
(curl -sL --retry 3 --retry-delay 5 "https://releases.hashicorp.com/terraform/1.14.5/terraform_1.14.5_linux_amd64.zip" -o /tmp/tf.zip && unzip -q /tmp/tf.zip -d /tools && chmod +x /tools/terraform && rm /tmp/tf.zip) &
PID_TF=$!
# git-crypt (already installed via apk)