Skip to content

Autocomplete — Fill-in-the-Middle (FIM)

Fresh

Generate code completions by providing context before and after the cursor position.

Endpoint

POST https://api.inceptionlabs.ai/v1/fim/completions

Request Format

bash
curl https://api.inceptionlabs.ai/v1/fim/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $INCEPTION_API_KEY" \
  -d '{
    "model": "mercury-edit",
    "prompt": "def fibonacci(",
    "suffix": "return a + b",
    "max_tokens": 1000
  }'

Parameters

ParameterTypeDescription
modelstringMust be "mercury-edit"
promptstringCode before the cursor
suffixstringCode after the cursor
max_tokensintMax tokens to generate (1-8,192)
temperaturefloatRandomness (0.0-1.0)
streamboolEnable streaming

How It Works

The model takes the prompt (everything before the cursor) and suffix (everything after) and generates the code that fits in between.

Use Cases

  • Code autocomplete in IDEs
  • Function body generation
  • Code infilling between existing blocks

See Also