harry0703/MoneyPrinterTurbo · error · ValueError
{llm_provider}: base_url is not set, please set it in the co
Error message
{llm_provider}: base_url is not set, please set it in the config.toml file. What it means
Base-URL guard in _generate_response: the provider declares requires_base_url (typical for OpenAI-compatible custom endpoints like azure or self-hosted gateways) but the resolved base_url is empty. The SDK would otherwise default to api.openai.com and send the request (and the key) to the wrong service.
Source
Thrown at app/services/llm.py:205
extra_values = {
field.config_suffix: (
runtime_app_config.get(provider.config_key(field.config_suffix), "")
or field.default_value
)
for field in provider.extra_fields
}
if provider.requires_api_key and not api_key:
raise ValueError(
f"{llm_provider}: api_key is not set, please set it in the config.toml file."
)
if provider.requires_model_name and not model_name:
raise ValueError(
f"{llm_provider}: model_name is not set, please set it in the config.toml file."
)
if provider.requires_base_url and not base_url:
raise ValueError(
f"{llm_provider}: base_url is not set, please set it in the config.toml file."
)
for field in provider.extra_fields:
if field.required and not extra_values[field.config_suffix]:
raise ValueError(
f"{llm_provider}: {field.config_suffix} is not set, "
"please set it in the config.toml file."
)
if adapter == "qwen":
import dashscope
from dashscope.api_entities.dashscope_response import GenerationResponse
dashscope.api_key = api_key
response = dashscope.Generation.call(
model=model_name, messages=[{"role": "user", "content": prompt}]
)View on GitHub (pinned to 1f9f19c202)
Solutions
- Set <provider>.base_url in config.toml to the endpoint root (e.g. http://localhost:11434/v1) including the /v1 suffix the SDK expects
- Verify reachability of the URL from the worker process (curl) to confirm the right host/port
- Keep credentials out of the URL where possible; the code sanitizes userinfo in errors, but not sending them at all is safer
- Restart/reload the service so the new config takes effect for new tasks
Example fix
# config.toml before [openai-compat] api_key = "sk-local" # base_url missing -> raises # config.toml after [openai-compat] api_key = "sk-local" base_url = "http://127.0.0.1:8000/v1"
Defensive patterns
Strategy: validation
Validate before calling
base_url = cfg.get(provider.config_key("base_url"), "")
if provider.requires_base_url and not base_url:
raise ConfigError(f"{provider.config_key('base_url')} is empty") Prevention
- For self-hosted providers, always configure base_url including the /v1 suffix
- Verify the endpoint with curl from the worker environment before starting generation
When it happens
Trigger: Providers whose registry entry sets requires_base_url=true where <provider>.base_url is missing or empty in the effective config — e.g. configuring an azure/openai-compatible provider without its endpoint URL.
Common situations: Switching llm_provider to a self-hosted provider (one-api, vllm, ollama-openai bridges) without setting base_url, TOML section renamed so the key is ignored, or the field filled only in the WebUI while the worker reads config.toml.
Related errors
- [{llm_provider}] returned empty choices
- [{llm_provider}] returned empty message
- {llm_provider}: unsupported llm provider
- {llm_provider}: api_key is not set, please set it in the con
- {llm_provider}: model_name is not set, please set it in the
AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14).
Data as JSON: /api/errors/5ad9b6a0faad2c08.
Report an issue: GitHub.