You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inquiry: Programmatic access or Node.js SDK for OpenCode #4028
This issue might be a duplicate of existing issues. Please check:
Feature request: Python SDK #2266: This is a very similar request asking for a Python SDK for programmatic integration with OpenCode server functionality
Feel free to ignore if none of these address your specific case.
Note: Last time I used @opencode-ai/sdk, the npm package wasn't up to date. I ended up using the SDK directly from the monorepo - cloned sst/opencode and installed the JS SDK folder directly into my project using bun. Check the npm version first, but if you need latest features, the monorepo approach works well.
Let me know if you need help with specific use cases.
The current mental model that has worked for me is:
OpenCode server/API/SDK = how to talk to OpenCode programmatically.
Runtime/orchestration layer = how to run OpenCode safely inside another app.
For a single automation script, the server/API is enough. For a backend product, the hard parts become: which OpenCode process owns the session, how to isolate workspace/history/config per user, how to stream progress back to the app, and how to clean up or restart stuck servers.
Activity
github-actions commentedon Nov 7, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
sandipwane commentedon Nov 7, 2025
Hey @i18nsite,
Yes, OpenCode has a Node.js SDK for programmatic access.
Install:
Source: https://github.com/sst/opencode/tree/dev/packages/sdk/js
Docs: https://opencode.ai/docs/sdk/
Quick start:
SDK handles sessions, file ops, streaming responses - everything needed for automation.
Note: Last time I used @opencode-ai/sdk, the npm package wasn't up to date. I ended up using the SDK directly from the monorepo - cloned sst/opencode and installed the JS SDK folder directly into my project using bun. Check the npm version first, but if you need latest features, the monorepo approach works well.
Let me know if you need help with specific use cases.
rekram1-node commentedon Nov 7, 2025
The sdk should be up to date now
and thank u @sandipwane for being so helpful
mrlubos commentedon Jan 13, 2026
@i18nsite is your issue solved now?
ashish16052 commentedon Jul 9, 2026
The current mental model that has worked for me is:
For a single automation script, the server/API is enough. For a backend product, the hard parts become: which OpenCode process owns the session, how to isolate workspace/history/config per user, how to stream progress back to the app, and how to clean up or restart stuck servers.
I’m working on this from the Python side here:
https://github.com/ashish16052/opencode-runtime
Not meant to replace OpenCode’s SDK; it’s more like a runtime manager around OpenCode for app/backend use cases.