Skip to content

feat: add LiteLLM provider support for model name remapping#508

Open
AnishDe12020 wants to merge 1 commit intospacedriveapp:mainfrom
AnishDe12020:add-litellm-provider-support
Open

feat: add LiteLLM provider support for model name remapping#508
AnishDe12020 wants to merge 1 commit intospacedriveapp:mainfrom
AnishDe12020:add-litellm-provider-support

Conversation

@AnishDe12020
Copy link
Copy Markdown

closes #507

LiteLLM proxy expects plain model IDs without the provider prefix. This change strips the 'litellm/' prefix from model names before sending API requests, following the same pattern as zai-coding-plan.

Example:

  • Spacebot config: channel = "litellm/kimi-k2p5"
  • API request: {"model": "kimi-k2p5"}

Tested with dev instance:

  • 60+ successful API calls
  • All 6 agents generating profiles correctly
  • Fallback chains working as expected

Fixes: model routing with LiteLLM proxy gateway

LiteLLM proxy expects plain model IDs without the provider prefix.
This change strips the 'litellm/' prefix from model names before
sending API requests, following the same pattern as zai-coding-plan.

Example:
- Spacebot config: channel = "litellm/kimi-k2p5"
- API request: {"model": "kimi-k2p5"}

Tested with dev instance:
- 60+ successful API calls
- All 6 agents generating profiles correctly
- Fallback chains working as expected

Fixes: model routing with LiteLLM proxy gateway
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9ec9168a-fb02-4457-af77-ce083e42016f

📥 Commits

Reviewing files that changed from the base of the PR and between b7d5dd2 and 695e9ca.

📒 Files selected for processing (1)
  • src/llm/model.rs

Walkthrough

The remap_model_name_for_api function in src/llm/model.rs is enhanced to handle LiteLLM provider model ID remapping. When the provider is "litellm", the function strips the "litellm/" prefix from the model name if present and returns the plain model ID. Existing remapping behavior for other models remains unchanged.

Changes

Cohort / File(s) Summary
LiteLLM Provider Model Remapping
src/llm/model.rs
Added conditional logic to strip "litellm/" prefix from model names when provider is "litellm", while preserving existing remapping behavior for other cases.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • Issue #507: Directly addresses the same LiteLLM-specific model ID remapping implementation (stripping "litellm/" prefix) now present in this PR.

Possibly related PRs

  • PR #223: Previously introduced the remap_model_name_for_api helper function to handle "zai/" prefix remapping; this PR extends the same function with additional provider-specific logic for "litellm/".
  • PR #210: Also modifies model-name remapping logic in src/llm/model.rs, adding provider-specific remapping rules in a similar manner.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and concisely describes the main change: adding LiteLLM provider support for model name remapping.
Description check ✅ Passed The pull request description is directly related to the changeset, providing context about the LiteLLM prefix stripping functionality, example usage, and test results.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Add LiteLLM provider support

1 participant