Conversation
🦋 Changeset detectedLatest commit: 62759e2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks for the contribution! What happens next:
|
|
I'm concerned about the supply-chain boundary of this LiteLLM integration. The upstream incident report confirms compromised PyPI releases 1.82.7/1.82.8 in March 2026; those releases were removed. This reviewed change uses a proxy-compatible integration; it does not itself add a Python LiteLLM package installation. The deployment questions are who operates the proxy, which verified server version runs there, and whether credentials remain isolated from other providers. Please document those trust boundaries for users. This is one of 49 observed LiteLLM integration PRs from the same account, whose author acknowledged the cross-project effort. The pattern prompted this review; it does not establish malicious intent or connect the author to the incident. The consolidated questions and corrections are in YouDub #130; this PR's review snapshot preserves the revision and scope. |
Summary
openrouter,nim, andcustomOpenAI-compatible providers.litellm/prefix (e.g.litellm/anthropic/claude-sonnet-4-5,litellm/gpt-4o, or any alias configured on your proxy) to route through a LiteLLM proxy, which fronts 100+ providers (OpenAI, Anthropic, Bedrock, Vertex, Azure, Gemini, Groq, and more) behind one OpenAI-compatible endpoint.nimprovider pattern exactly (a namedcreateOpenAICompatibledefault instance + a configurable case), so it is additive and low-risk.Motivation
Teams that already run a LiteLLM proxy for centralized key management, spend tracking, routing, and rate limiting currently have to use the generic
custom/provider and hand-setproviderOptions.baseURLon every model. That works, but it is undiscoverable and easy to get wrong. This mirrors why the repo already ships namednimandopenrouterconveniences on top of the genericcustompath: a first-classlitellm/provider gives a documented default base URL (http://localhost:4000/v1, LiteLLM's standard proxy port), env-based configuration, and UI discoverability.Changes
packages/agents-core/src/utils/model-factory.ts— newlitellmDefaultprovider instance;litellmcase increateProvider(custom-config path) and in the default-instance switch;litellmadded toBUILT_IN_PROVIDERS; provider-enumeration error messages updated.packages/agents-core/src/__tests__/utils/model-factory.test.ts—parseModelStringcoverage forlitellm/.agents-api/src/__tests__/run/agents/ModelFactory.test.ts— parse + create coverage (default and custom-base-URL).agents-manage-ui/src/components/agent/sidepane/nodes/model-selector.tsx— LiteLLM entry in the model picker (prefix display, selector item, labels/placeholder, prefix handling).agents-manage-ui/src/features/agent/state/use-agent-store.ts— doc comment update.agents-docs/content/typescript-sdk/models.mdx— provider table row + configuration section..changeset/add-litellm-provider.md— patch changeset for@inkeep/agents-coreand@inkeep/agents-manage-ui.Configuration
The base URL resolves from
providerOptions.baseURL, thenLITELLM_API_BASE, thenhttp://localhost:4000/v1. SetLITELLM_API_KEYto your proxy's virtual/master key; it is sent as a bearer token only when present (so keyless local proxies work too).Tests
1. Unit tests
agents-core(packages/agents-core):agents-api:2. Format + lint (Biome) — clean on all changed files:
3. Typecheck —
@inkeep/agents-coreand@inkeep/agents-manage-uiboth passtsc --noEmit.4. Live end-to-end through a real LiteLLM proxy
A LiteLLM proxy was started with an alias
e2e-gptrouted to a live Azure AI Foundry deployment, then driven throughModelFactory.createModel('litellm/e2e-gpt')using the AI SDK'sgenerateTextandstreamText:This exercises the full chain:
ModelFactory→createOpenAICompatible(the newlitellmprovider) → LiteLLM proxy → upstream provider → response parsed back through the AI SDK, for both non-streaming and streaming.Risk / compatibility
nimnamed OpenAI-compatible provider.@ai-sdk/openai-compatibleis already used bynim/custom).Example usage