Singularity exposes an HTTP API on port 8450 for programmatic interaction.
http://localhost:8450
In production, accessed via reverse proxy or Cloudflare Tunnel.
GET /health
Returns runtime health status.
Response:
{
"status": "ok",
"runtime": "singularity",
"uptime": 3620.2,
"totalRequests": 42,
"totalErrors": 0,
"pendingRequests": 1,
"timestamp": 1773390726.61
}| Field | Type | Description |
|---|---|---|
status |
string | "ok" or "degraded" |
runtime |
string | Always "singularity" |
uptime |
float | Seconds since start |
totalRequests |
int | Total requests served |
totalErrors |
int | Total error responses |
pendingRequests |
int | Currently processing |
timestamp |
float | Unix timestamp |
POST /api/v1/chat
Content-Type: application/json
Send a message to Singularity and receive a response.
Request Body:
{
"message": "What is the current system status?",
"context": {
"user_id": "193011943382974466",
"channel": "api",
"source": "erp"
}
}| Field | Type | Required | Description |
|---|---|---|---|
message |
string | Yes | The user message |
context.user_id |
string | No | Discord user ID for identity |
context.channel |
string | No | Source channel identifier |
context.source |
string | No | Integration source (e.g., "erp", "api") |
Response:
{
"response": "All systems operational. 11 POAs active, 0 degraded.",
"metadata": {
"iterations_used": 3,
"tools_called": ["poa_manage"],
"processing_time_ms": 2450
}
}| Field | Type | Description |
|---|---|---|
response |
string | Singularity's response text |
metadata.iterations_used |
int | Agent loop iterations consumed |
metadata.tools_called |
array | Tools invoked during processing |
metadata.processing_time_ms |
int | Total processing time |
Error Response:
{
"error": "Internal processing error",
"code": 500
}The Artifact ERP backend integrates via this API:
// backend/src/config/ai.ts
const response = await fetch('http://localhost:8450/api/v1/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
message: userMessage,
context: {
user_id: userId,
channel: 'erp-chat',
source: 'artifact-erp'
}
})
});
const data = await response.json();
return data.response;# Health check
curl http://localhost:8450/health
# Chat
curl -X POST http://localhost:8450/api/v1/chat \
-H "Content-Type: application/json" \
-d '{"message": "Run a system status check"}'import httpx
async with httpx.AsyncClient() as client:
resp = await client.post(
"http://localhost:8450/api/v1/chat",
json={"message": "What POAs are active?"}
)
print(resp.json()["response"])No hard rate limits are enforced at the API level. Each request consumes agent loop iterations (typically 3-15 per request depending on complexity). The LLM provider chain may impose its own rate limits.
The HTTP API does not currently implement authentication. It is designed to be accessed only from trusted internal services (localhost or private network). In production, access control is enforced at the reverse proxy / tunnel layer.
See Configuration for port settings, Deployment for reverse proxy setup.