---
title: "Create a code edit completion"
method: POST
path: "/v1/edit/completions"
tags: ["Edit"]
---

# Create a code edit completion

`POST /v1/edit/completions`

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.

## Request body

- EditCompletionRequest
  - `messages` EditMessageParam[], required
    - `role` 'user', required — Edit requests only accept user messages.
    - `content` union, required — The content of the edit request. Must contain the required edit prompt tags.
      - string
      - object[]
  - `model` string, required — The model to use for the edit completion.
  - `max_tokens` integer — Maximum number of tokens to generate.
  - `temperature` number — What sampling temperature to use, between 0 and 2. Higher values make the output more random; lower values make it more focused and deterministic.
  - `top_p` number — Float that controls the cumulative probability of the top tokens to consider.
  - `presence_penalty` number — Number between -2 and 2. Positive values penalize tokens based on whether they have appeared in the text so far, increasing the model's likelihood to talk about new topics.

## Response `200`

Successful Response

- EditCompletionResponse
  - `id` string, required
  - `object` 'edit.completion', required
  - `created` integer, required
  - `model` string, required
  - `choices` EditChoice[], required
    - `index` integer, required
    - `message` EditMessage, required — Edit response message. The model always responds as the assistant.
      - `role` 'assistant', required — Edit responses are always from the assistant.
      - `content` union — The model's edit output.
        - string
        - object[]
    - `finish_reason` 'stop' | 'length' | 'content_filter' | 'null', nullable, required — The reason the model stopped generating tokens.
  - `usage` EditUsage, required — Usage for edit completions.
    - `prompt_tokens` integer, required
    - `reasoning_tokens` integer, required
    - `completion_tokens` integer, required
    - `total_tokens` integer, required
    - `cached_input_tokens` integer, required
  - `warning` string, nullable

## Other responses

- `400` — Bad Request — invalid parameters.
- `401` — Unauthorized — missing or invalid API key.
- `402` — Payment Required — billing inactive or quota exceeded.
- `404` — Not Found — model not available for this account.
- `429` — Too Many Requests — rate limit exceeded.
- `500` — Internal Server Error.

---

[API](https://skmtc.dev/inceptionlabs/apis/inception-api.md) · [All operations](https://skmtc.dev/inceptionlabs/apis/inception-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/inceptionlabs/inception-api/revisions/f42ebbad1e95/schema)
