Skip to content

Port upstream 0.64.0: LiteLLM identity, team/user budgets, private-network HTTP - #702

Draft
Finesssee wants to merge 1 commit into
port/upstream-0.64.0from
port/micro-0.64.0-litellm-identity-budgets
Draft

Finesssee wants to merge 1 commit into
port/upstream-0.64.0from
port/micro-0.64.0-litellm-identity-budgets

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Found by the 0.60.4-0.69.0 port gap audit (gap G6, 0.64.0).

Summary

LiteLLM now reads the key-bound identity and budgets the way upstream 0.64.0 does, instead of key/info only:

  • GET /key/info supplies user_id / team_id. If both are absent the fetch fails with "LiteLLM key info did not include a user_id or team_id."
  • User-bound keys call GET /user/info?user_id=; the returned user ID must equal the key's. Personal spend and budget are the primary row. The team whose team_id matches the key (from the teams list) is a separate "Team budget" row. Account display uses the key-bound identity: user_email, then user_alias, then metadata.preferred_username; organization is the matching team alias.
  • Team-only keys call GET /team/info?team_id=; the returned team ID must equal the key's. The team budget is the sole usage row.
  • Cost snapshot: "Personal/Team budget" (spend and limit) or "Personal/Team spend" when no budget; budget reset dates and key expires are carried as reset / subscription expiry.
  • Base URL policy is now "https or private-network http" (loopback, RFC 1918, link-local, IPv6 unique-local, .local), no embedded credentials, no encoded host delimiters. The same validator backs the saved base-URL setting in Preferences.
  • Base URL subpaths are preserved (https://host/litellm/v1 -> https://host/litellm/key/info); the old Url::join would have dropped the last path segment.

Upstream reference

  • v0.64.0: "Improved: LiteLLM via plugin, preserving private-network proxies, key-bound identities, team budgets, spend-only accounts".
  • Tag-pinned files (read only, GET at v0.64.0): Sources/CodexBarCore/Resources/Plugins/litellm.ts, docs/litellm.md.

Ported / Deferred

Ported: everything above, with upstream's ID cross-checks, "missing team_id" / invalid-type parse failures, tolerant date parsing, and the info envelope requirement on /key/info.

Deferred or different:

  • Spend-only fallback on 401/403/404 management routes: tracked by Port upstream 0.65.0: LiteLLM spend-report fallback #630 (0.65.0), not repeated here. This PR keeps the existing 401/403 -> "authentication required" mapping.
  • Model activity: Port upstream 0.67.0: opt-in LiteLLM model activity and Claude workspace spend #664.
  • The audit pointed at the private-network validator from Port upstream 0.66.0: llmman provider #650; it is not in this base (only the blocking is_blocked_host in provider_workspace.rs, which is the opposite policy and is still used by Zed). The LiteLLM policy lives in providers/litellm/endpoint.rs so it stays provider-local; if Port upstream 0.66.0: llmman provider #650 lands first the two can be unified.
  • Upstream makes the team budget the automatic menu bar metric and adds native menu/CLI detail formatting; those surface changes are not ported (the team budget is shown as an extra row).
  • Upstream's error body snippet (first 500 chars) is not surfaced; errors show route and status only.
  • Query strings on the base URL are kept for key/info (as upstream's suffix) and replaced for user/info / team/info.

Validation

All with cargo +1.98.0 via the E-core wrapper:

  • cargo fmt --all: clean
  • cargo clippy --workspace --all-targets -- -D warnings: pass (both manifests)
  • cargo test -p codexbar litellm: 18 passed (incl. settings::provider_workspace LiteLLM policy test)
  • cargo test -p codexbar (full): 2174 passed, 0 failed, 1 ignored
  • Frontend untouched; pnpm test not run. The Tauri crate is unchanged.

Affected areas

  • Provider: LiteLLM (rust/src/providers/litellm/: mod.rs, new endpoint.rs, info.rs, tests.rs)
  • Settings: LiteLLM base-URL validation (rust/src/settings/provider_workspace.rs)
  • Locale: en-US LiteLlmBaseUrlHelp text (other locales unchanged)
  • UI-affecting (provider rows, account display, base-URL help); draft until proof is captured

UI proof

Pending: coordinator will capture CUA proof on a fresh build.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

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.

1 participant