Description
n8n-nodes-opencode-ai


This is an n8n community node package that provides integration with OpenCode AI Server API.
OpenCode is a powerful terminal-based AI coding assistant. This node enables you to interact with OpenCode Server from your n8n workflows.
Features
- Session Management: Create, list, get, delete, and abort OpenCode sessions
- Message Operations: Send messages (sync/async), execute commands, run shell commands
- AI Agent Integration: LangChain-compatible Tool and ChatModel nodes for n8n AI agents
- Dynamic Configuration: Auto-load available models, agents, and commands from server
Prerequisites
> ⚠️ Important: This package requires a running OpenCode Server instance. The node connects to OpenCode Server via REST API, so you must have the server running before using this node.
Installing OpenCode
Install OpenCode CLI
curl -fsSL https://opencode.ai/install | bash
For other installation methods (npm, Homebrew, Scoop, etc.), see the OpenCode Installation Guide.
Oh My OpenCode (Optional, Recommended)
Oh My OpenCode is a powerful plugin that enhances OpenCode with specialized agents like Sisyphus (Claude Opus 4.5 with extended thinking) and parallel background task execution.
Install via bunx
bunx oh-my-opencode installOr via npm
npm install -g oh-my-opencode
For more details, visit Oh My OpenCode GitHub.
Starting OpenCode Server
Set authentication credentials via environment variables
OPENCODESERVERUSERNAME=yourusername OPENCODESERVERPASSWORD=yourpassword opencode serve --port 4096
You can change the port number as needed. The credentials you set here will be used in the n8n credential configuration.
Security Considerations
> 🔒 Security Warning: The example above is for development/testing purposes only.
For production deployments:
.env files with proper permissions, secrets managers)Example production setup with environment file:
.env file (chmod 600)
OPENCODESERVERUSERNAME=secure_username
OPENCODESERVERPASSWORD=strongrandompasswordStart server
source .env && opencode serve --port 4096
Installation
Community Nodes (Recommended)
1. Go to Settings > Community Nodes in your n8n instance
2. Click Install
3. Enter n8n-nodes-opencode-ai and click Install
Manual Installation
npm install n8n-nodes-opencode-ai
Nodes
| Node | Description |
|——|————-|
| OpenCode | Main node for session and message operations |
| OpenCode Tool | LangChain tool for AI agent workflows |
| OpenCode Chat Model | LangChain chat model for AI agent workflows |
Credentials
This node uses Basic Authentication to connect to OpenCode Server.
| Field | Description | Default |
|——-|————-|———|
| Base URL | OpenCode Server URL | http://127.0.0.1:4096 |
| Username | Basic Auth username | – |
| Password | Basic Auth password | – |
Operations
Session Resource
Message Resource
Config Resource
Usage Examples
Basic Message Send
1. Add the OpenCode node to your workflow
2. Select Message resource and Send operation
3. Choose or create a session
4. Enter your message
5. Execute to get AI response
Using with AI Agent
1. Add OpenCode Chat Model node as the model
2. Add OpenCode Tool node as a tool
3. Connect to an AI Agent node
4. The agent can now use OpenCode for coding tasks
Temporary Session Mode
Enable Temporary Session mode to automatically create and delete sessions per request – useful for stateless operations.
Requirements
Related Links
License
This project is licensed under the MIT License.
This is an independent community node and is not officially affiliated with or endorsed by OpenCode. OpenCode is also licensed under the MIT License.
—
Dante Labs
Developed and maintained by Dante Labs
Support
If you find this project helpful, consider supporting the development!

☕ Buy Me a Coffee: https://buymeacoffee.com/dante.labs