OpenCode Agent
The OpenCode Agent is an open-source, terminal-first AI coding agent. It allows developers to interact with artificial intelligence directly from the command line interface (CLI) to generate code, troubleshoot issues, analyze repositories, or automate terminal tasks.
As a model-agnostic, open alternative to proprietary tools (like Claude Code), OpenCode integrates seamlessly with our Swiss-hosted LLMaaS Gateway. This ensures that all of your code context, prompts, and sensitive data remain entirely within our highly secure Swiss infrastructure.
Key Features
- Terminal-First Workflow: Interact with an interactive Terminal User Interface (TUI) directly within your workspace.
- Full Data Sovereignty: By routing traffic through our Swiss LLMaaS Gateway, your prompts and source code never leave Switzerland.
- Model-Agnostic: Flexibly switch between different models and providers.
- Agentic Capabilities: The agent can independently analyze project structures, edit files, execute tests, and fix programming bugs interactively.
- Context Branching: Allows you to "rewind" a conversation to explore alternative implementation paths without losing the original conversation history.
Installation
OpenCode can be installed easily using an installation script or package manager on macOS and Linux:
curl -fsSL https://opencode.ai/install | bash
brew install opencode
npm install -g @opencode/cli
Configuration with LLMaaS Gateway
To connect OpenCode to our Swiss LLMaaS endpoint, you can create a configuration file at the project level or globally in your user directory.
1. Save API Key
Export your virtual API key as an environment variable. Replace sk-bf-... with your actual key:
mkdir -p ~/.config/opencode
echo "sk-bf-..." > ~/.config/opencode/ew-key
2. Create Configuration File
Create a file named opencode.json in your project directory (or globally at ~/.config/opencode/opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"enabled_providers": ["ew"],
"provider": {
"ew": {
"npm": "@ai-sdk/openai-compatible",
"name": "ai.ewcs.ch",
"options": {
"baseURL": "https://ai.ewcs.ch/v1",
"apiKey": "{file:~/.config/opencode/ew-key}"
},
"models": {
"ew/minimax27": {
"name": "minimax27"
},
"ew/qwen36-35b-a3b": {
"name": "qwen36-35b-a3b"
},
"ew/inference-deepseek-v32": {
"name": "deepseek-v32"
},
"ew/inference-deepseekr1-670b": {
"name": "deepseekr1-670b"
},
"ew/inference-gemma4-31b": {
"name": "gemma4-31b"
},
"ew/inference-gpt-oss-120b": {
"name": "gpt-oss-120b"
},
"ew/inference-kimi-k2": {
"name": "kimi-k2"
},
"ew/inference-llama4-maverick": {
"name": "llama4-maverick"
}
}
}
}
}
3. Connect
Start the agent in your project directory:
opencode
Within the interactive terminal, run the /connect command, select the configured everyware-llmaas profile, and select the desired model using the /models command.
Typical Commands and Workflows
Once OpenCode is running, you can enter prompts or slash commands directly in the terminal interface:
- Code Analysis:
"Explain the architecture of this repository and show me where the API calls are made." - Refactoring:
"Optimize error handling in script/translate_md.py and add unit tests." - Run Commands:
"Run the linter and fix all reported syntax errors." - TUI Commands:
/connect– Manage connections to providers/models– Switch the active LLM model/clear– Clear chat history/exit– Exit the OpenCode TUI
Extension: Oh My OpenAgent (OmO)
Learn how to extend OpenCode with Oh My OpenAgent (OmO) to support multi-agent workflows (agent teams) and intelligent model routing.