feat: support LiteLLM gateway - #40
Open
prodmanpd wants to merge 1 commit into
Open
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' |
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
prodmanpd
force-pushed
the
feat/litellm-provider
branch
from
August 2, 2026 19:52
f4739cb to
c36d184
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.