Autocomplete — Fill-in-the-Middle (FIM)
FreshGenerate code completions by providing context before and after the cursor position.
Endpoint
POST https://api.inceptionlabs.ai/v1/fim/completionsRequest 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
| Parameter | Type | Description |
|---|---|---|
model | string | Must be "mercury-edit" |
prompt | string | Code before the cursor |
suffix | string | Code after the cursor |
max_tokens | int | Max tokens to generate (1-8,192) |
temperature | float | Randomness (0.0-1.0) |
stream | bool | Enable 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
- Apply Edit — Edit existing code with context
- Next Edit — Predictive edit suggestions
- IDE Integrations — Use FIM in your editor