Inline Completion
POST /complete — fill-in-the-middle code completion for editor autocomplete.
Fill-in-the-middle (FIM) completion for editor inline suggestions. Given the text before and after the cursor, it returns the code that belongs between them.
This is not chat
Use POST /complete for editor autocomplete — short, low-latency, no conversation. For anything conversational or agentic, use Chat Completions or Anthropic Messages.
/completeRequest body
prefixstringbodyrequiredText before the cursor. An empty value short-circuits to an empty completion.
suffixstringbodyText after the cursor. Defaults to an empty string.
languagestringbodyLanguage hint, e.g. typescript. Truncated to 64 characters.
file_pathstringbodyPath of the file being edited, used as additional context. Truncated to 256 characters.
Response fields
completionstringThe generated text. Always present; empty when nothing could be generated.
curl -X POST https://api.misar.io/coder/complete \
-H "Authorization: Bearer $MISARCODER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prefix": "function slugify(input: string) {\n return input\n .toLowerCase()\n ",
"suffix": "\n}",
"language": "typescript",
"file_path": "src/utils/slug.ts"
}'{ "completion": ".trim()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-|-$/g, \"\");" }{ "completion": "" }Failure looks like an empty completion
If the upstream model stream errors, the response is still 200 with completion: "". There is no error status for a generation failure — treat an empty string as "no suggestion", not as a signal that the request was malformed.
Behaviour
- Generation is capped at 128 output tokens — this is an autocomplete, not a code generator.
- Markdown code fences are stripped before the completion is returned, so you can insert the value directly into the buffer.
- The response is not streamed.
- The model is the deployment's configured completion model, falling back to its default model.
Limits
| Limit | Value |
|---|---|
prefix + suffix combined | 32,000 characters |
language | 64 characters |
file_path | 256 characters |
| Output tokens | 128 |
Status codes
| Code | Meaning |
|---|---|
200 | Completion returned, possibly empty |
400 | prefix + suffix too large (max 32000 chars) |
401 | Missing authorization or Invalid API key |
422 | Body failed validation |
503 | Router not initialized — the deployment has no model router configured |