The legacy completions endpoint generates text from a raw prompt string. For conversational use cases, prefer Chat Completions instead.
This is a legacy endpoint maintained for backward compatibility. Use /v1/chat/completions for new integrations.
Endpoint
POST https://api.getlilac.com/v1/completions
Example
from openai import OpenAI
client = OpenAI(
base_url="https://api.getlilac.com/v1",
api_key="your-lilac-api-key",
)
response = client.completions.create(
model="moonshotai/kimi-k2.5",
prompt="The capital of France is",
max_tokens=50,
)
print(response.choices[0].text)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.getlilac.com/v1",
apiKey: "your-lilac-api-key",
});
const response = await client.completions.create({
model: "moonshotai/kimi-k2.5",
prompt: "The capital of France is",
max_tokens: 50,
});
console.log(response.choices[0].text);
curl https://api.getlilac.com/v1/completions \
-H "Authorization: Bearer your-lilac-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "moonshotai/kimi-k2.5",
"prompt": "The capital of France is",
"max_tokens": 50
}'
Request Parameters
Required
| Parameter | Type | Description |
|---|
model | string | Model ID (e.g., moonshotai/kimi-k2.5). |
prompt | string or array | The input text to complete. Can be a string or array of strings. |
Sampling
| Parameter | Type | Default | Description |
|---|
temperature | float | 1.0 | Sampling temperature (0–2). |
top_p | float | 1.0 | Nucleus sampling threshold. |
top_k | integer | -1 | Limits sampling to the top K tokens. |
min_p | float | 0.0 | Minimum relative probability threshold. |
seed | integer | null | Seed for deterministic sampling. |
Output
| Parameter | Type | Default | Description |
|---|
max_tokens | integer | 16 | Maximum tokens to generate. |
n | integer | 1 | Number of completions per prompt. |
stop | string or array | null | Up to 4 stop sequences. |
stream | boolean | false | Stream partial results via SSE. |
echo | boolean | false | Return the prompt concatenated with the completion. |
Penalties
| Parameter | Type | Default | Description |
|---|
frequency_penalty | float | 0.0 | Penalizes tokens by frequency (-2.0 to 2.0). |
presence_penalty | float | 0.0 | Penalizes tokens by presence (-2.0 to 2.0). |
repetition_penalty | float | 1.0 | Multiplicative penalty on repeated tokens. |
logit_bias | object | null | Map of token ID → bias value (-100 to 100). |
Log Probabilities
| Parameter | Type | Default | Description |
|---|
logprobs | integer | null | Return log probabilities of the top N tokens (max 5). |
{
"id": "cmpl-abc123",
"object": "text_completion",
"created": 1717000000,
"model": "moonshotai/kimi-k2.5",
"choices": [
{
"index": 0,
"text": " Paris, which is known for...",
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 7,
"completion_tokens": 15,
"total_tokens": 22
}
}