POST /completion
Stream an inline code completion. This is the main endpoint for editor integrations.
Request body
| Field | Required | Description |
|---|---|---|
prefix | yes | Code before the cursor |
suffix | yes | Code after the cursor |
language | no | Programming language (default: "typescript") |
filename | no | Absolute file path — enables import resolution and symbol lookup |
project_root | no | Project root directory — enables convention analysis, sibling patterns, and project-scoped memory |
model | no | Model ID (default: claude-haiku-4-5-20251001 for Claude, o4-mini for Codex) |
provider | no | "claude" or "codex" (default: auto-detect) |
max_tokens | no | Max completion length |
project_root is provided, the server automatically:
- Analyzes conventions — formatting, naming, imports, error handling (cached 5 min)
- Resolves imports — reads exported APIs from imported files
- Finds sibling patterns — extracts structure from neighboring files
- Looks up symbols — greps for type/interface definitions referenced near the cursor
- Queries learned rules — fetches patterns you’ve reinforced through past accepts/rejects
Response
SSE stream withdata: lines containing JSON:
| Type | Fields | Description |
|---|---|---|
delta | text | A chunk of completion text |
done | — | Stream complete |
error | error | Error message |
POST /completion/text
Stream general-purpose text generation (used by git commit, custom prompts).
/completion.
POST /completion/accept
Report that the user accepted a completion. Used for learning.
- Stores the entry in project-scoped memory
- Auto-detects the completion category (import, error-handling, variable, etc.)
- Re-runs rule extraction to look for emerging patterns
POST /completion/reject
Report that the user dismissed a completion.
GET /completion/memory/stats
Returns memory statistics. Add ?project_root=/path/to/project for project-scoped stats.
DELETE /completion/memory
Clear all stored completions and learned rules. Add ?project_root=/path/to/project to clear only that project.
POST /completion/conventions
Trigger convention analysis for a project. Returns the detected conventions.
DELETE /completion/conventions
Invalidate the convention cache. Add ?project_root=/path/to/project to invalidate only that project.