From 8130544e6a695de530a8ab037f5da341c4859ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Sat, 30 May 2026 18:13:24 -0700 Subject: [PATCH] fix: set litellm key as OPENAI_API_KEY env var, not in config file --- container/entrypoint.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/container/entrypoint.py b/container/entrypoint.py index 8602d2c..b302963 100644 --- a/container/entrypoint.py +++ b/container/entrypoint.py @@ -86,13 +86,16 @@ def fetch_role_secrets(bao_token: str, role: str) -> dict: def write_opencode_config(secrets: dict, role: str) -> None: - """Write opencode config with the agent's secrets and MCP server tokens.""" + """Write opencode config and set secrets as env vars for opencode to pick up.""" CONFIG_DIR.mkdir(parents=True, exist_ok=True) - litellm_key = secrets.get("litellm-key", "") vikunja_token = secrets.get("vikunja-token", "") forgejo_token = secrets.get("forgejo-token", "") + # Set the LiteLLM API key as env var — opencode reads OPENAI_API_KEY for + # openai-compatible providers, or the provider-specific env var + os.environ["OPENAI_API_KEY"] = secrets.get("litellm-key", "") + config = { "$schema": "https://opencode.ai/config.json", "model": "litellm/copilot/claude-sonnet-4.6", @@ -102,7 +105,6 @@ def write_opencode_config(secrets: dict, role: str) -> None: "name": "LiteLLM", "options": { "baseURL": f"{LITELLM_BASE_URL}/v1", - "apiKey": litellm_key, } } },