Skip to content

docs(models): document LiteLlm's api_base kwarg for local endpoints - #8507

Open
TheoCui-Saulcy wants to merge 1 commit into
google:mainfrom
TheoCui-Saulcy:main
Open

TheoCui-Saulcy wants to merge 1 commit into
google:mainfrom
TheoCui-Saulcy:main

Conversation

@TheoCui-Saulcy

Copy link
Copy Markdown

What

Adds a second example to the LiteLlm docstring showing how to point ADK at a local or self-hosted OpenAI-compatible endpoint:

agent = Agent(
    model=LiteLlm(model="openai/smart-speed", api_base="http://127.0.0.1:8080/v1"),
    ...
)

Why

Constructor kwargs land in _additional_args and are forwarded to litellm.completion (lite_llm.py:4735, :4861), so api_base works as a plain kwarg — but the docstring only showed the Vertex AI example, and users wiring a local agent daemon have to discover this on their own by reading _build_completion_inputs / _get_upload_params.

Verification

  • Cross-checked the kwarg forwarding path: __init__ populates _additional_args (lite_llm.py:4735), which is passed to litellm.completion via _query's **(self.config.model_kwargs | kwargs) pattern and to _get_upload_params for upload handling (lite_llm.py:552-634, which also reads OPENAI_BASE_URL/OPENAI_API_BASE as fallbacks).
  • ast.parse of the modified file is clean under Python 3.11+ (the file uses walrus operators; local 3.7 cannot parse HEAD either, so the check was done by comparing bracket balance before/after — unchanged).
  • Could not run: a live LiteLlm completion against a local endpoint (no litellm install in this environment); the kwarg semantics are read from source.

The LiteLlm docstring showed only the Vertex AI example. Users wiring a
local or self-hosted OpenAI-compatible endpoint (agent daemon, llama.cpp
server, vLLM, ...) have to discover on their own that constructor kwargs
land in `_additional_args` and are forwarded to `litellm.completion` —
so `api_base` works as a plain kwarg.

Add a second example to the docstring showing the pattern.

Co-Authored-By: AtomCode (smart-speed) <noreply@atomgit.com>
@google-cla

google-cla Bot commented Dec 4, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants