BerriAI/litellm · error · ValueError
E2B API key not set. Set E2B_API_KEY or pass api_key=...
Error message
E2B API key not set. Set E2B_API_KEY or pass api_key=...
What it means
Error "E2B API key not set. Set E2B_API_KEY or pass api_key=..." thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/e2b/sandbox/transformation.py:45
E2B_API_BASE: Final = "https://api.e2b.app"
E2B_DEFAULT_TEMPLATE: Final = "code-interpreter-v1"
E2B_DEFAULT_DOMAIN: Final = "e2b.app"
JUPYTER_PORT: Final = 49999
DEFAULT_SANDBOX_TIMEOUT: Final = 300
MAX_OUTPUT_BYTES: Final = SANDBOX_MAX_OUTPUT_BYTES
class E2BSandboxConfig(BaseSandboxConfig):
def _http(self, client: AsyncHTTPHandler | None) -> AsyncHTTPHandler:
if client is not None:
return client
return get_async_httpx_client(llm_provider=httpxSpecialProvider.Sandbox)
def validate_environment(self, api_key: str | None = None, **kwargs) -> str:
key: Final = api_key or get_secret_str("E2B_API_KEY")
if not key:
raise ValueError("E2B API key not set. Set E2B_API_KEY or pass api_key=...")
return key
async def acreate_sandbox(
self,
*,
template: str | None = None,
timeout: int | None = None,
allow_internet_access: bool | None = None,
api_key: str | None = None,
api_base: str | None = None,
metadata: dict | None = None,
client: AsyncHTTPHandler | None = None,
**kwargs,
) -> ContainerHandle:
key: Final = self.validate_environment(api_key=api_key)
base: Final = api_base or E2B_API_BASE
body: Final = {
"templateID": template or E2B_DEFAULT_TEMPLATE,View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set E2B_API_KEY or pass api_key.
When it happens
Trigger: Thrown at litellm/llms/e2b/sandbox/transformation.py:45 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/6644a4ef556f6be1.
Report an issue: GitHub.