kodine serve launches a headless HTTP server exposing an OpenAPI endpoint that any kodine client can talk to.
kodine serve [--port <number>] [--hostname <string>] [--cors <origin>]
Flag Description Default --portListening port 4096--hostnameListening hostname 127.0.0.1--mdnsTurn on mDNS discovery false--mdns-domainCustom mDNS domain name kodine.local--corsExtra browser origins to allow []
Pass --cors more than once to allow several origins:
kodine serve --cors http://localhost:5173 --cors https://app.example.com
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.
KODINE_SERVER_PASSWORD = your-password kodine serve
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.
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.
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.
These are the APIs the kodine server exposes.
Method Path Description Response GET/global/healthServer health and version { healthy: true, version: string }GET/global/eventGlobal events (SSE stream) Event stream
Method Path Description Response GET/projectList every project Project[]GET/project/currentFetch the current project Project
Method Path Description Response GET/pathFetch the current path PathGET/vcsVCS info for the current project VcsInfo
Method Path Description Response POST/instance/disposeDispose of the current instance boolean
Method Path Description Response GET/configRead config info ConfigPATCH/configUpdate the config ConfigGET/config/providersList providers and their default models { providers: Provider[] , default: { [key: string]: string } }
Method Path Description Response 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 provider ProviderAuthAuthorizationPOST/provider/{id}/oauth/callbackHandle a provider’s OAuth callback boolean
Method Path Description Notes GET/sessionList every session Returns Session[] POST/sessionCreate a session body: { parentID?, title? }, returns Session GET/session/statusStatus of every session Returns { [sessionID: string]: SessionStatus } GET/session/:idSession details Returns Session DELETE/session/:idDelete a session and its data Returns boolean PATCH/session/:idModify session properties body: { title? }, returns Session GET/session/:id/childrenChild sessions of a session Returns Session[] GET/session/:id/todoA session’s todo list Returns Todo[] POST/session/:id/initAnalyze the app and generate AGENTS.md body: { messageID, providerID, modelID }, returns boolean POST/session/:id/forkFork a session at a given message body: { messageID? }, returns Session POST/session/:id/abortAbort an active session Returns boolean POST/session/:id/shareShare the session Returns Session DELETE/session/:id/shareStop sharing the session Returns Session GET/session/:id/diffThe session’s diff query: messageID?, returns FileDiff[] POST/session/:id/summarizeSummarize a session body: { providerID, modelID }, returns boolean POST/session/:id/revertRoll back a message body: { messageID, partID? }, returns boolean POST/session/:id/unrevertRestore every reverted message Returns boolean POST/session/:id/permissions/:permissionIDAnswer a permission request body: { response, remember? }, returns boolean
Method Path Description Notes GET/session/:id/messageList a session’s messages query: limit?, returns { info: Message , parts: Part[] }[] POST/session/:id/messageSend a message, waiting for the response body: { messageID?, model?, agent?, noReply?, system?, tools?, parts }, returns { info: Message , parts: Part[] } GET/session/:id/message/:messageIDMessage details Returns { info: Message , parts: Part[] } POST/session/:id/prompt_asyncSend a message without waiting for the response body: same as /session/:id/message, returns 204 No Content POST/session/:id/commandRun a slash command body: { messageID?, agent?, model?, command, arguments }, returns { info: Message , parts: Part[] } POST/session/:id/shellExecute a shell command body: { agent, model?, command }, returns { info: Message , parts: Part[] }
Method Path Description Response GET/commandList every command Command[]
Method Path Description Response GET/find?pattern=<pat>Search file contents Array of match objects containing path, lines, line_number, absolute_offset, submatches GET/find/file?query=<q>Locate files and directories by name string[] (paths)GET/find/symbol?query=<q>Locate workspace symbols Symbol[]GET/file?path=<path>Enumerate files and directories FileNode[]GET/file/content?path=<p>Read file contents FileContentGET/file/statusStatus of tracked files File[]
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)
Method Path Description Response GET/experimental/tool/idsList every tool ID ToolIDsGET/experimental/tool?provider=<p>&model=<m>List tools plus JSON schemas for a model ToolList
Method Path Description Response GET/lspLSP server status LSPStatus[]GET/formatterFormatter status FormatterStatus[]GET/mcpMCP server status { [name: string]: MCPStatus }POST/mcpDynamically add an MCP server body: { name, config }, returns MCP status object
Method Path Description Response GET/agentList every available agent Agent[]
Method Path Description Response POST/logEmit a log entry. Body: { service, level, message, extra? } boolean
Method Path Description Response POST/tui/append-promptAdd text to the prompt booleanPOST/tui/open-helpShow the help dialog booleanPOST/tui/open-sessionsShow the session selector booleanPOST/tui/open-themesShow the theme selector booleanPOST/tui/open-modelsShow the model selector booleanPOST/tui/submit-promptSubmit the prompt booleanPOST/tui/clear-promptEmpty the prompt booleanPOST/tui/execute-commandRun a command ({ command }) booleanPOST/tui/show-toastDisplay a toast ({ title?, message, variant }) booleanGET/tui/control/nextBlock until the next control request Control request object POST/tui/control/responseAnswer a control request ({ body }) boolean
Method Path Description Response PUT/auth/:idStore authentication credentials. The body must match the provider schema boolean
Method Path Description Response GET/eventServer-sent events stream. Opens with server.connected, then bus events Server-sent events stream
Method Path Description Response GET/docThe OpenAPI 3.1 specification HTML page with OpenAPI spec