Repository navigation
feat: replace litellm with openrouter adapter - #193
Conversation
- Add a thin ADK OpenRouter adapter over the OpenAI SDK - Remove LiteLLM from runtime and dev dependencies - Map ADK messages, tools, images, reasoning, and usage - Record provider-reported OpenRouter costs in the ledger - Switch mem0 to OpenRouter's OpenAI-compatible provider - Update docs and tests for the new model boundary
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e18827614c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if mapped != types.FinishReason.STOP: | ||
| response.error_code = mapped | ||
| response.error_message = _finish_error_message(mapped) |
There was a problem hiding this comment.
Preserve valid text on MAX_TOKENS completions
When OpenRouter returns finish_reason="length" with a valid text prefix, this branch marks the response as an error. ADK propagates those fields to the event, and AdkRuntime._build_event_error raises before returning the collected content, so reaching a model or token limit becomes a total user-visible failure rather than a truncated answer carrying finish_reason=MAX_TOKENS. Keep the finish reason, but populate the error fields only when there is no usable content, as is already done for malformed truncated tool calls.
AGENTS.md reference: AGENTS.md:L175-L177
Useful? React with 👍 / 👎.
What
Replace LiteLLM with a thin OpenRouter adapter built on the OpenAI-compatible API.
Why
Blacki only needs OpenRouter chat completions, and LiteLLM is no longer required. Removing it eliminates the dependency and its compromised 1.107.0 release path from the runtime image and development lockfile.
How
OpenRouterLlm, an ADKBaseLlmbacked byAsyncOpenAIagainsthttps://openrouter.ai/api/v1.blacki_call_*IDs so ADK's replay-time stripping ofadk-*IDs cannot orphan tool results.openaiprovider.google-adk[eval]from dev dependencies because its evaluation extra pulls LiteLLM transitively, and add a lockfile regression test.Tests
uv run ruff formatuv run ruff checkuv run mypy .uv run pytest --cov=src— 2168 passed, 1 skipped, 100% coveragelitellmis absent fromuv.lockand fromsys.modulesafter importingblacki.agentBreaking Changes
adk evalnow requires explicitly installinggoogle-adk[eval]; that extra reintroduces LiteLLM transitively in the dev environment.MEM0_LLM_PROVIDER=litellmis no longer supported. It maps toopenaiwhenOPENROUTER_API_KEYis set and fails clearly otherwise.MEM0_LLM_MODELmust be an OpenRouterauthor/slugID whenOPENROUTER_API_KEYis set.Related Issues
None.