MisarMisar Docs
MisarMailMisarBlogMisarReachMisarPostMisarDevMisarCoderMisarSEOMisar PlatformMisar SSO
API Reference

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.

POST/complete

Request body

prefixstringbodyrequired

Text before the cursor. An empty value short-circuits to an empty completion.

suffixstringbody

Text after the cursor. Defaults to an empty string.

languagestringbody

Language hint, e.g. typescript. Truncated to 64 characters.

file_pathstringbody

Path of the file being edited, used as additional context. Truncated to 256 characters.

Response fields

completionstring

The generated text. Always present; empty when nothing could be generated.

Request
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"
  }'
200 — Completion
{ "completion": ".trim()\n    .replace(/[^a-z0-9]+/g, \"-\")\n    .replace(/^-|-$/g, \"\");" }
200 — Nothing generated
{ "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

LimitValue
prefix + suffix combined32,000 characters
language64 characters
file_path256 characters
Output tokens128

Status codes

CodeMeaning
200Completion returned, possibly empty
400prefix + suffix too large (max 32000 chars)
401Missing authorization or Invalid API key
422Body failed validation
503Router not initialized — the deployment has no model router configured