OpenCode
Give the Sazabi agent the OpenCode CLI (opencode) in its sandbox to run the OpenCode AI coding agent.
About
This CLI connection makes the OpenCode CLI (opencode) available in the Sazabi agent's sandbox. The tool is baked into the sandbox image; connecting it configures the already-installed CLI with your credentials and provider keys.
Prerequisites
- A Sazabi project.
OPENCODE_CONFIG_CONTENT— the full content of your OpenCode configuration file (required).- At least one LLM provider API key.
Optional environment variables:
OPENCODE_AUTH_JSON— OpenCode authentication JSON.ANTHROPIC_API_KEY— API key for Anthropic (Claude models).OPENAI_API_KEY— API key for OpenAI.GOOGLE_GENERATIVE_AI_API_KEY— API key for Google Generative AI.OPENROUTER_API_KEY— API key for OpenRouter.
Set up in the dashboard
Configure the sandbox in the dashboard under Settings > Sandbox CLIs.
Find OpenCode in the catalog
In Settings > Sandbox CLIs, find OpenCode under Browse sandbox CLIs and choose to connect it.
Provide credentials
Enter the required value: OPENCODE_CONFIG_CONTENT — the full text of your OpenCode config file. Then provide at least one LLM provider key from the optional set: OPENCODE_AUTH_JSON, ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, or OPENROUTER_API_KEY. Save to store them securely; Sazabi injects them into the sandbox when the agent runs.
Set up with the CLI
You can also configure the OpenCode CLI connection with the Sazabi CLI (installed and authenticated — see CLI reference).
sazabi sandbox-clis set --type opencode --env OPENCODE_CONFIG_CONTENT="$(cat opencode.json)"To validate the credentials without saving, run the same command with test in place of set (the test command also requires the --env flags).
Verify
Ask the agent, in a thread, to run the opencode CLI (a read-only or status command) and confirm it returns real output. If the command is not found, the CLI connection may not be enabled; if it runs unauthenticated or cannot connect, recheck the credentials.
Troubleshooting
Command not found — Confirm the OpenCode CLI connection is enabled for the project under Settings > Sandbox CLIs.
Authentication or connection fails — Recheck the credential/connection values under Settings > Sandbox CLIs.