diff --git a/install.sh b/install.sh index 0183f5c..102eaf4 100755 --- a/install.sh +++ b/install.sh @@ -768,17 +768,30 @@ if provider == "openai-compat" and (baseurl or apikey or model): print("WARN: models.providers.openai-compat unexpected type; skipped") else: if baseurl: - p["baseURL"] = baseurl - changed.append("models.providers.openai-compat.baseURL") + p["baseUrl"] = baseurl + p.pop("baseURL", None) + changed.append("models.providers.openai-compat.baseUrl") if apikey: p["apiKey"] = apikey changed.append("models.providers.openai-compat.apiKey") + p.setdefault("api", "openai-completions") + p.setdefault("timeoutSeconds", 300) if model: models = p.get("models") if not isinstance(models, list): models = [] - if model not in models: - models.append(model) + models = [m for m in models if isinstance(m, dict)] + if not any(m.get("id") == model for m in models): + models.append({ + "id": model, + "name": model, + "api": "openai-completions", + "reasoning": False, + "input": ["text"], + "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}, + "contextWindow": 128000, + "maxTokens": 8192, + }) p["models"] = models changed.append("models.providers.openai-compat.models") agents_root = node(cfg, "agents") @@ -796,6 +809,26 @@ elif provider == "anthropic" and (apikey or model): if apikey: p["apiKey"] = apikey changed.append("models.providers.anthropic.apiKey") + p.setdefault("api", "anthropic-messages") + p.setdefault("timeoutSeconds", 300) + if model: + ams = p.get("models") + if not isinstance(ams, list): + ams = [] + ams = [m for m in ams if isinstance(m, dict)] + if not any(m.get("id") == model for m in ams): + ams.append({ + "id": model, + "name": model, + "api": "anthropic-messages", + "reasoning": True, + "input": ["text", "image"], + "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}, + "contextWindow": 200000, + "maxTokens": 8192, + }) + p["models"] = ams + changed.append("models.providers.anthropic.models") if model: agents_root = node(cfg, "agents") adef = node(agents_root, "defaults") if agents_root is not None else None @@ -1058,7 +1091,7 @@ if provs: print(" 模型 Provider:") for name,p in provs.items(): if not isinstance(p,dict): continue - print(f" [{name}] baseURL={p.get('baseURL','(默认)')} key={mask(p.get('apiKey',''))}") + print(f" [{name}] baseUrl={p.get('baseUrl',p.get('baseURL','(默认)'))} key={mask(p.get('apiKey',''))}") ms=p.get("models") if isinstance(ms,list) and ms: print(f" models={', '.join(map(str,ms[:5]))}") else: