Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Evincere/klisk/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Klisk’s production server exposes a REST API for programmatic access to your agent:- POST /api/chat — Send messages, get responses
- GET /api/info — Get agent metadata
- GET /health — Health check endpoint
Quick Example
Authentication
API Key Setup
Set an API key in your.env file:
.env
Supported Environment Variables
Primary API key for all endpoints
Alternative key specifically for
/api/chat and /ws/chatAlternative key for widget authentication
If any of these variables is set, authentication is required for all requests. The server accepts any of the configured keys.
Making Authenticated Requests
Include the API key in theAuthorization header:
401 Unauthorized
POST /api/chat
Send a message to your agent and receive a response.Request Body
The user message to send to the agent
Whether to stream the response (SSE) or return complete response
Conversation state from previous response (for multi-turn conversations)
Specific agent to use (if multiple agents defined). Defaults to first agent.
Array of file attachments (images, PDFs). Each attachment should have:
mime_type(string): MIME type (e.g.,image/jpeg,application/pdf)data(string): Base64-encoded file dataname(string): Filename
Non-Streaming Response
Request:The complete agent response text
Conversation state to pass in subsequent requests
Whether the response is complete (always
true for non-streaming)Streaming Response (SSE)
Request:Event Types
Text token from the agent responseFields:
type:"token"data: Text content (string)
Reasoning/thinking from reasoning models (o-series, gpt-5+)Fields:
type:"thinking"data: Reasoning text (string)
Tool call initiated by the agentFields:
type:"tool_call"data:tool(string): Tool namearguments(string): JSON string of argumentsstatus(string):"running"
Tool execution resultFields:
type:"tool_result"data:output(string): Tool output
Response completeFields:
type:"done"data: Complete response text (string)response_id: OpenAI response ID for conversation continuity (string, optional)
Error occurredFields:
type:"error"data: Error message (string)
Multi-Turn Conversations
Pass thestate from the previous response to maintain conversation context:
File Attachments
Send images or PDFs with your message:- Images:
image/jpeg,image/png,image/gif,image/webp - Documents:
application/pdf
WebSocket Endpoint
For real-time bidirectional communication, use the WebSocket endpoint:Authentication
Pass the API key as a query parameter:4001.
Sending Messages
Send JSON messages to the WebSocket:Receiving Events
Receive the same event types as the SSE stream:Clearing Conversation
Reset the conversation state:Example: JavaScript Client
GET /api/info
Get metadata about the deployed agent. Request:Project name from
klisk.config.yamlDefault agent name (first agent if multiple defined)
Whether API key authentication is enabled
GET /health
Health check endpoint for monitoring. Request:200 OK
The
/health endpoint does not require authentication, even when KLISK_API_KEY is set.Example Integrations
Python
Non-Streaming
Streaming (SSE)
JavaScript (Node.js)
Non-Streaming
Streaming (SSE)
cURL with Streaming
-N flag disables buffering to see events in real-time.
Rate Limiting
Klisk does not implement built-in rate limiting. For production deployments, consider:- Cloud Run: Configure max instances to limit concurrency
- API Gateway: Use Google Cloud API Gateway or similar
- Nginx: Add rate limiting in reverse proxy
CORS
CORS is enabled for all origins by default:Error Handling
HTTP Status Codes
200 OK— Request successful401 Unauthorized— Invalid or missing API key500 Internal Server Error— Server error
Error Response Format
Non-streaming errors:Common Errors
No agents loaded:Next Steps
Production Server
Learn about klisk serve configuration
Deploy to Cloud Run
Deploy your API to production