Skip to content

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:

Terminal window
npm install innocode

Create client

Create an instance of InnoCode:

import { createOpencode } from "innocode/sdk"
const { client } = await createOpencode()

This starts both a server and a client.

Options

OptionTypeDescriptionDefault
hostnamestringServer hostname127.0.0.1
portnumberServer port4096
signalAbortSignalAbort signal for cancellationundefined
timeoutnumberTimeout in ms for server start5000
configConfigConfiguration 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",
})