Colide API Gateway
The official AI interface built by ColideLabs — powering intelligent conversations, session management, autonomous Minecraft server control, and DevSpace container management. All on Shulker infrastructure.
Introduction
{"token":"..."} events, ending with a {"done":true,...} event.shulker_dataset.json for exact matches — returning instant answers when found.Single endpoint — all interactions go here via HTTP POST. Responses are streamed via SSE.
This API streams responses using Server-Sent Events (SSE). Each token is sent as
data: {"token": "..."}. The stream ends with
data: {"done": true, ...} containing usage stats, agent metadata, and detected actions.
Clients must consume the response as a stream — not a single JSON blob.
Authentication
Two authentication methods are supported. API key is for programmatic/external access. Session authentication is used from within the Shulker panel and is the only method that supports Agent Mode.
Pass your key as the token query parameter. Quota is enforced per-key with daily and monthly limits.
POST .../colide_api_gateway-v1.0/
?token=YOUR_API_KEY
Get your key from AI Studio → Dashboard.
No token param needed. Your active PHP session cookie is sent automatically. Quota is enforced per user account.
POST .../colide_api_gateway-v1.0/
# Session cookie sent automatically
Required for Agent Mode (Minecraft & DevSpace).
Log in to the Shulker panel and go to Dashboard → AI Studio at /panel/dashboard/ai-studio. Create, view, and manage keys with configurable quotas.
Rate Limits & Quotas
Quotas are enforced at two levels: daily (resets every 24 hours) and monthly (resets every 30 days). Tokens are counted as approximate word counts (whitespace-delimited) of input and output text, after stripping HTML tags.
API Key Tiers
When a paid subscription expires, the key is automatically downgraded to Free tier.
Session User Quotas
| Field | DB Column | Default | Reset |
|---|---|---|---|
| Daily Limit | colide_total_daily_tokens | 2 000 | Every 24 hours |
| Used Tokens | colide_total_used_tokens | 0 | Resets after 24 h |
Tokens are counted as approximate word counts (whitespace-delimited), after stripping HTML. Both the input message and the full streamed output are counted. This is an approximation — actual LLM token usage may differ.
Endpoint Overview
A single endpoint handles all Colide interactions. Behavior is controlled via URL query parameters; payload is sent in the POST body.
POST /api/colide_api_gateway-v1.0/ ?token=YOUR_API_KEY # required (or active session cookie) &session_id=123 # optional — load conversation history &agent_mode=on # optional — activate agent mode &server_name=my-server # required when agent_mode=on # POST body — multipart/form-data or x-www-form-urlencoded message=Your message here image_content=[optional file upload or raw binary]
Accepts both multipart/form-data (required when sending images as file uploads) and application/x-www-form-urlencoded (text-only requests).
Request Parameters
Query Parameters (URL)
| Parameter | Type | Required | Description |
|---|---|---|---|
| token | string | Optional* | Your Colide API key. Required unless using session authentication. |
| session_id | integer | Optional | Session ID to load the last 30 messages as conversation context. Omit or set to 0 for a fresh conversation. |
| agent_mode | string | Optional | Set to "on" to activate Agent Mode. Requires session auth + server_name. Auto-detects Minecraft vs DevSpace type. |
| server_name | string | Conditional | Name of the target server or container. Required when agent_mode=on. |
POST Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| message | string | Required* | The user's text message. Required unless image_content is provided alone. |
| image_content | file / string | Optional | Image to include with the message. Either a file upload (multipart/form-data) or raw binary/base64. Supported: PNG, JPEG, WebP, HEIC, HEIF. |
| file_data_callback | string | Optional | Set to "true" to indicate this is a file data callback from a previous agent action. See File Callback. |
| file_contents | JSON string | Conditional | JSON-encoded array of file content objects. Required when file_data_callback=true. |
Either message or image_content must be present (or file_data_callback=true). Requests with none of these return 400.
Normal Mode
Standard conversational mode. Colide responds to text and/or image input, maintaining context via session_id.
On the first message of a session, user metadata and the Shulker knowledge dataset are automatically injected into the system context.
If an exact match is found in the dataset, the response is returned immediately without calling the AI model.
Basic text request
curl -X POST \ "https://shulker.in/api/colide_api_gateway-v1.0/ ?token=YOUR_API_KEY&session_id=101" \ -F "message=What is Shulker?"
With image
curl -X POST \ "https://shulker.in/api/ colide_api_gateway-v1.0/?token=KEY" \ -F "message=What does this error mean?" \ -F "image_content=@/path/to/shot.png"
Up to the last 30 messages (both roles) are loaded from the session and sent as context. Messages are stored in colide_message_data and replayed chronologically.
Before calling the AI model, the gateway checks shulker_dataset.json for an exact (case-insensitive) match. If found, the dataset value is returned immediately as a single SSE token event.
Session Management
Sessions store conversation history and allow multi-turn conversations. Create a session first, then pass its session_id to all subsequent POST requests.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| action | string | Required | Must be create_session. |
| session_name | string | Required | A human-readable label for the session (e.g. My Chat). |
| token | string | Optional* | Your API key. Required unless using session authentication. The session owner will be set to the API key value. |
API key auth
curl "https://shulker.in/api/ colide_api_gateway-v1.0/ ?action=create_session &session_name=MyChat &token=YOUR_API_KEY"
Session auth
curl "https://shulker.in/api/ colide_api_gateway-v1.0/ ?action=create_session &session_name=MyChat" \ --cookie "PHPSESSID=your_id"
Response — 201 Created
{
"success": true,
"session_id": 42,
"session_name": "MyChat",
"session_owner": "sk-abc123…", // API key or gosyntech_id
"created_at": "2025-01-01 12:00:00"
}
Pass the returned session_id as the session_id query parameter on all subsequent POST requests to load conversation history and maintain context across turns.
Agent Mode minecraft
When agent_mode=on and the target is a Minecraft server, the gateway fetches live console logs (last 1000 lines), resource metrics, allocated ports, and available presets — providing Colide with a rich context and an action vocabulary to autonomously manage the server.
Agent Mode requires an active session (panel login). API key auth will return 403. The user must own or have shared access to the target server.
curl -X POST \ "https://shulker.in/api/colide_api_gateway-v1.0/ ?agent_mode=on&server_name=my-server" \ --cookie "PHPSESSID=your_session_id" \ -F "message=My server is lagging. Check the logs and fix it."
Available Actions
When Colide determines actions are needed, it appends a JSON block at the end of its response. The gateway extracts this and returns the parsed list in detected_actions.
Types: paper, vanilla, purpur, arclight, bungeecord, folia, leaf, nukkit, velocity, waterfall
Versions: 1.12 – 1.21.11
Java versions: java8, java11, java16, java17, java21
After preset install, automatically adds matching software update and Java version actions.
File Read Workflow (reply_with_readable_data)
When Colide needs to inspect files before making changes, it uses a two-step pattern:
Step 1 — Read phase
{
"actions": [
"list_directory:/plugins/P",
"read_file_content:/plugins/P/config.yml",
"reply_with_readable_data"
]
}
Step 2 — Edit phase
{
"actions": [
"edit_file:/plugins/P/config.yml
|line:15|new_content: enabled: true",
"restart_server"
]
}
The agent prompt includes live server status. If the server is Online, Colide includes stop_server before file modifications. If Offline, stop_server is omitted. This prevents unsafe concurrent modifications.
DevSpace Agent Mode New
When agent_mode=on and the target server is of type Container, DevSpace-Project, or DevSpace, the gateway automatically switches to the DevSpace agent prompt. This mode enables full Docker container management — file I/O, terminal commands, port forwarding, and startup config.
No extra parameter is required. The gateway detects the server type from the database and selects the appropriate agent prompt. The done event includes "is_devspace": true so clients can differentiate.
DevSpace Available Actions
Long-running commands show live output. Only port 8080 is available in the container.
The DevSpace agent prompt automatically includes: container status (running/stopped), Docker image, CPU/RAM usage, uptime, and a listing of the root directory — so Colide always has current context before acting.
Streaming (SSE) New
All responses are streamed using Server-Sent Events. The response Content-Type is text/event-stream. Nginx buffering is disabled via the X-Accel-Buffering: no header.
Token Event
data: {"token": "Hello"}
data: {"token": " world"}
data: {"token": "!"}
Done Event
data: {
"done": true,
"usage": {
"input_words": 12,
"output_words": 84,
"total_words": 96
},
// agent_mode only fields:
"agent_mode": true,
"is_devspace": false,
"server": { "name": "my-server", "node": "node-us", ... },
"detected_actions": ["stop_server", "restart_server"],
"needs_file_callback": false,
"file_contents": []
}
Error Event
data: {"error": "Colide API service unavailable"}
JavaScript SSE Client
const formData = new FormData(); formData.append('message', 'Hello Colide!'); const response = await fetch( 'https://shulker.in/api/colide_api_gateway-v1.0/?token=YOUR_API_KEY', { method: 'POST', body: formData } ); const reader = response.body.getReader(); const decoder = new TextDecoder(); let fullText = ''; while (true) { const { done, value } = await reader.read(); if (done) break; const chunk = decoder.decode(value); for (const line of chunk.split('\n')) { if (!line.startsWith('data: ')) continue; const ev = JSON.parse(line.slice(6)); if (ev.token) { fullText += ev.token; /* update UI */ } if (ev.done) console.log('Done!', ev.usage, ev.detected_actions); if (ev.error) console.error('Error:', ev.error); } }
File Callback New
When a Minecraft agent response includes reply_with_readable_data, the gateway signals via the done event that a follow-up request is needed. For Minecraft servers, file contents are pre-fetched server-side. For DevSpace containers, the frontend fetches files and sends them back.
File contents are fetched server-side during the request. The done event includes file_contents array and needs_file_callback: true. The client sends these back via a callback request.
File fetching is handled by the frontend. When needs_file_callback: true, the client collects file/directory data and sends a callback request with the file_data_callback POST parameter.
Callback Request
curl -X POST \ "https://shulker.in/api/colide_api_gateway-v1.0/ ?agent_mode=on&server_name=my-server&session_id=101" \ --cookie "PHPSESSID=your_session_id" \ -F "file_data_callback=true" \ -F 'file_contents=[{"file_path":"/plugins/P/config.yml", "content":"enabled: true\n...","lines":42}]'
file_contents array schema
[
{
"file_path": "/plugins/MyPlugin/config.yml",
"content": "full file text here...",
"lines": 42
}
]
File callback requests do not use SSE — they return a standard JSON response with response, usage, agent_mode: true, file_callback: true, and detected_actions.
Response Format
Normal requests stream SSE events. The final done event carries all metadata. File callback requests return a standard JSON object (no SSE).
Done Event Fields
true in the final event.input_words, output_words, total_words.true when agent mode was active.true if target is DevSpace/Container; false for Minecraft.name, node, status, is_online.true when reply_with_readable_data was in the action list.Error Codes
Non-streaming errors are returned as plain JSON before the SSE stream starts. Streaming errors appear as data: {"error": "…"} within the event stream.
{ "error": "Human-readable message" }
message/image_content; missing server_name with agent mode; invalid file_contents JSON.POST. Only POST is accepted.Code Examples
JavaScript — Streaming (fetch)
const formData = new FormData(); formData.append('message', 'What is Shulker?'); const res = await fetch( 'https://shulker.in/api/colide_api_gateway-v1.0/?token=YOUR_API_KEY&session_id=1', { method: 'POST', body: formData } ); const reader = res.body.getReader(); const decoder = new TextDecoder(); let output = ''; while (true) { const { done, value } = await reader.read(); if (done) break; for (const line of decoder.decode(value).split('\n')) { if (!line.startsWith('data: ')) continue; const ev = JSON.parse(line.slice(6)); if (ev.token) { output += ev.token; process.stdout.write(ev.token); } if (ev.done) console.log('\nDone', ev.usage); if (ev.error) console.error(ev.error); } }
Python — Streaming (requests)
import requests, json url = "https://shulker.in/api/colide_api_gateway-v1.0/" params = {"token": "YOUR_API_KEY", "session_id": 1} with requests.post(url, params=params, data={"message": "What is Shulker?"}, stream=True) as r: for raw_line in r.iter_lines(): if not raw_line: continue line = raw_line.decode() if not line.startswith("data: "): continue ev = json.loads(line[6:]) if "token" in ev: print(ev["token"], end="", flush=True) if ev.get("done"): print("\nDone!", ev["usage"]) if "error" in ev: print("Error:", ev["error"])
Python — With Image
import requests, json with open("screenshot.png", "rb") as f: r = requests.post( "https://shulker.in/api/colide_api_gateway-v1.0/", params={"token": "YOUR_API_KEY"}, data={"message": "What does this error mean?"}, files={"image_content": ("screenshot.png", f, "image/png")}, stream=True ) for raw in r.iter_lines(): if raw and raw.decode().startswith("data: "): ev = json.loads(raw.decode()[6:]) if "token" in ev: print(ev["token"], end="", flush=True)
PHP — cURL with SSE
$ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => "https://shulker.in/api/colide_api_gateway-v1.0/?token=YOUR_API_KEY", CURLOPT_POST => true, CURLOPT_POSTFIELDS => ["message" => "What is Shulker?"], CURLOPT_RETURNTRANSFER => true, CURLOPT_WRITEFUNCTION => function($ch, $chunk) { foreach (explode("\n", $chunk) as $line) { if (str_starts_with($line, "data: ")) { $ev = json_decode(substr($line, 6), true); if (isset($ev['token'])) echo $ev['token']; } } return strlen($chunk); } ]); curl_exec($ch); curl_close($ch);
Quick Reference
?token=KEY
API key authentication
?token=KEY&session_id=N
Continue conversation with last 30 messages
POST body: message=text
Send a text message
POST body: [email protected]
Attach an image (PNG/JPEG/WebP/HEIC)
?agent_mode=on&server_name=X
Activate agent mode (session auth only). Auto-detects Minecraft vs DevSpace.
done.detected_actions[]
Parsed action list extracted from agent response
done.needs_file_callback
If true, send file contents back via callback
done.is_devspace
true = DevSpace/Container; false = Minecraft
done.usage.total_words
Total word count charged against quota