Rpc
Discord Rich Presence for [OpenCode](https://opencode.ai). works on both opencode 1.x.x and 2.x.x.
0
306
近 7 天 30
35.0
生态多维模型
12 天前
2026-09-22
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-rpc@2.0.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-rpc@2.0.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-rpcOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Discord Rich Presence for OpenCode. works on both opencode 1.x.x and 2.x.x.
install
OpenCode 2.x.x
opencode plugin add opencode-rpc
or add it to the plugins array in opencode.json:
{
"plugins": ["opencode-rpc"]
}
OpenCode 1.x.x
npm install opencode-rpc
the install script adds the plugin to your OpenCode config. set SKIP_OPENCODE_AUTO_CONFIG=1 to skip that and register it yourself:
{
"plugin": ["opencode-rpc"]
}
update
opencode has a terrible caching system for npm plugins, so you'll need to force a refresh if the plugin has been updated:
opencode plugin opencode-rpc@latest --global --force
configuration
{
"plugin": ["opencode-rpc"],
"plugin_config": {
"opencode-rpc": {
"clientId": "1234567890",
"showProject": true,
"showTokens": true,
"showCost": true
...
}
}
}
options
| option | default | meaning |
|---|---|---|
clientId |
built-in | Your own Discord application client ID |
showProject |
true |
Show the project folder name |
showTokens |
true |
Show input/output token counts |
showCost |
true |
Show session cost |
customText |
Working on |
Text before the project name |
hideProjectText |
something... |
Text used when the project name is hidden |
providerIcons |
{} |
Override or add provider icons, keyed by provider ID |
Put a .hiderpc file in a project to force showProject = false for that project only.
debugging
set OPENCODE_RPC_DEBUG=1 to append state changes to ~/.local/share/opencode/opencode-rpc-debug.log.
updating
opencode plugin update opencode-rpc
opencode caches plugin packages, so a plain reinstall may keep serving the old build. clear the cached copy and restart if a new version does not appear:
linux/macOS:
rm -rf "$HOME/.cache/opencode/npm/opencode-rpc@latest"
windows (PowerShell):
Remove-Item -Recurse -Force "$HOME\.cache\opencode\npm\opencode-rpc@latest"
built-in provider icons
| provider ID(s) | |
|---|---|
openai |
|
anthropic |
|
google, google-gemini, gemini, google-vertex |
|
groq |
|
together, together-color, togetherai |
|
cohere |
|
mistral |
|
azure, azure-cognitive-services |
|
aws, amazon, amazon-bedrock |
|
xai |
|
deepseek |
|
perplexity |
|
copilot, github-copilot, github |
|
gitlab |
|
huggingface |
|
cloudflare, cloudflare-ai-gateway, cloudflare-workers-ai |
|
nvidia |
|
databricks |
|
vercel |
|
vultr |
|
zenmux |
|
ovhcloud |
|
ollama, ollama-cloud |
|
openrouter |
|
deepinfra |
|
cerebras |
|
digitalocean |
|
moonshotai |
|
venice |
|
helicone |
|
nebius |
|
minimax |
|
scaleway |
|
zai |
|
io-net |
|
stackit |
|
baseten |
|
fireworks-ai |
|
sap-ai-core |
|
302ai |
|
cortecs |
|
llmgateway |
|
frogbot |
|
opencode-go, opencode-zen |
uses the OpenCode app icon |
any other provider falls back to the OpenCode icon, or to whatever you set in providerIcons.
uhh
everything was vibecoded with opencode go's kimi k2.6 :) but if it works it works upd: v2 port was vibecoded with opencode go's deepseek v4.1 flash! how the time flies
同类生态推荐
Disunday
disunday
Discord bot for controlling OpenCode coding sessions
Better Compact
better-compact
OpenCode plugin that improves long-session context with boundary-time pruning
Tokenmeter Tui
opencode-tokenmeter-tui
OpenCode TUI plugin: TokenMeter sidebar — live token usage, cost, and delegation tree for sessions