Skip to main content
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)

Request Parameters

Required

ParameterTypeDescription
modelstringModel ID (e.g., moonshotai/kimi-k2.5).
promptstring or arrayThe input text to complete. Can be a string or array of strings.

Sampling

ParameterTypeDefaultDescription
temperaturefloat1.0Sampling temperature (0–2).
top_pfloat1.0Nucleus sampling threshold.
top_kinteger-1Limits sampling to the top K tokens.
min_pfloat0.0Minimum relative probability threshold.
seedintegernullSeed for deterministic sampling.

Output

ParameterTypeDefaultDescription
max_tokensinteger16Maximum tokens to generate.
ninteger1Number of completions per prompt.
stopstring or arraynullUp to 4 stop sequences.
streambooleanfalseStream partial results via SSE.
echobooleanfalseReturn the prompt concatenated with the completion.

Penalties

ParameterTypeDefaultDescription
frequency_penaltyfloat0.0Penalizes tokens by frequency (-2.0 to 2.0).
presence_penaltyfloat0.0Penalizes tokens by presence (-2.0 to 2.0).
repetition_penaltyfloat1.0Multiplicative penalty on repeated tokens.
logit_biasobjectnullMap of token ID → bias value (-100 to 100).

Log Probabilities

ParameterTypeDefaultDescription
logprobsintegernullReturn log probabilities of the top N tokens (max 5).

Response Format

{
  "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
  }
}