thairouter
Reference

API reference

Everything the gateway serves, in one place.

Base URL & CORS

PrefixAuthCORSPurpose
https://api.thairouter.ai/v1API keyany origin, no credentialsOpenAI-compatible surface
https://api.thairouter.ai/publicnoneany originRead-only, aggregate catalog data
https://api.thairouter.ai/healthnoneLiveness

The dashboard, auth and Stripe routes (/dashboard, /api/auth, /admin, /stripe) are session-authenticated for the web app and are not part of the public API.

Chat completions

POST/v1/chat/completionsBearer sk-tr-…

Create a completion, optionally streamed. Full guide: Chat completions.

FieldTypeDescription
modelrequiredstringLive ThaiRouter model id.
messagesrequiredarrayNon-empty chat history.
max_tokensintegerOmitted = full output budget. Clamped to the model cap and context room.
reasoning_effort / reasoningstring / objectThinking level and exclude. See Reasoning.
streambooleanSSE with a final usage chunk.Default false.
anyOther OpenAI fields forwarded as-is. See Parameters.

Responds 200 with a chat completion (plus thairouter.usage_id, thairouter.cost and thairouter.reasoning_effort), or text/event-stream with x-thairouter-usage-id and x-thairouter-reasoning-effort headers. Errors: Errors.

List models

GET/v1/modelsBearer sk-tr-…

Live models only, OpenAI list shape with context_length, max_output_tokens, pricing, reasoning (levels, default, whether it can be switched off; null if none) and supported_parameters added.

{
  "object": "list",
  "data": [
    { "id": "thairouter/glm-5.3-flash", "object": "model", "created": 0, "owned_by": "thairouter",
      "context_length": 393216, "max_output_tokens": 131072,
      "pricing": { "promptPerMillion": 5, "completionPerMillion": 15 },
      "reasoning": { "efforts": ["low", "high", "max"], "default": "max", "optional": false },
      "supported_parameters": ["max_tokens", "temperature", "top_p", "stop", "seed", "frequency_penalty",
        "presence_penalty", "response_format", "stream", "reasoning", "reasoning_effort"] }
  ]
}

Public catalog

GET/public/modelsno auth

Every model, including coming-soon ones, with the full catalog entry (description, tags, benchmarks), all-time aggregate stats and a 7-day performance snapshot. Cached for 60 s.

{
  "models": [
    {
      "id": "thairouter/glm-5.3-flash",
      "name": "GLM 5.3 Flash",
      "provider": { "id": "zai", "name": "Z.ai", "url": "https://z.ai" },
      "status": "live",
      "contextLength": 393216,
      "maxOutputTokens": 131072,
      "pricing": { "promptPerMillion": 5, "completionPerMillion": 15 },
      "tags": ["open-weights", "reasoning", "long-context"],
      "stats": { "requests": 1234, "tokens": 5678901, "lastUsedAt": "2026-09-10T08:00:00.000Z" },
      "perf": {
        "windowDays": 7, "requests": 800, "errors": 3, "successRate": 0.996,
        "latencyP50Ms": 1450, "latencyP95Ms": 6200, "tokensPerSec": 62.4
      }
    }
  ]
}

perf is null when a model had no traffic in the window.

Public activity

GET/public/activity?model=thairouter/glm-5.3-flash&days=30no auth
FieldTypeDescription
modelrequiredquery stringAny catalog id. Unknown ids return 404.
daysquery integer1 to 90.Default 30.

Daily aggregates across all users. Days with no traffic are filled with zeros. Cached for 5 minutes.

{
  "model": "thairouter/glm-5.3-flash",
  "days": 30,
  "series": [
    { "day": "2026-08-12", "requests": 41, "prompt": 30210, "completion": 12880, "latencyMs": 1390 },
    { "day": "2026-08-13", "requests": 0,  "prompt": 0,     "completion": 0,     "latencyMs": null }
  ]
}

Health

GET/healthno auth
{ "ok": true }
GET / returns { "name": "thairouter-api", "ok": true }. Any other unknown path returns 404 with type: "not_found".