v1.0 Live
Colide API

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.

Updated 2 days ago 2.1k monthly reads 14 min read SSE streaming

Introduction

SSE Streaming
Tokens arrive in real time via Server-Sent Events. Responses stream as {"token":"..."} events, ending with a {"done":true,...} event.
Dual Agent Mode
Autonomous control for both Minecraft servers and DevSpace Docker containers via structured action lists. Auto-detected from server type.
Vision + History
Multi-turn conversations with persistent session history and optional image input — PNG, JPEG, WebP, HEIC/HEIF.
Session Management
Create named sessions, load up to 30 messages of history. Session ID scopes all conversation context.
Dataset Exact Match
Before calling the AI model, the gateway checks shulker_dataset.json for exact matches — returning instant answers when found.
Dual Auth
API key for external/programmatic access. Session cookie for panel users — the only method that enables Agent Mode.
POST https://shulker.in/api/colide_api_gateway-v1.0/ SSE

Single endpoint — all interactions go here via HTTP POST. Responses are streamed via SSE.

Streaming Response

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.

API Key
External / programmatic

Pass your key as the token query parameter. Quota is enforced per-key with daily and monthly limits.

URL
POST .../colide_api_gateway-v1.0/
  ?token=YOUR_API_KEY

Get your key from AI Studio → Dashboard.

Session Auth
Shulker panel login

No token param needed. Your active PHP session cookie is sent automatically. Quota is enforced per user account.

cURL
POST .../colide_api_gateway-v1.0/
  # Session cookie sent automatically

Required for Agent Mode (Minecraft & DevSpace).

Getting Your API Key

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

Free Tier
Default for all API keys
Daily limit800 tokens
Monthly limit25,000 tokens
Paid Tiers
Configurable via AI Studio
Daily limitCustom
Monthly limitCustom

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
Token Counting Method

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/
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]
Content-Type

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.
At Least One Required

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
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
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"
Conversation History

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.

Dataset Exact Match

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.

GET .../?action=create_session&session_name=MyChat&token=YOUR_API_KEY

Query Parameters

ParameterTypeRequiredDescription
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
curl "https://shulker.in/api/
colide_api_gateway-v1.0/
?action=create_session
&session_name=MyChat
&token=YOUR_API_KEY"

Session auth

cURL

Response — 201 Created

JSON
{
  "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"
}
Using the session_id

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.

Session Auth Required

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 — Session Auth
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.

Server Control
start_server stop_server restart_server
Software Installation
install_software:paper:1.20.4

Types: paper, vanilla, purpur, arclight, bungeecord, folia, leaf, nukkit, velocity, waterfall
Versions: 1.12 – 1.21.11

File Management
delete_file:/path/to/file read_file_content:/path/file list_directory:/path/dir edit_file:/path|line:N|new_content:…
Settings & Java
change_server_settings:key=val,… change_java_version:java21 change_startup_command_type:normal

Java versions: java8, java11, java16, java17, java21

Console & Backup
execute_console_command:tps create_backup:/backups/file.zip
Presets
install_preset:PRESET_ID

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

JSON action block
{
  "actions": [
    "list_directory:/plugins/P",
    "read_file_content:/plugins/P/config.yml",
    "reply_with_readable_data"
  ]
}

Step 2 — Edit phase

JSON action block
{
  "actions": [
    "edit_file:/plugins/P/config.yml
    |line:15|new_content:  enabled: true",
    "restart_server"
  ]
}
Server Status Awareness

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.

Auto-Detected

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

Container Control
start_container stop_container restart_container
Terminal
execute_command:npm install execute_command:python3 app.py

Long-running commands show live output. Only port 8080 is available in the container.

File Management
read_file:/path/file write_file:/path/file|content:… list_directory:/path/dir delete_file:/path/file create_folder:/path/dir rename_file:/old|/new
Startup & Ports
set_startup_command:python3 app.py set_startup_type:default|custom|script forward_port:8080|myapp.shulker.in
Context Injected

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

SSE — one per generated token
data: {"token": "Hello"}

data: {"token": " world"}

data: {"token": "!"}

Done Event

SSE — final event, always sent
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

SSE — if AI service fails
data: {"error": "Colide API service unavailable"}

JavaScript SSE Client

JavaScript
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.

Minecraft Servers

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.

DevSpace Containers

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 — File Data Callback
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

JSON
[
  {
    "file_path": "/plugins/MyPlugin/config.yml",
    "content":   "full file text here...",
    "lines":     42
  }
]
Response Format

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

done
boolean
Always
Always true in the final event.
usage
object
Always
Word counts: input_words, output_words, total_words.
agent_mode
boolean
Agent only
Always true when agent mode was active.
is_devspace
boolean
Agent only
true if target is DevSpace/Container; false for Minecraft.
server
object
Agent only
Server metadata: name, node, status, is_online.
detected_actions
array
Agent only
Parsed action strings extracted from Colide's JSON block. Empty array if no actions.
needs_file_callback
boolean
Agent only
true when reply_with_readable_data was in the action list.
file_contents
array
Agent only
Pre-fetched file content objects (Minecraft only). Empty for DevSpace.

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.

Non-streaming error format
{ "error": "Human-readable message" }
400 Bad Request
Missing message/image_content; missing server_name with agent mode; invalid file_contents JSON.
401 Unauthorized
Invalid or missing API key; user session not active.
403 Forbidden
API key subscription expired (downgraded to free); attempting agent mode with API key auth.
404 Not Found
User not found; server not found or access denied; node not resolved from working directory.
405 Method Not Allowed
Request method is not POST. Only POST is accepted.
429 Rate Limited
Daily quota reached (resets in 24h) or monthly quota reached (purchase tokens).
500 Server Error
Database connection error; uncaught PHP exception. Check status page.
503 Service Unavailable
All Gemini API keys failed or upstream AI service unreachable.

Code Examples

JavaScript — Streaming (fetch)

JavaScript
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)

Python
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

Python
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

PHP
$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