Install¶
The distribution is called opencode-python-sdk; the package imports as opencode. It needs Python 3.10 or newer
and depends only on httpx, pydantic, anyio and typing-extensions.
import opencode
print(opencode.__version__) # this package
print(opencode.API_VERSION) # the OpenCode server version it was generated from
To start a server from Python with OpencodeServer, install the OpenCode CLI
as well, so that opencode is on PATH.
Next¶
- Connect to a server that is already running.
- Run a server from Python for scripts, tests and embedded use.
- Use the background service to share one
opencode serve --servicebetween programs.