// api reference

Create chat completion

Generates the model's reply to a conversation. Compatible with OpenAI's Chat Completions API.

POSThttps://api.litepod.io/v1/chat/completions

Authorization

Authorizationheaderrequired
Bearer sk_litepod_.... See Authentication.

Request body

modelstringrequired
Model id, e.g. nvidia/nemotron-lightning-3.5-30b-a3b. See Models.
messagesarrayrequired
The conversation so far, oldest first. Each message has a role (system, user, assistant or tool) and content: a string, or an array of text and image_url parts for vision. Must not be empty.
max_tokensinteger ≥ 1
Most tokens to generate. Can't exceed the model's context length. Also sets the wallet reservation (2,048 tokens if omitted). max_completion_tokens is accepted as an alias; send only one.
temperaturenumber, 0–2
Sampling temperature. Lower is more focused, higher is more varied.
top_pnumber, 0–1
Nucleus sampling. Adjust this or temperature, not both.
ninteger, 1–128
Number of choices to generate. Default 1. Each one is billed.
streamboolean
Default false. When true, the reply is sent as server-sent events. See Streaming.
stopstring | array
Generation stops before any of these strings.
toolsarray
Functions the model may call. See Function calling.
tool_choicestring | object
auto (default), none, required, or a specific function.
response_formatobject
{"type": "json_object"} makes the model reply with valid JSON. Ask for JSON in the prompt too.
seedinteger
Best-effort repeatable sampling.
presence_penalty / frequency_penaltynumber, -2–2
Discourage repeating topics or tokens.

Any other OpenAI parameter is passed through to the model unchanged.

Response

FieldDescription
idUnique id of the completion.
choices[].messageThe reply: content, plus tool_calls when the model calls a function.
choices[].message.reasoning_contentReasoning models only: the model's reasoning before its answer. See Reasoning models.
choices[].finish_reasonstop (natural end or stop string), length (hit max_tokens) or tool_calls.
usageprompt_tokens, completion_tokens and total_tokens: what you're billed for. For reasoning models, completion_tokens_details.reasoning_tokens is the part of completion_tokens spent reasoning.

Headers include x-request-id and the rate limit headers.

Streaming response

With stream: true, you get chat.completion.chunk events. The last chunk carries usage, then data: [DONE].

Errors

StatuscodeWhen
400null / max_tokens_exceededInvalid body, empty messages, or max_tokens over the model's context.
401invalid_api_keyMissing, malformed or revoked key.
402insufficient_balanceWallet can't cover the reservation.
404model_not_foundUnknown or retired model id.
429rate_limit_exceededAccount rate limit reached; see Retry-After.
502 / 503 / 504upstream_error / upstream_overloaded / upstream_timeoutThe model provider failed, is busy, or timed out.

See Errors & retries for the error format and what to retry.

curl https://api.litepod.io/v1/chat/completions \
  -H "Authorization: Bearer $LITEPOD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nvidia/nemotron-lightning-3.5-30b-a3b",
    "messages": [{"role": "user", "content": "Explain RAG in one sentence."}],
    "max_tokens": 256
  }'
200 response
{
  "id": "chatcmpl-8f3a2c…",
  "object": "chat.completion",
  "created": 1790000000,
  "model": "nvidia/nemotron-lightning-3.5-30b-a3b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "RAG retrieves relevant documents and gives them to the model so its answer is grounded in them."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 14, "completion_tokens": 21, "total_tokens": 35 }
}
text/event-stream
data: {"id":"chatcmpl-8f3a2c…","object":"chat.completion.chunk","model":"nvidia/nemotron-lightning-3.5-30b-a3b","choices":[{"index":0,"delta":{"role":"assistant","content":"RAG"}}]}

data: {"id":"chatcmpl-8f3a2c…","object":"chat.completion.chunk","model":"nvidia/nemotron-lightning-3.5-30b-a3b","choices":[{"index":0,"delta":{"content":" retrieves"}}]}

…

data: {"id":"chatcmpl-8f3a2c…","object":"chat.completion.chunk","model":"nvidia/nemotron-lightning-3.5-30b-a3b","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: {"id":"chatcmpl-8f3a2c…","object":"chat.completion.chunk","model":"nvidia/nemotron-lightning-3.5-30b-a3b","choices":[],"usage":{"prompt_tokens":14,"completion_tokens":21,"total_tokens":35}}

data: [DONE]