AI Chat Assistant
This document describes all available API endpoints, their payloads, response formats, and configuration options for the Jink Hosting Generative Language Core API.
https://your-host:8000)/auth and /ui require a JWT Bearer token.application/json for all POST requests.
/auth
Authenticate and receive a JWT token. Use this token as a Bearer token in the Authorization header for all protected endpoints.
{
"username": "string",
"password": "string"
}
Returns the JWT token as a plain text string on success, or "Nope" on failure.
curl -X POST /auth \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "secret"}'
# Response: eyJhbGciOiJIUzI1NiIs...
Authorization: Bearer <token>
/api/chat
Send a query and receive a complete JSON response. Requires JWT auth.
{
"query": "string (required)",
"query_context": ["filename1", "filename2"],
"config": {
"enableHistory": true,
"enableContext": true,
"searchContext": false,
"maxTokens": 500,
"temperature": 0.8,
"topP": 0.5,
"topK": 50
}
}
| Field | Type | Range | Default | Description |
|---|---|---|---|---|
maxTokens | int | 100–10000 | 500 | Maximum tokens in the response |
temperature | float | 0.0–5.0 | 0.8 | Controls randomness. Lower = focused, higher = creative |
topP | float | 0.0–5.0 | 0.5 | Nucleus sampling threshold |
topK | int | 1–100 | 50 | Number of top tokens to consider |
enableHistory | bool | — | true | Maintain conversation history |
enableContext | bool | — | true | Include corpus context with query |
searchContext | bool | — | false | Use keyword search to find relevant context |
{
"response": "The generated text...",
"config_applied": {
"maxTokens": 500,
"temperature": 0.8,
"topP": 0.5,
"topK": 50
}
}
/api/chat/stream
Same payload as /api/chat but returns a Server-Sent Events (SSE) stream. Tokens are delivered in real-time as they are generated.
Identical to /api/chat.
// Stream start — config acknowledgement
data: {"type": "start", "config_applied": {...}}
// Token chunks — sent as each token is generated
data: {"type": "chunk", "content": "token_text"}
// Stream complete
data: {"type": "complete"}
// Error during generation
data: {"type": "error", "message": "error description"}
Content-Type: text/event-stream
Cache-Control: no-cache
X-Accel-Buffering: no
Connection: keep-alive
/models
List available models and the currently active model.
{
"available": [
"mistralai/Ministral-3-14B-Reasoning-2512",
"mistralai/Ministral-3-14B-Instruct-2512",
...
],
"current": "mistralai/Ministral-3-14B-Reasoning-2512"
}
/models/switch
Switch the active model. This unloads the current model from GPU memory and loads the new one. Chat history is cleared.
{
"model": "mistralai/Mistral-7B-Instruct-v0.3"
}
{
"message": "Switched to mistralai/Mistral-7B-Instruct-v0.3",
"current": "mistralai/Mistral-7B-Instruct-v0.3"
}
/prompts
List available system prompts and the currently active one.
{
"available": {
"Friendly Label": "prompt_variable_name",
...
},
"current": "prompt_variable_name"
}
/prompts/switch
Switch the active system prompt. Chat history is cleared.
{
"prompt": "prompt_variable_name"
}
{
"message": "Switched to prompt_variable_name",
"current": "prompt_variable_name"
}
/list
List files available in the configured context directory. These can be attached to queries via the query_context field.
["file1.txt", "file2.md", ...]
/upload
Upload files to the context directory. Uses multipart/form-data.
.txt, .pdf, .png, .jpg, .jpeg, .gif
Content-Type: multipart/form-data
Field: uploads (multiple files)
{
"uploaded": ["file1.txt", "file2.pdf"]
}
The following server-side settings are defined in config.py and affect default behavior:
| Setting | Default | Description |
|---|---|---|
enable_history | True | Keep conversation history between turns |
enable_context | True | Include corpus context in prompts |
search_enginify_context | False | Use keyword search to find relevant context |
safeguards | False | Block generation when no context is found |
max_new_tokens | 2000 | Maximum response token length |
context_path | ./iran-censorship | Path to context file directory |
ALLOWED_EXTENSIONS | txt, pdf, png, jpg, jpeg, gif | Accepted upload file types |
/reset
Clear server-side conversation history. Requires JWT auth.
/ui or /
Serve the web UI (this page). No auth required.