Skip to content
New Kodine v2 is now available

Server

Talk to the kodine server over HTTP.

kodine serve launches a headless HTTP server exposing an OpenAPI endpoint that any kodine client can talk to.


Usage

Terminal window
kodine serve [--port <number>] [--hostname <string>] [--cors <origin>]

Options

FlagDescriptionDefault
--portListening port4096
--hostnameListening hostname127.0.0.1
--mdnsTurn on mDNS discoveryfalse
--mdns-domainCustom mDNS domain namekodine.local
--corsExtra browser origins to allow[]

Pass --cors more than once to allow several origins:

Terminal window
kodine serve --cors http://localhost:5173 --cors https://app.example.com

Authentication

Protect the server with HTTP basic auth by setting KODINE_SERVER_PASSWORD. The username is kodine unless you override it with KODINE_SERVER_USERNAME. Both kodine serve and kodine web honor this.

Terminal window
KODINE_SERVER_PASSWORD=your-password kodine serve

How it works

Running kodine launches two things: a TUI and a server, where the TUI acts as the client talking to that server. The server publishes an OpenAPI 3.1 spec endpoint, which is also what the SDK is generated from.

Thanks to this architecture, kodine can serve multiple clients at once and be driven entirely from code.

Use kodine serve when you want a standalone server. Even with the kodine TUI already running, kodine serve spins up a separate, new server.


Connect to an existing server

The TUI normally picks a random port and hostname on startup. Pass the --hostname and --port flags to fix them, then point your client at that address.

Through the /tui endpoint you can drive the TUI via the server — prefilling or running a prompt, for instance. The Kodine IDE plugins rely on exactly this setup.


Spec

An OpenAPI 3.1 spec is published by the server at:

http://<hostname>:<port>/doc

For instance, http://localhost:4096/doc. Generate clients from the spec, inspect request and response types, or browse it in a Swagger explorer.


APIs

These are the APIs the kodine server exposes.


Global

MethodPathDescriptionResponse
GET/global/healthServer health and version{ healthy: true, version: string }
GET/global/eventGlobal events (SSE stream)Event stream

Project

MethodPathDescriptionResponse
GET/projectList every projectProject[]
GET/project/currentFetch the current projectProject

Path & VCS

MethodPathDescriptionResponse
GET/pathFetch the current pathPath
GET/vcsVCS info for the current projectVcsInfo

Instance

MethodPathDescriptionResponse
POST/instance/disposeDispose of the current instanceboolean

Config

MethodPathDescriptionResponse
GET/configRead config infoConfig
PATCH/configUpdate the configConfig
GET/config/providersList providers and their default models{ providers: Provider[], default: { [key: string]: string } }

Provider

MethodPathDescriptionResponse
GET/providerList every provider{ all: Provider[], default: {...}, connected: string[] }
GET/provider/authAuthentication methods per provider{ [providerID: string]: ProviderAuthMethod[] }
POST/provider/{id}/oauth/authorizeStart OAuth authorization for a providerProviderAuthAuthorization
POST/provider/{id}/oauth/callbackHandle a provider’s OAuth callbackboolean

Sessions

MethodPathDescriptionNotes
GET/sessionList every sessionReturns Session[]
POST/sessionCreate a sessionbody: { parentID?, title? }, returns Session
GET/session/statusStatus of every sessionReturns { [sessionID: string]: SessionStatus }
GET/session/:idSession detailsReturns Session
DELETE/session/:idDelete a session and its dataReturns boolean
PATCH/session/:idModify session propertiesbody: { title? }, returns Session
GET/session/:id/childrenChild sessions of a sessionReturns Session[]
GET/session/:id/todoA session’s todo listReturns Todo[]
POST/session/:id/initAnalyze the app and generate AGENTS.mdbody: { messageID, providerID, modelID }, returns boolean
POST/session/:id/forkFork a session at a given messagebody: { messageID? }, returns Session
POST/session/:id/abortAbort an active sessionReturns boolean
POST/session/:id/shareShare the sessionReturns Session
DELETE/session/:id/shareStop sharing the sessionReturns Session
GET/session/:id/diffThe session’s diffquery: messageID?, returns FileDiff[]
POST/session/:id/summarizeSummarize a sessionbody: { providerID, modelID }, returns boolean
POST/session/:id/revertRoll back a messagebody: { messageID, partID? }, returns boolean
POST/session/:id/unrevertRestore every reverted messageReturns boolean
POST/session/:id/permissions/:permissionIDAnswer a permission requestbody: { response, remember? }, returns boolean

Messages

MethodPathDescriptionNotes
GET/session/:id/messageList a session’s messagesquery: limit?, returns { info: Message, parts: Part[]}[]
POST/session/:id/messageSend a message, waiting for the responsebody: { messageID?, model?, agent?, noReply?, system?, tools?, parts }, returns { info: Message, parts: Part[]}
GET/session/:id/message/:messageIDMessage detailsReturns { info: Message, parts: Part[]}
POST/session/:id/prompt_asyncSend a message without waiting for the responsebody: same as /session/:id/message, returns 204 No Content
POST/session/:id/commandRun a slash commandbody: { messageID?, agent?, model?, command, arguments }, returns { info: Message, parts: Part[]}
POST/session/:id/shellExecute a shell commandbody: { agent, model?, command }, returns { info: Message, parts: Part[]}

Commands

MethodPathDescriptionResponse
GET/commandList every commandCommand[]

Files

MethodPathDescriptionResponse
GET/find?pattern=<pat>Search file contentsArray of match objects containing path, lines, line_number, absolute_offset, submatches
GET/find/file?query=<q>Locate files and directories by namestring[] (paths)
GET/find/symbol?query=<q>Locate workspace symbolsSymbol[]
GET/file?path=<path>Enumerate files and directoriesFileNode[]
GET/file/content?path=<p>Read file contentsFileContent
GET/file/statusStatus of tracked filesFile[]

/find/file query parameters

  • query (required) — search string (fuzzy matched)
  • type (optional) — restrict results to "file" or "directory"
  • directory (optional) — search outside the project root
  • limit (optional) — maximum results (1–200)
  • dirs (optional) — legacy flag (pass "false" to get files only)

Tools (Experimental)

MethodPathDescriptionResponse
GET/experimental/tool/idsList every tool IDToolIDs
GET/experimental/tool?provider=<p>&model=<m>List tools plus JSON schemas for a modelToolList

LSP, Formatters & MCP

MethodPathDescriptionResponse
GET/lspLSP server statusLSPStatus[]
GET/formatterFormatter statusFormatterStatus[]
GET/mcpMCP server status{ [name: string]: MCPStatus }
POST/mcpDynamically add an MCP serverbody: { name, config }, returns MCP status object

Agents

MethodPathDescriptionResponse
GET/agentList every available agentAgent[]

Logging

MethodPathDescriptionResponse
POST/logEmit a log entry. Body: { service, level, message, extra? }boolean

TUI

MethodPathDescriptionResponse
POST/tui/append-promptAdd text to the promptboolean
POST/tui/open-helpShow the help dialogboolean
POST/tui/open-sessionsShow the session selectorboolean
POST/tui/open-themesShow the theme selectorboolean
POST/tui/open-modelsShow the model selectorboolean
POST/tui/submit-promptSubmit the promptboolean
POST/tui/clear-promptEmpty the promptboolean
POST/tui/execute-commandRun a command ({ command })boolean
POST/tui/show-toastDisplay a toast ({ title?, message, variant })boolean
GET/tui/control/nextBlock until the next control requestControl request object
POST/tui/control/responseAnswer a control request ({ body })boolean

Auth

MethodPathDescriptionResponse
PUT/auth/:idStore authentication credentials. The body must match the provider schemaboolean

Events

MethodPathDescriptionResponse
GET/eventServer-sent events stream. Opens with server.connected, then bus eventsServer-sent events stream

Docs

MethodPathDescriptionResponse
GET/docThe OpenAPI 3.1 specificationHTML page with OpenAPI spec