Skip to main content

Completion

POST 

https://knox.chat/v1/completions

Send a completion request to the selected model (in plain text format)

Request

This endpoint requires an object containing the following properties:

Headers

NameTypeRequiredDescription
AuthorizationStringYesBearer authentication in the form Bearer token, where token is your authorization token.

Request Body

NameTypeRequiredDescription
modelStringYesThe model ID to use. If not specified, user's default settings will be used.
promptStringYesThe text prompt to complete
modelsList of StringsNoAlternative model list for routing override.
providerObjectNoProvider routing preferences.
reasoningObjectNoConfiguration for model reasoning/thinking tokens
usageObjectNoWhether to include usage information in the response
transformsList of StringsNoList of prompt transformations (Knox Chat only).
streamBooleanNoEnable result streaming. Defaults to false
max_tokensIntegerNoMaximum number of tokens (range: [1, context_length)).
temperatureDoubleNoSampling temperature (range: [0, 2]).
seedIntegerNoSeed for deterministic output.
top_pDoubleNoTop-p sampling value (range: (0, 1]).
top_kIntegerNoTop-k sampling value (range: [1, Infinity)).
frequency_penaltyDoubleNoFrequency penalty (range: [-2, 2]).
presence_penaltyDoubleNoPresence penalty (range: [-2, 2]).
repetition_penaltyDoubleNoRepetition penalty (range: (0, 2]).
logit_biasMap of String to DoubleNoMapping from token IDs to bias values.
top_logprobsIntegerNoNumber of top log probabilities to return.
min_pDoubleNoMinimum probability threshold (range: [0, 1]).
top_aDoubleNoAlternative top sampling parameter (range: [0, 1]).

cURL Example

curl -X POST https://knox.chat/v1/completions \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"model": "model",
"prompt": "您好!"
}'

Response

Success Response (200)

{
"id": "id",
"choices": [
{
"text": "我是一个AI助手,有什么可以帮您?",
"index": 1,
"finish_reason": "stop"
}
]
}

Response Schema

NameTypeDescription
idstringUnique identifier for the completion
choicesarrayArray of completion choices
choices[].textstringGenerated text
choices[].indexintegerIndex of the choice in the array (e.g.: 0, 1, 2)
choices[].finish_reasonstringReason for completion (stop, length, content_filter)