Completion
POSThttps://api.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
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | String | Yes | Bearer authentication in the form Bearer token, where token is your authorization token. |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| model | String | Yes | The model ID to use. If not specified, user's default settings will be used. |
| prompt | String | Yes | The text prompt to complete |
| models | List of Strings | No | Alternative model list for routing override. |
| provider | Object | No | Provider routing preferences. |
| reasoning | Object | No | Configuration for model reasoning/thinking tokens |
| usage | Object | No | Whether to include usage information in the response |
| transforms | List of Strings | No | List of prompt transformations (Knox Chat only). |
| stream | Boolean | No | Enable result streaming. Defaults to false |
| max_tokens | Integer | No | Maximum number of tokens (range: [1, context_length)). |
| temperature | Double | No | Sampling temperature (range: [0, 2]). |
| seed | Integer | No | Seed for deterministic output. |
| top_p | Double | No | Top-p sampling value (range: (0, 1]). |
| top_k | Integer | No | Top-k sampling value (range: [1, Infinity)). |
| frequency_penalty | Double | No | Frequency penalty (range: [-2, 2]). |
| presence_penalty | Double | No | Presence penalty (range: [-2, 2]). |
| repetition_penalty | Double | No | Repetition penalty (range: (0, 2]). |
| logit_bias | Map of String to Double | No | Mapping from token IDs to bias values. |
| top_logprobs | Integer | No | Number of top log probabilities to return. |
| min_p | Double | No | Minimum probability threshold (range: [0, 1]). |
| top_a | Double | No | Alternative top sampling parameter (range: [0, 1]). |
cURL Example
curl -X POST https://api.knox.chat/v1/completions \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"model": "model",
"prompt": "Howdy Cowboy!"
}'
Response
Success Response (200)
{
"id": "id",
"choices": [
{
"text": "I'm an AI assistant, how can I help you?",
"index": 1,
"finish_reason": "stop"
}
]
}
Response Schema
| Name | Type | Description |
|---|---|---|
| id | string | Unique identifier for the completion |
| choices | array | Array of completion choices |
| choices[].text | string | Generated text |
| choices[].index | integer | Index of the choice in the array (e.g.: 0, 1, 2) |
| choices[].finish_reason | string | Reason for completion (stop, length, content_filter) |