Start a conversation to begin

Jink Hosting AI — API Documentation

This document describes all available API endpoints, their payloads, response formats, and configuration options for the Jink Hosting Generative Language Core API.

Base URL: Your deployment host (e.g. https://your-host:8000)
Auth: All endpoints except /auth and /ui require a JWT Bearer token.
Content-Type: application/json for all POST requests.

Authentication

POST
/auth

Authenticate and receive a JWT token. Use this token as a Bearer token in the Authorization header for all protected endpoints.

Request Payload

{
  "username": "string",
  "password": "string"
}

Response

Returns the JWT token as a plain text string on success, or "Nope" on failure.

Example:
curl -X POST /auth \
  -H "Content-Type: application/json" \
  -d '{"username": "admin", "password": "secret"}'

# Response: eyJhbGciOiJIUzI1NiIs...

Usage

Authorization: Bearer <token>

Chat (Non-Streaming)

POST
/api/chat

Send a query and receive a complete JSON response. Requires JWT auth.

Request Payload

{
  "query": "string (required)",
  "query_context": ["filename1", "filename2"],
  "config": {
    "enableHistory": true,
    "enableContext": true,
    "searchContext": false,
    "maxTokens": 500,
    "temperature": 0.8,
    "topP": 0.5,
    "topK": 50
  }
}

Config Field Details

FieldTypeRangeDefaultDescription
maxTokensint100–10000500Maximum tokens in the response
temperaturefloat0.0–5.00.8Controls randomness. Lower = focused, higher = creative
topPfloat0.0–5.00.5Nucleus sampling threshold
topKint1–10050Number of top tokens to consider
enableHistorybooltrueMaintain conversation history
enableContextbooltrueInclude corpus context with query
searchContextboolfalseUse keyword search to find relevant context

Response

{
  "response": "The generated text...",
  "config_applied": {
    "maxTokens": 500,
    "temperature": 0.8,
    "topP": 0.5,
    "topK": 50
  }
}

Streaming Chat (SSE)

POST
/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.

Request Payload

Identical to /api/chat.

SSE Event Format

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

Response Headers

Content-Type: text/event-stream
Cache-Control: no-cache
X-Accel-Buffering: no
Connection: keep-alive

Models

GET
/models

List available models and the currently active model.

Response

{
  "available": [
    "mistralai/Ministral-3-14B-Reasoning-2512",
    "mistralai/Ministral-3-14B-Instruct-2512",
    ...
  ],
  "current": "mistralai/Ministral-3-14B-Reasoning-2512"
}
POST
/models/switch

Switch the active model. This unloads the current model from GPU memory and loads the new one. Chat history is cleared.

Request Payload

{
  "model": "mistralai/Mistral-7B-Instruct-v0.3"
}

Response

{
  "message": "Switched to mistralai/Mistral-7B-Instruct-v0.3",
  "current": "mistralai/Mistral-7B-Instruct-v0.3"
}

Prompts

GET
/prompts

List available system prompts and the currently active one.

Response

{
  "available": {
    "Friendly Label": "prompt_variable_name",
    ...
  },
  "current": "prompt_variable_name"
}
POST
/prompts/switch

Switch the active system prompt. Chat history is cleared.

Request Payload

{
  "prompt": "prompt_variable_name"
}

Response

{
  "message": "Switched to prompt_variable_name",
  "current": "prompt_variable_name"
}

Context Files

GET
/list

List files available in the configured context directory. These can be attached to queries via the query_context field.

Response

["file1.txt", "file2.md", ...]

File Upload

POST
/upload

Upload files to the context directory. Uses multipart/form-data.

Allowed File Types

.txt, .pdf, .png, .jpg, .jpeg, .gif

Request

Content-Type: multipart/form-data
Field: uploads (multiple files)

Response

{
  "uploaded": ["file1.txt", "file2.pdf"]
}

Configuration Reference

The following server-side settings are defined in config.py and affect default behavior:

SettingDefaultDescription
enable_historyTrueKeep conversation history between turns
enable_contextTrueInclude corpus context in prompts
search_enginify_contextFalseUse keyword search to find relevant context
safeguardsFalseBlock generation when no context is found
max_new_tokens2000Maximum response token length
context_path./iran-censorshipPath to context file directory
ALLOWED_EXTENSIONStxt, pdf, png, jpg, jpeg, gifAccepted upload file types

Utility Endpoints

GET
/reset

Clear server-side conversation history. Requires JWT auth.

GET
/ui or /

Serve the web UI (this page). No auth required.