{"record":{"id":"965ccb615258b12b","repo":"BerriAI/litellm","slug":"api-base-not-set-set-one-via-completion-api-ba","errorCode":null,"errorMessage":"API Base not set. Set one via completion(..,api_base='your-api-url')","messagePattern":"API Base not set\\. Set one via completion\\(\\.\\.,api_base='your-api-url'\\)","errorType":"exception","errorClass":"OobaboogaError","httpStatus":404,"severity":"error","filePath":"litellm/llms/oobabooga/chat/oobabooga.py","lineNumber":43,"sourceCode":"    litellm_params: dict,\n    custom_prompt_dict={},\n    logger_fn=None,\n    default_max_tokens_to_sample=None,\n):\n    headers: Final = oobabooga_config.validate_environment(\n        api_key=api_key,\n        headers={},\n        model=model,\n        messages=messages,\n        optional_params=optional_params,\n        litellm_params=litellm_params,\n    )\n    if model.startswith((\"http://\", \"https://\")):\n        completion_url = model\n    elif api_base:\n        completion_url = api_base\n    else:\n        raise OobaboogaError(\n            status_code=404,\n            message=\"API Base not set. Set one via completion(..,api_base='your-api-url')\",\n        )\n    model = model\n\n    completion_url = completion_url + \"/v1/chat/completions\"\n    data: Final = oobabooga_config.transform_request(\n        model=model,\n        messages=messages,\n        optional_params=optional_params,\n        litellm_params=litellm_params,\n        headers=headers,\n    )\n    ## LOGGING\n\n    logging_obj.pre_call(\n        input=messages,\n        api_key=api_key,","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/oobabooga/chat/oobabooga.py#L25-L61","documentation":"oobabooga's text-generation-webui exposes an OpenAI-compatible API, but LiteLLM cannot guess its address. In the chat completion handler, if the model string is not an http(s) URL and no api_base was supplied (no explicit arg, no OOBABOOGA_API_BASE env var), this 404 OobaboogaError is raised.","triggerScenarios":"Calling `litellm.completion(model='oobabooga/<model>', messages=...)` without `api_base=` and without the OOBABOOGA_API_BASE environment variable set.","commonSituations":" forgetting api_base on a new machine, env var not exported in the shell/service that runs LiteLLM (common in Docker/systemd where env doesn't propagate), or renaming the env var after an upgrade.","solutions":["Pass the URL explicitly: `litellm.completion(model='oobabooga/<model>', api_base='http://127.0.0.1:5000', messages=...)`.","Or set the environment variable before starting your app: `export OOBABOOGA_API_BASE=http://127.0.0.1:5000`.","Or embed the URL in the model string: `model='http://127.0.0.1:5000'`.","Ensure text-generation-webui is running with its OpenAI extension (--api) and the port matches."],"exampleFix":"# before\nresp = litellm.completion(model=\"oobabooga/my-model\", messages=[...])\n\n# after\nresp = litellm.completion(model=\"oobabooga/my-model\", api_base=\"http://127.0.0.1:5000\", messages=[...])","handlingStrategy":"validation","validationCode":"import os\napi_base = api_base or os.environ.get(\"OOBABOOGA_API_BASE\")\nif not api_base:\n    raise ValueError(\"OOBABOOGA_API_BASE not set and api_base not provided\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set OOBABOOGA_API_BASE in the service environment (not just your shell)","Add a startup config check for all self-hosted provider URLs","Prefer explicit api_base args over env vars in code"],"tags":["oobabooga","api-base","configuration"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}