Anurag commited on
Commit
a4e1e4c
Β·
unverified Β·
2 Parent(s): ea03885625d1a2

improve selective traversal, and provider model updates

Browse files

Improve sync reliability: timeouts, temp-path cleanup, selective traversal, and provider model updates

Files changed (3) hide show
  1. .env.example +7 -2
  2. env-builder.js +13 -5
  3. start.sh +33 -19
.env.example CHANGED
@@ -105,6 +105,9 @@ LLM_API_KEY=your_api_key_here
105
  #
106
  # NVIDIA (NVIDIA_API_KEY):
107
  # - nvidia/nemotron-3-super-120b-a12b
 
 
 
108
  # - nvidia/stepfun-ai/step-3.7-flash
109
  #
110
  # Groq (GROQ_API_KEY):
@@ -273,8 +276,10 @@ LLM_API_KEY_FALLBACK_ENABLED=true
273
  #
274
  # Optional: explicitly pin model lists per provider for Control UI visibility
275
  # when provider keys are configured.
276
- # Format: comma-separated model IDs
277
- # NVIDIA_MODELS=meta/llama-3.1-70b-instruct,nvidia/llama-3.1-nemotron-70b-instruct,nvidia/stepfun-ai/step-3.7-flash
 
 
278
  # OPENAI_MODELS=gpt-4o-mini,gpt-4.1
279
  # GROQ_MODELS=llama-3.3-70b-versatile,deepseek-r1-distill-llama-70b
280
  # independently and in parallel.
 
105
  #
106
  # NVIDIA (NVIDIA_API_KEY):
107
  # - nvidia/nemotron-3-super-120b-a12b
108
+ # - nvidia/deepseek-ai/deepseek-v4-flash
109
+ # - nvidia/qwen/qwen3-coder-480b-a35b-instruct
110
+ # - nvidia/moonshotai/kimi-k2.6
111
  # - nvidia/stepfun-ai/step-3.7-flash
112
  #
113
  # Groq (GROQ_API_KEY):
 
276
  #
277
  # Optional: explicitly pin model lists per provider for Control UI visibility
278
  # when provider keys are configured.
279
+ # Format: comma-separated provider-local model IDs. For NVIDIA, keep NVIDIA-owned
280
+ # API IDs as nvidia/... and third-party hosted IDs as their API owner/id; do not
281
+ # add an extra outer OpenClaw provider prefix in NVIDIA_MODELS.
282
+ # NVIDIA_MODELS=nvidia/nemotron-3-super-120b-a12b,deepseek-ai/deepseek-v4-flash,qwen/qwen3-coder-480b-a35b-instruct,moonshotai/kimi-k2.6,stepfun-ai/step-3.7-flash
283
  # OPENAI_MODELS=gpt-4o-mini,gpt-4.1
284
  # GROQ_MODELS=llama-3.3-70b-versatile,deepseek-r1-distill-llama-70b
285
  # independently and in parallel.
env-builder.js CHANGED
@@ -141,8 +141,12 @@ const MODEL_CATALOGS = {
141
  ],
142
  "NVIDIA": [
143
  "nvidia/nemotron-3-super-120b-a12b",
144
- "nvidia/nemotron-4-340b-instruct",
145
- "nvidia/llama-3.1-nemotron-70b-instruct",
 
 
 
 
146
  "nvidia/stepfun-ai/step-3.7-flash"
147
  ],
148
  "KiloCode": [
@@ -376,9 +380,13 @@ const MODEL_CATALOGS = {
376
  ],
377
  "NVIDIA_MODELS": [
378
  "nvidia/nemotron-3-super-120b-a12b",
379
- "nvidia/nemotron-4-340b-instruct",
380
- "nvidia/llama-3.1-nemotron-70b-instruct",
381
- "nvidia/stepfun-ai/step-3.7-flash"
 
 
 
 
382
  ],
383
  "KILOCODE_MODELS": [
384
  "kilocode/anthropic/claude-opus-4.7",
 
141
  ],
142
  "NVIDIA": [
143
  "nvidia/nemotron-3-super-120b-a12b",
144
+ "nvidia/deepseek-ai/deepseek-v4-flash",
145
+ "nvidia/qwen/qwen3-coder-480b-a35b-instruct",
146
+ "nvidia/moonshotai/kimi-k2.6",
147
+ "nvidia/minimaxai/minimax-m2.7",
148
+ "nvidia/openai/gpt-oss-120b",
149
+ "nvidia/z-ai/glm-5.1",
150
  "nvidia/stepfun-ai/step-3.7-flash"
151
  ],
152
  "KiloCode": [
 
380
  ],
381
  "NVIDIA_MODELS": [
382
  "nvidia/nemotron-3-super-120b-a12b",
383
+ "deepseek-ai/deepseek-v4-flash",
384
+ "qwen/qwen3-coder-480b-a35b-instruct",
385
+ "moonshotai/kimi-k2.6",
386
+ "minimaxai/minimax-m2.7",
387
+ "openai/gpt-oss-120b",
388
+ "z-ai/glm-5.1",
389
+ "stepfun-ai/step-3.7-flash"
390
  ],
391
  "KILOCODE_MODELS": [
392
  "kilocode/anthropic/claude-opus-4.7",
start.sh CHANGED
@@ -357,12 +357,12 @@ case "$LLM_PROVIDER" in
357
  mistral-*|codestral-*|devstral-*|voxtral-*)
358
  export MISTRAL_API_KEY="$LLM_API_KEY"
359
  echo "Note: bare Mistral model '$LLM_MODEL' detected; mapped LLM_API_KEY β†’ MISTRAL_API_KEY. Use 'mistral/${LLM_MODEL}' prefix to be explicit." ;;
360
- moonshotai|meta-llama|deepseek-ai|MiniMaxAI|minimax-ai|Qwen|zai-org|mistralai|google)
361
  echo "Warning: LLM_MODEL='$LLM_MODEL' uses sub-provider prefix '$LLM_PROVIDER'. This is a router-namespaced model (Together/OpenRouter). Mapping LLM_API_KEY β†’ TOGETHER_API_KEY. If using OpenRouter, also set OPENROUTER_API_KEY as a separate secret."
362
  export TOGETHER_API_KEY="${TOGETHER_API_KEY:-$LLM_API_KEY}" ;;
363
  # ── Fallback: Anthropic (default) ──
364
  *)
365
- echo "Warning: Unknown provider prefix '$LLM_PROVIDER' in LLM_MODEL='$LLM_MODEL'. Defaulting to ANTHROPIC_API_KEY. If using a router-namespaced model (e.g. moonshotai/Kimi-K2.6), set TOGETHER_API_KEY or OPENROUTER_API_KEY as a separate secret."
366
  export ANTHROPIC_API_KEY="$LLM_API_KEY"
367
  ;;
368
  esac
@@ -657,7 +657,7 @@ _DEFAULT_XAI_MODELS="xai/grok-4.20,xai/grok-4.3,xai/grok-4.1,xai/grok-latest,xai
657
  _DEFAULT_COHERE_MODELS="cohere/command-a,cohere/command-a-03-2025,cohere/command-a-reasoning-08-2025,cohere/command-r-plus-08-2024"
658
  _DEFAULT_TOGETHER_MODELS="together/moonshotai/Kimi-K2.6,together/deepseek-ai/DeepSeek-V4-Pro,together/Qwen/Qwen3-235B-A22B-Instruct-2507-tput,together/meta-llama/Llama-3.3-70B-Instruct-Turbo"
659
  _DEFAULT_CEREBRAS_MODELS="cerebras/zai-glm-4.7,cerebras/gpt-oss-120b,cerebras/deepseek-r1,cerebras/qwen3-32b"
660
- _DEFAULT_NVIDIA_MODELS="nvidia/nemotron-3-super-120b-a12b,nvidia/nemotron-4-340b-instruct,nvidia/llama-3.1-nemotron-70b-instruct,nvidia/stepfun-ai/step-3.7-flash"
661
  _DEFAULT_KILOCODE_MODELS="kilocode/kilo/auto,kilocode/anthropic/claude-opus-4.7,kilocode/openai/gpt-5.4,kilocode/google/gemini-2.5-pro"
662
  _DEFAULT_MOONSHOT_MODELS="moonshot/kimi-k2.6,moonshot/kimi-k2.6-thinking,moonshot/kimi-k2-thinking"
663
  _DEFAULT_MINIMAX_MODELS="minimax/MiniMax-M2.7,minimax/minimax-m1.5"
@@ -725,26 +725,40 @@ inject_provider_models_from_env() {
725
  | awk 'NF' \
726
  | jq -R . \
727
  | jq -s --arg provider "$provider" '
728
- map(
729
- if contains("/") then
730
- # Fix cross-prefix: strip only the first "/" segment (the foreign provider
731
- # prefix) and reapply the correct one. Using `last` was a bug for 3-part IDs:
732
- # e.g. "openai/gpt-oss-120b" injected into "groq" would become
733
- # "groq/gpt-oss-120b" instead of "groq/openai/gpt-oss-120b".
734
- # Examples:
735
- # "google/gemini-2.5-pro" β†’ "google-vertex/gemini-2.5-pro"
736
- # "openai/gpt-oss-120b" β†’ "groq/openai/gpt-oss-120b"
737
- # "moonshotai/kimi-k2.6" β†’ "nvidia/moonshotai/kimi-k2.6"
738
- if startswith($provider + "/") then .
739
- else ($provider + "/" + (split("/") | .[1:] | join("/")))
 
 
 
 
 
 
 
 
 
 
 
 
 
740
  end
 
 
741
  else
742
- ($provider + "/" + .)
743
- end
744
- )
745
  | map({id: ., name: .})
746
  | unique_by(.id)')
747
-
748
  # Build provider patch: always inject models; conditionally inject apiKey, baseUrl, api.
749
  # Existing saved config wins on merge (see config-patch jq below), so this only fills
750
  # in missing fields β€” it never overwrites what the user already configured manually.
 
357
  mistral-*|codestral-*|devstral-*|voxtral-*)
358
  export MISTRAL_API_KEY="$LLM_API_KEY"
359
  echo "Note: bare Mistral model '$LLM_MODEL' detected; mapped LLM_API_KEY β†’ MISTRAL_API_KEY. Use 'mistral/${LLM_MODEL}' prefix to be explicit." ;;
360
+ moonshotai|meta-llama|deepseek-ai|minimaxai|MiniMaxAI|minimax-ai|Qwen|zai-org|mistralai|google)
361
  echo "Warning: LLM_MODEL='$LLM_MODEL' uses sub-provider prefix '$LLM_PROVIDER'. This is a router-namespaced model (Together/OpenRouter). Mapping LLM_API_KEY β†’ TOGETHER_API_KEY. If using OpenRouter, also set OPENROUTER_API_KEY as a separate secret."
362
  export TOGETHER_API_KEY="${TOGETHER_API_KEY:-$LLM_API_KEY}" ;;
363
  # ── Fallback: Anthropic (default) ──
364
  *)
365
+ echo "Warning: Unknown provider prefix '$LLM_PROVIDER' in LLM_MODEL='$LLM_MODEL'. Defaulting to ANTHROPIC_API_KEY. If using a router-namespaced model (e.g. moonshotai/kimi-k2.6), set TOGETHER_API_KEY or OPENROUTER_API_KEY as a separate secret."
366
  export ANTHROPIC_API_KEY="$LLM_API_KEY"
367
  ;;
368
  esac
 
657
  _DEFAULT_COHERE_MODELS="cohere/command-a,cohere/command-a-03-2025,cohere/command-a-reasoning-08-2025,cohere/command-r-plus-08-2024"
658
  _DEFAULT_TOGETHER_MODELS="together/moonshotai/Kimi-K2.6,together/deepseek-ai/DeepSeek-V4-Pro,together/Qwen/Qwen3-235B-A22B-Instruct-2507-tput,together/meta-llama/Llama-3.3-70B-Instruct-Turbo"
659
  _DEFAULT_CEREBRAS_MODELS="cerebras/zai-glm-4.7,cerebras/gpt-oss-120b,cerebras/deepseek-r1,cerebras/qwen3-32b"
660
+ _DEFAULT_NVIDIA_MODELS="nvidia/nemotron-3-super-120b-a12b,deepseek-ai/deepseek-v4-flash,qwen/qwen3-coder-480b-a35b-instruct,moonshotai/kimi-k2.6,minimaxai/minimax-m2.7,openai/gpt-oss-120b,z-ai/glm-5.1,stepfun-ai/step-3.7-flash"
661
  _DEFAULT_KILOCODE_MODELS="kilocode/kilo/auto,kilocode/anthropic/claude-opus-4.7,kilocode/openai/gpt-5.4,kilocode/google/gemini-2.5-pro"
662
  _DEFAULT_MOONSHOT_MODELS="moonshot/kimi-k2.6,moonshot/kimi-k2.6-thinking,moonshot/kimi-k2-thinking"
663
  _DEFAULT_MINIMAX_MODELS="minimax/MiniMax-M2.7,minimax/minimax-m1.5"
 
725
  | awk 'NF' \
726
  | jq -R . \
727
  | jq -s --arg provider "$provider" '
728
+ def strip_outer_provider:
729
+ (split("/") | .[1:] | join("/"));
730
+ def normalize_provider_model:
731
+ # OpenClaw stores provider-local model ids inside
732
+ # models.providers.<provider>.models[].id. The user-facing model ref
733
+ # is composed later as <provider>/<id>. Most providers use ids like
734
+ # "gpt-5.4", so "openai/gpt-5.4" becomes "gpt-5.4" here.
735
+ # NVIDIA is special because some valid NVIDIA API ids themselves
736
+ # start with "nvidia/" (for example nvidia/nemotron-...). Keep those
737
+ # single-prefix ids intact, but strip an outer OpenClaw provider prefix
738
+ # from full refs like "nvidia/deepseek-ai/..." or legacy
739
+ # "nvidia/nvidia/nemotron-..." so the provider sends the exact NVIDIA
740
+ # documented model id to integrate.api.nvidia.com.
741
+ if $provider == "nvidia" then
742
+ if startswith("nvidia/nvidia/")
743
+ or startswith("nvidia/deepseek-ai/")
744
+ or startswith("nvidia/qwen/")
745
+ or startswith("nvidia/moonshotai/")
746
+ or startswith("nvidia/minimaxai/")
747
+ or startswith("nvidia/openai/")
748
+ or startswith("nvidia/z-ai/")
749
+ or startswith("nvidia/stepfun-ai/") then
750
+ strip_outer_provider
751
+ else
752
+ .
753
  end
754
+ elif startswith($provider + "/") then
755
+ strip_outer_provider
756
  else
757
+ .
758
+ end;
759
+ map(normalize_provider_model)
760
  | map({id: ., name: .})
761
  | unique_by(.id)')
 
762
  # Build provider patch: always inject models; conditionally inject apiKey, baseUrl, api.
763
  # Existing saved config wins on merge (see config-patch jq below), so this only fills
764
  # in missing fields β€” it never overwrites what the user already configured manually.