LAYIGE // SHERLOCK5

Developers

API Reference

Base URL https://api.layige.org. All inference endpoints require a bearer token from /auth/login. Requests are metered in credits; failed or degraded requests are not charged. No prompt or response text is ever stored server-side.

Authentication

POST/auth/register

Create an account. Rate-limited per IP.

curl -X POST https://api.layige.org/auth/register \
  -H 'Content-Type: application/json' \
  -d '{"email":"you@org.com","password":"at-least-8-chars"}'
# -> { "token": "<jwt>", "email_verified": false }
POST/auth/login
curl -X POST https://api.layige.org/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"email":"you@org.com","password":"..."}'
# -> { "token": "<jwt>" }

Chat

POST/v1/chat/completions· Bearer JWT

OpenAI-shaped. memory (client-side notes) and strategy are optional; omit strategy to auto-route.

curl -X POST https://api.layige.org/v1/chat/completions \
  -H "Authorization: Bearer $JWT" -H 'Content-Type: application/json' \
  -d '{
    "messages": [{"role":"user","content":"Write a prime sieve in Python"}],
    "strategy": "specialists",
    "memory": { "notes": ["User prefers terse answers"] }
  }'
# -> { "choices":[{"message":{"role":"assistant","content":"..."}}],
#      "usage":{"credit_cost":10,"credits_remaining":90,"latency_ms":812.3} }

Vision

POST/v1/vision/analyze· Bearer JWT

Multipart image upload (≤ 8 MB). Processed in memory, never stored.

curl -X POST https://api.layige.org/v1/vision/analyze \
  -H "Authorization: Bearer $JWT" \
  -F file=@chart.png -F prompt="Extract the data table"
# -> { "analysis": "...", "credit_cost": 2, "credits_remaining": 88 }

Account & billing

GET/v1/account· Bearer JWT
curl https://api.layige.org/v1/account -H "Authorization: Bearer $JWT"
# -> { "user_id": 1, "tier": "pro", "credits": 88 }
POST/billing/checkout· Bearer JWT

Returns a Stripe Checkout URL to top up credits.

# -> { "checkout_url": "https://checkout.stripe.com/..." }

System

GET/v1/system/health

Backend liveness + per-GPU VRAM + air-gap flag. No auth.

GET/v1/system/license

On-prem license validity (Ed25519 signature check).

Pricing (credits / successful request)

TierCreditsWhat
low-gear1quick answers (fast model)
vision / grounding2image analysis, web lookup
pipeline5standard coding/answers
council10specialists, debate, vote, decompose

Errors

StatusMeaning
401missing / invalid bearer token
402insufficient credits
403strategy not allowed on your tier (e.g. council on free)
413payload too large
429rate limit exceeded (per-IP or per-account)