Skip to content

Commit 7e44108

Browse files
committed
Make ollama baseurl configurable from frontmatter too.
1 parent ba2ceda commit 7e44108

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

runprompt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CONFIG = {
4545

4646
# Config keys that support the cascade
4747
CONFIG_KEYS = {
48-
"model", "default_model", "tool_path", "base_url", "cache", "cache_dir",
48+
"model", "default_model", "tool_path", "base_url", "ollama_base_url", "cache", "cache_dir",
4949
"safe_yes", "verbose", "anthropic_api_key", "openai_api_key",
5050
"google_api_key", "openrouter_api_key", "chat",
5151
}
@@ -169,6 +169,8 @@ def init_config(args):
169169
args_dict["safe_yes"] = True
170170
if args.base_url:
171171
args_dict["base_url"] = args.base_url
172+
if args.ollama_base_url:
173+
args_dict["ollama_base_url"] = args.ollama_base_url
172174
if args.tool_path:
173175
args_dict["tool_path"] = args.tool_path
174176
if args.chat:
@@ -325,7 +327,9 @@ def main():
325327
log("Loaded %d shell tools: %s" % (len(shell_tools), list(shell_tools.keys())))
326328

327329
# Determine effective provider early for file reading
328-
base_url = get_conf("base_url") or get_base_url()
330+
base_url = (get_conf("base_url") or get_conf("ollama_base_url") or
331+
meta.get("base_url") or meta.get("ollama_base_url") or
332+
get_base_url())
329333
if base_url:
330334
effective_provider = "openai"
331335
else:
@@ -571,6 +575,8 @@ def parse_args(args):
571575
help="Save raw API response to file")
572576
parser.add_argument("--base-url", "--openai-base-url", metavar="URL",
573577
help="Use custom OpenAI-compatible endpoint")
578+
parser.add_argument("--ollama-base-url", metavar="URL",
579+
help="Use custom Ollama endpoint")
574580
parser.add_argument("--tool-path", action="append", default=[],
575581
metavar="PATH", help="Add directory to tool import path")
576582
parser.add_argument("--chat", action="store_true",

0 commit comments

Comments
 (0)