{"record":{"id":"5ad9b6a0faad2c08","repo":"harry0703/MoneyPrinterTurbo","slug":"llm-provider-base-url-is-not-set-please-set-it","errorCode":null,"errorMessage":"{llm_provider}: base_url is not set, please set it in the config.toml file.","messagePattern":"(.+?): base_url is not set, please set it in the config\\.toml file\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"app/services/llm.py","lineNumber":205,"sourceCode":"\n        extra_values = {\n            field.config_suffix: (\n                runtime_app_config.get(provider.config_key(field.config_suffix), \"\")\n                or field.default_value\n            )\n            for field in provider.extra_fields\n        }\n\n        if provider.requires_api_key and not api_key:\n            raise ValueError(\n                f\"{llm_provider}: api_key is not set, please set it in the config.toml file.\"\n            )\n        if provider.requires_model_name and not model_name:\n            raise ValueError(\n                f\"{llm_provider}: model_name is not set, please set it in the config.toml file.\"\n            )\n        if provider.requires_base_url and not base_url:\n            raise ValueError(\n                f\"{llm_provider}: base_url is not set, please set it in the config.toml file.\"\n            )\n\n        for field in provider.extra_fields:\n            if field.required and not extra_values[field.config_suffix]:\n                raise ValueError(\n                    f\"{llm_provider}: {field.config_suffix} is not set, \"\n                    \"please set it in the config.toml file.\"\n                )\n\n        if adapter == \"qwen\":\n            import dashscope\n            from dashscope.api_entities.dashscope_response import GenerationResponse\n\n            dashscope.api_key = api_key\n            response = dashscope.Generation.call(\n                model=model_name, messages=[{\"role\": \"user\", \"content\": prompt}]\n            )","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/harry0703/MoneyPrinterTurbo/blob/1f9f19c2021a68d04df228f33e9099a0c947f6f8/app/services/llm.py#L187-L223","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# config.toml before\n[openai-compat]\napi_key = \"sk-local\"  # base_url missing -> raises\n\n# config.toml after\n[openai-compat]\napi_key = \"sk-local\"\nbase_url = \"http://127.0.0.1:8000/v1\"","handlingStrategy":"validation","validationCode":"base_url = cfg.get(provider.config_key(\"base_url\"), \"\")\nif provider.requires_base_url and not base_url:\n    raise ConfigError(f\"{provider.config_key('base_url')} is empty\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["For self-hosted providers, always configure base_url including the /v1 suffix","Verify the endpoint with curl from the worker environment before starting generation"],"tags":["configuration","base-url","llm","openai-compatible"],"backgroundTag":null,"analyzedSha":"1f9f19c2021a68d04df228f33e9099a0c947f6f8","analyzedAt":"2026-08-14T19:41:05.568Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}