Skip to main content

Text Completions (Legacy)

POST /v1/completions

The classic text-in → text-out completion endpoint (no conversation structure). For new projects, prefer Chat Completions.

RequestREQUEST
POSThttps://test.kailin.com.cn/v1/completions
ResponseRESPONSE
Fill in the request and hit Send — the response shows up here

Request​

curl https://test.kailin.com.cn/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "gpt-3.5-turbo-instruct",
"prompt": "Three keywords about artificial intelligence:",
"max_tokens": 30,
"temperature": 0.8
}'

Request Body​

ParameterTypeRequiredDescription
modelstringYesMust be a completion-style model
promptstring / arrayYesText to continue; pass an array for batch requests
streambooleanNoStream output (SSE), default false
max_tokensnumberNoMax tokens to generate
temperaturenumberNoSampling temperature 0–2
top_pnumberNoNucleus sampling
nintegerNoNumber of completions to generate
stopstring / arrayNoStop sequences
echobooleanNoEcho the prompt back in the result
logprobsintegerNoReturn per-token log probabilities (max 5)
frequency_penalty / presence_penaltynumberNoRepetition penalties
seedintegerNoRandom seed

Response​

{
"id": "cmpl-xxx",
"object": "text_completion",
"created": 1730000000,
"model": "gpt-3.5-turbo-instruct",
"choices": [
{
"index": 0,
"text": " deep learning, neural networks, and natural language processing.",
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 18,
"total_tokens": 30
}
}
caution

Not every channel offers completion-style models. If the model name errors out, check the available list with GET /v1/models first.