The codeflow serve command runs a headless HTTP server that exposes an OpenAPI endpoint that an codeflow client can use.
codeflow serve [--port <number>] [--hostname <string>]
Flag Short Description Default --port-pPort to listen on 4096--hostname-hHostname to listen on 127.0.0.1
When you run codeflow it starts a TUI and a server. Where the TUI is the
client that talks to the server. The server exposes an OpenAPI 3.1 spec
endpoint. This endpoint is also used to generate an SDK .
This architecture lets codeflow support multiple clients and allows you to interact with codeflow programmatically.
You can run codeflow serve to start a standalone server. If you have the
codeflow TUI running, codeflow serve will start a new server.
When you start the TUI it randomly assigns a port and hostname. You can instead pass in the --hostname and --port flags . Then use this to connect to its server.
The /tui endpoint can be used to drive the TUI through the server. For example, you can prefill or run a prompt. This setup is used by the codeflow IDE plugins.
The server publishes an OpenAPI 3.1 spec that can be viewed at:
http://<hostname>:<port>/doc
For example, http://localhost:4096/doc. Use the spec to generate clients or inspect request and response types. Or view it in a Swagger explorer.
The codeflow server exposes the following APIs.
Method Path Description Response GET/appGet app info AppPOST/app/initInitialize the app boolean
Method Path Description Response GET/configGet config info ConfigGET/config/providersList providers and default models { providers: Provider[], default: { [key: string]: string } }
Method Path Description Notes GET/sessionList sessions Returns Session[] GET/session/:idGet session Returns Session GET/session/:id/childrenList child sessions Returns Session[] POST/sessionCreate session body: { parentID?, title? }, returns Session DELETE/session/:idDelete session PATCH/session/:idUpdate session properties body: { title? }, returns Session POST/session/:id/initAnalyze app and create AGENTS.md body: { messageID, providerID, modelID } POST/session/:id/abortAbort a running session POST/session/:id/shareShare session Returns Session DELETE/session/:id/shareUnshare session Returns Session POST/session/:id/summarizeSummarize session GET/session/:id/messageList messages in a session Returns { info: Message, parts: Part[]}[] GET/session/:id/message/:messageIDGet message details Returns { info: Message, parts: Part[]} POST/session/:id/messageSend chat message body matches ChatInput , returns Message POST/session/:id/shellRun a shell command body matches CommandInput , returns Message POST/session/:id/revertRevert a message body: { messageID } POST/session/:id/unrevertRestore reverted messages POST/session/:id/permissions/:permissionIDRespond to a permission request body: { response }
Method Path Description Response GET/find?pattern=<pat>Search for text in files Array of match objects with path, lines, line_number, absolute_offset, submatches GET/find/file?query=<q>Find files by name string[] (file paths)GET/find/symbol?query=<q>Find workspace symbols Symbol[]GET/file?path=<path>Read a file { type: "raw" | "patch", content: string }GET/file/statusGet status for tracked files File[]
Method Path Description Response POST/logWrite log entry. Body: { service, level, message, extra? } boolean
Method Path Description Response GET/agentList all available agents Agent[]
Method Path Description Response POST/tui/append-promptAppend text to the prompt booleanPOST/tui/open-helpOpen the help dialog booleanPOST/tui/open-sessionsOpen the session selector booleanPOST/tui/open-themesOpen the theme selector booleanPOST/tui/open-modelsOpen the model selector booleanPOST/tui/submit-promptSubmit the current prompt booleanPOST/tui/clear-promptClear the prompt booleanPOST/tui/execute-commandExecute a command ({ command }) booleanPOST/tui/show-toastShow toast ({ title?, message, variant }) booleanGET/tui/control/nextWait for the next control request Control request object POST/tui/control/responseRespond to a control request ({ body }) boolean
Method Path Description Response PUT/auth/:idSet authentication credentials. Body must match provider schema boolean
Method Path Description Response GET/eventServer-sent events stream. First event is server.connected, then bus events Server-sent events stream
Method Path Description Response GET/docOpenAPI 3.1 specification HTML page with OpenAPI spec