providers: add teamorouter; pick the first /models id when no default model

This commit is contained in:
WHC
2026-10-08 14:30:00 +08:00
parent 1772c26d43
commit 0226f417ff
6 changed files with 52 additions and 5 deletions
+16 -1
View File
@@ -20,7 +20,8 @@
static void usage(const char *argv0) {
fprintf(stderr,
"Usage: %s [options] (works in the current directory)\n"
" -P, --provider NAME minimax | deepseek | openai (last used)\n"
" -P, --provider NAME minimax | deepseek | openai | teamorouter\n"
" (last used)\n"
" -m, --model NAME model (last used for the provider)\n"
" -e, --effort LEVEL low | medium | high | max (last used)\n"
" -w, --workspace DIR project directory (default: current)\n"
@@ -539,6 +540,20 @@ int main(int argc, char **argv) {
curl_global_cleanup();
return 1;
}
/* Router presets have no fixed model: take the first one the API lists
* (the TUI does the same after its /models probe). */
if (!cfg.model[0] && cfg.headless) {
char ids[1][128], err[256] = "";
if (cst_llm_list_models(cfg.api_base, cfg.api_key, ids, 1, err,
sizeof(err)) > 0) {
snprintf(cfg.model, sizeof(cfg.model), "%s", ids[0]);
} else {
fprintf(stderr, "no model for %s: pass --model (%s)\n", cfg.provider,
err[0] ? err : "the API listed none");
curl_global_cleanup();
return 1;
}
}
fprintf(stderr,
"using %s model=%s effort=%s protocol=%s tools=%s max_steps=%d\n",