GitHub

Hackage

Haskell client library for OpenCode server API.

See the OpenCode SDK docs for the full API reference.

Usage

import OpenCode
main :: IO ()
main = do
  client <- mkClient "localhost" 4096
  -- Check health
  Right health <- getHealth client
  -- Create session and send message
  Right session <- createSession client Nothing (SessionCreateInput (Just "My Session") Nothing)
  Right response <- promptSession client session.id Nothing (MessageInput [textPartInput "Hello!"])
  -- Clean up
  deleteSession client session.id Nothing

Run example

just example

Or with custom server:

nix run .#example -- localhost:4096

Read the original on github.com ↗