BerriAI/litellm · error · OobaboogaError
API Base not set. Set one via completion(..,api_base='your-a
Error message
API Base not set. Set one via completion(..,api_base='your-api-url')
What it means
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.
Source
Thrown at litellm/llms/oobabooga/chat/oobabooga.py:43
litellm_params: dict,
custom_prompt_dict={},
logger_fn=None,
default_max_tokens_to_sample=None,
):
headers: Final = oobabooga_config.validate_environment(
api_key=api_key,
headers={},
model=model,
messages=messages,
optional_params=optional_params,
litellm_params=litellm_params,
)
if model.startswith(("http://", "https://")):
completion_url = model
elif api_base:
completion_url = api_base
else:
raise OobaboogaError(
status_code=404,
message="API Base not set. Set one via completion(..,api_base='your-api-url')",
)
model = model
completion_url = completion_url + "/v1/chat/completions"
data: Final = oobabooga_config.transform_request(
model=model,
messages=messages,
optional_params=optional_params,
litellm_params=litellm_params,
headers=headers,
)
## LOGGING
logging_obj.pre_call(
input=messages,
api_key=api_key,View on GitHub (pinned to 6c2dcb801b)
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.
Example fix
# before resp = litellm.completion(model="oobabooga/my-model", messages=[...]) # after resp = litellm.completion(model="oobabooga/my-model", api_base="http://127.0.0.1:5000", messages=[...])
Defensive patterns
Strategy: validation
Validate before calling
import os
api_base = api_base or os.environ.get("OOBABOOGA_API_BASE")
if not api_base:
raise ValueError("OOBABOOGA_API_BASE not set and api_base not provided") Prevention
- 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
When it happens
Trigger: Calling `litellm.completion(model='oobabooga/<model>', messages=...)` without `api_base=` and without the OOBABOOGA_API_BASE environment variable set.
Common situations: 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.
Related errors
- API base is required for OpenAI image variations
- API base is required for Topaz image variations
- api_base is required for Azure AI Studio. Please set the api
- Azure api base not found
- api_base is required for Azure OpenAI calls
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/965ccb615258b12b.
Report an issue: GitHub.