Syllogy API v1
New users receive promo credits while the promotion is active. Bitcoin Lightning top‑ups are available now via admin endpoints. Track your activity on the Usage page.
All endpoints use JSON over HTTPS.
- Browser: cookie
api_key=… (set after OTP login)
- Server / scripts: header
Authorization: Bearer sk-sy-… (Base64URL payload)
Management endpoints require an admin key (your session key or a special admin API key). Keys you create via the API are non-admin and are valid for /api/v1/chat/completions only.
Models
| GET | /api/v1/models | List available model IDs (OpenAI-compatible format) |
Response example
{
"object": "list",
"data": [ { "id": "mistral-7b", "object": "model" } ]
}
Auth
| POST | /api/v1/auth/otp | Send one-time code to email |
| Body {"email":"user@example.com"} |
| POST | /api/v1/auth/login | Exchange OTP ⇢ session / API key |
| Body {"email":"…","otp":"123456","type":"web|api"} |
Chat Completions
| POST | /api/v1/chat/completions | Non-streaming or streaming (SSE) responses via request body |
Request schema
{
"model": "model-id", // required; see GET /api/v1/models
"messages": [ // ≤ 64 items
{ "role": "system", "content": "…" },
{ "role": "user", "content": "…" }
],
"stream": true, // optional; set true for SSE stream
"max_tokens": 256, // optional; if omitted, server allows the
// maximum generation tokens the model can
// fit given the current prompt/context
"tools": […], // optional; OpenAI tool schema
"tool_choice": … // optional; tool selection
}
curl examples
# Non-streaming
curl -s \
-H "Authorization: Bearer $SYLLOGY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model":"mistral-7b",
"messages":[{"role":"user","content":"Hello"}]
}' \
https://syllogy.ai/api/v1/chat/completions | jq -r '.choices[0].message.content'
# Streaming (SSE)
curl -sN \
-H "Authorization: Bearer $SYLLOGY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model":"mistral-7b",
"stream":true,
"messages":[{"role":"user","content":"Write a haiku"}]
}' \
https://syllogy.ai/api/v1/chat/completions | sed -n 's/^data: //p'
Streaming uses text/event-stream with data: {json} lines ending in [DONE], matching OpenAI SSE format.
Account
| GET | /api/v1/account/info | Email, credits, timestamps (admin only) |
| POST | /api/v1/account/logout | Invalidate current session / delete current key (admin only) |
API Key Management
| GET | /api/v1/keys/list | List your API keys (admin only) |
| POST | /api/v1/keys/new | Create new non-admin API key (admin only) |
| POST | /api/v1/keys/delete | Delete key Body {"key_hash":"…"} (admin only) |
Lightning Invoices
| POST | /api/v1/invoice/get | Get or create a 0‑amount BOLT11 invoice for the admin key’s user (admin only) |
| No body → Response {"r_hash":"…","bolt11":"lnbc…","expires_at":1721000000} |
| GET | /api/v1/invoice/list?offset=0 | List invoices (paginated, max 200 per page) (admin only) |
| Response [{"r_hash":"…","sats":123,"settled_at":1721000000}, …] |
Invoice semantics
- Only one pending invoice (msats=0) exists per user email at a time. Repeated
/invoices/get returns the same BOLT11 until it’s paid or expires.
- Background polling settles paid invoices (sets
msats, settled_at) and credits the user with msats / 1000 (floored). Expired, unpaid invoices are deleted.
/invoices/list returns sats as floor(msats/1000) and settled_at as a Unix timestamp. Use offset for pagination.
curl examples (admin key)
# Get or create a 0-amount invoice (derived from the admin key's user)
curl -s \
-H "Authorization: Bearer $ADMIN_API_KEY" \
-X POST \
https://syllogy.ai/api/v1/invoice/get | jq
# List invoices (200 per page), offset 0
curl -s \
-H "Authorization: Bearer $ADMIN_API_KEY" \
'https://syllogy.ai/api/v1/invoice/list?offset=0' | jq
Rate limit: 1 req/sec per IP plus a global cap. Exceeding returns HTTP 429.