Product

API Reference

Last updated — July 4, 2026

Jetnight exposes an OpenAI-compatible REST API. Point any existing OpenAI SDK at our endpoint and switch models with a single line — no refactor, no new dependencies.

Base URL

https://api.jet-night.com/v1

Authentication

Pass your API key as a Bearer token in the Authorization header:

Authorization: Bearer jn_sk_...
Content-Type: application/json

Keys are created in the dashboard. Each key is scoped to your account and inherits your plan's rate limits.

Chat completions

Request

POST /v1/chat/completions

{
  "model": "glm-5-2-fast",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user", "content": "Build something fast." }
  ],
  "temperature": 0.7,
  "max_tokens": 1024,
  "stream": false
}

Parameters

  • model — string, required. Any routed model ID (see /v1/models).
  • messages — array, required. Conversation turns with role + content.
  • temperature — float 0–2, default 1. Sampling randomness.
  • max_tokens — int, optional. Caps completion length.
  • stream — boolean, default false. SSE streaming responses.
  • tools — array, optional. Function-calling definitions.

Response

{
  "id": "chatcmpl-jn_8f3a...",
  "object": "chat.completion",
  "model": "glm-5-2-fast",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "..." },
    "finish_reason": "stop"
  }],
  "usage": { "prompt_tokens": 12, "completion_tokens": 48, "total_tokens": 60 }
}

List models

GET /v1/models

→ { "data": [{ "id": "glm-5-2-fast", "object": "model", ... }, ...] }

Streaming

Set "stream": true to receive Server-Sent Events. Each chunk follows the OpenAI delta format. Close the connection to cancel generation.

Errors

  • 401 — invalid or missing API key.
  • 402 — insufficient token balance.
  • 429 — rate limit exceeded; retry with exponential backoff.
  • 502 / 503 — upstream provider unavailable; failover engages on Pro+.

Rate limits

  • Lumen — 20 req/min, 1 key.
  • Beam — 60 req/min, 3 keys.
  • Flare — 200 req/min, 10 keys.
  • Nova — custom.

Headers X-RateLimit-Remaining and X-RateLimit-Reset are included on every response.

SDKs

Any OpenAI-compatible SDK works out of the box:

  • Pythonopenai package, set base_url.
  • TypeScriptopenai npm package, set baseURL.
  • Cursor / Cline / Aider / Continue / Zed / Cody / Roo Code — set custom endpoint in settings.