v1
latestOpenAPI 3.1.0Proprietary2026-07-2662032.5 KBFIM
Create a fill-in-the-middle completion
Generate a code completion given a prompt (prefix) and optional suffix. Designed for IDE-style inline completion. Returns a FimCompletion object, or a server-sent events stream of FimCompletionChunk deltas when stream=true. Tool calling and function calling are not supported.
post/v1/fim/completions
Request body
Response
Successful response. Returns a JSON object when stream=false, or a server-sent events stream of TextCompletionChunk objects (terminated by data: [DONE]) when stream=true.
Example response
{
"id": "cmpl-7a2b3c4d5e",
"object": "text_completion",
"created": 1745798400,
"model": "mercury-edit-2",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"text": "fibonacci(n - 1) + fibonacci(n - 2)"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 14,
"total_tokens": 38,
"reasoning_tokens": 0,
"cached_input_tokens": 0
}
}