v1
latestOpenAPI 3.1.0Proprietary2026-07-2662032.5 KBEdit
Create a code edit completion
Generate an edit to a code region given the surrounding context. The request must contain a single user message whose content includes the required edit prompt tags (e.g. <|code_to_edit|>, <|cursor|>, <|current_file_content|>). Returns an EditCompletion object. Streaming and tool calling are not supported on this endpoint.
post/v1/edit/completions
Request body
Response
Successful Response
Example response
{
"id": "cmpl-7a2b3c4d5e",
"object": "edit.completion",
"created": 1745798400,
"model": "mercury-edit-2",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "def greet(name):\n print(f\"hi {name}\")\n"
}
}
],
"usage": {
"prompt_tokens": 156,
"completion_tokens": 18,
"total_tokens": 174,
"reasoning_tokens": 0,
"cached_input_tokens": 0
}
}