SDK
Type-safe JS client for InnoCode server.
The InnoCode JS/TS SDK provides a type-safe client for interacting with the server. Use it to build integrations and control InnoCode programmatically.
Learn more about how the server works. For examples, check out the projects built by the community.
Install
Install the SDK from npm:
npm install innocodeCreate client
Create an instance of InnoCode:
import { createOpencode } from "innocode/sdk"
const { client } = await createOpencode()This starts both a server and a client.
Options
| Option | Type | Description | Default |
|---|---|---|---|
hostname | string | Server hostname | 127.0.0.1 |
port | number | Server port | 4096 |
signal | AbortSignal | Abort signal for cancellation | undefined |
timeout | number | Timeout in ms for server start | 5000 |
config | Config | Configuration object | {} |
Config
You can pass a configuration object to customize behavior. The instance still picks up your innocode.json, but you can override or add configuration inline:
import { createOpencode } from "innocode/sdk"
const innocode = await createOpencode({ hostname: "127.0.0.1", port: 4096, config: { model: "innogpt/gpt-4o", },})
console.log(`Server running at ${innocode.server.url}`)
innocode.server.close()Client only
If you already have a running instance of InnoCode, you can create a client instance to connect to it:
import { createOpencodeClient } from "innocode/sdk"
const client = createOpencodeClient({ baseUrl: "http://localhost:4096",})