feat: support LiteLLM gateway - #40
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @prodmanpd on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
|
@prodmanpd is attempting to deploy a commit to the E2B Team on Vercel. A member of the Team first needs to authorize it. |
|
We require contributors to sign our Contributor License Agreement, and we don't have @prodmanpd on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
f4739cb to
c36d184
Compare
|
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
Adds an optional LiteLLM gateway path for Surf's existing computer-use workflow. Deployments can route the OpenAI Responses API requests through a self-hosted or managed LiteLLM proxy while preserving the current OpenAI configuration as the default.
Changes
lib/config.tsadds explicitopenaiandlitellmprovider selection, dedicated LiteLLM credentials, a configurable proxy URL, and a required gateway model alias.lib/streaming/openai.tsconstructs the OpenAI client from the selected provider configuration and uses the configured model for every computer-use turn.README.mddocuments the LiteLLM setup and the required model capability.Usage
Configure a LiteLLM alias that supports the OpenAI Responses API
computertool:LITELLM_MODELaccepts any alias exposed by the user's LiteLLM proxy, providedthat its backing model supports the OpenAI Responses API
computertool.LiteLLM can route that alias across compatible deployments and apply its
configured fallbacks or load balancing.
Start Surf normally:
The application continues to invoke the same streamer:
OpenAIComputerStreamerreads the provider, proxy URL, key, and model alias from the environment. Application callers do not need a separate LiteLLM class or code path.Tests
Unit and live integration tests
Coverage includes:
Production build
The build reported only the repository's existing React hook warnings.
Live provider E2E
The opt-in test exercised the real
OpenAIComputerStreamerthrough a live LiteLLM 1.96 proxy backed bygpt-5.4:This verifies the complete path from Surf's streamer through the OpenAI SDK, LiteLLM, a real computer-capable model, response parsing, and SSE event generation.
Compatibility boundary
The configured alias must support the OpenAI Responses API
computertool. A generic chat model is not sufficient. LiteLLM 1.96 does not translate OpenAI'scomputertool into Anthropic's provider-specific computer-use tool, so an Anthropic alias is intentionally not advertised for this workflow. This limitation is stated in the README rather than failing silently at runtime.Risk and compatibility
gpt-5.4whenAI_PROVIDERis unset.OPENAI_API_KEY.