API reference

Chat completions

POST /v1/chat/completions

endpoint
POST https://api.stardustllm.xyz/v1/chat/completions

Creates a model response for a conversation. The request and response follow the OpenAI Chat Completions format.

Request body#

FieldTypeDescription
modelstring, requiredA model id from GET /v1/models, e.g. glm-5.3-flash-free.
messagesarray, requiredThe conversation: objects with role (system, user, assistant) and content.
streambooleantrue streams the answer as server-sent events. Default false.
max_tokensintegerUpper limit for the answer. Also used to reserve Energy for paid models (default 1,024 when omitted).
temperature, top_p, tools, …Other OpenAI parameters are passed to the model when it supports them.

Example#

curl https://api.stardustllm.xyz/v1/chat/completions \
  -H "Authorization: Bearer $STARDUST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3-flash-free",
    "messages": [
      { "role": "system", "content": "You are a security reviewer." },
      { "role": "user", "content": "What is an IDOR?" }
    ]
  }'

Response#

200 OK
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "glm-5.3-flash-free",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "An IDOR (Insecure Direct Object Reference) is ..." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 24, "completion_tokens": 61, "total_tokens": 85 }
}

Billing#

Free models spend nothing but need you to hold 5,000 ENERGY. Paid models reserve an estimate from your vault before the request and are charged the real cost from usage afterwards. See Pricing & Energy.