// guides
Chat completions
Send a list of messages, get the model's reply. This is the one endpoint every Litepod model supports.
Messages
A conversation is a list of messages, oldest first. Each has a role and content:
system: instructions that shape every reply, such as tone, format or persona. Put it first.user: what the person asked.assistant: the model's earlier replies. Send them back to continue a conversation.tool: the result of a function call (see Function calling).
Multi-turn conversation
messages = [
{"role": "system", "content": "You are a concise assistant. Answer in one sentence."},
{"role": "user", "content": "What is a vector database?"},
{"role": "assistant", "content": "A database that stores embeddings and finds the most similar ones fast."},
{"role": "user", "content": "When would I use one?"},
]The API is stateless: send the whole conversation you want the model to see with every request.
Example
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
}'Common parameters
| Parameter | What it does |
|---|---|
max_tokens | Most tokens to generate. Also caps what the request can cost (see Pricing & billing). |
temperature | 0 to 2. Lower is more focused and repeatable, higher is more varied. |
top_p | Nucleus sampling, an alternative to temperature. Change one, not both. |
stop | One or more strings; generation stops before any of them. |
stream | Send tokens as they're generated. See Streaming. |
response_format | Set {"type": "json_object"} to get valid JSON back. |
n | How many alternative replies to generate (1 to 128). Each one is billed. |
Every parameter is listed in the API reference. Other OpenAI parameters are passed through to the model unchanged.
Reasoning models
Some models, including DeepSeek V4.1 Flash, think before they answer. That reasoning uses tokens:
- Reasoning tokens count toward
max_tokensand are billed as output tokens.usage.completion_tokens_details.reasoning_tokensshows how many were used. - Regular responses include the reasoning text in
message.reasoning_content, next to the answer incontent. Streamed responses send only the answer. - If
max_tokensis too small, the reasoning can use the whole budget: you get an emptycontentwithfinish_reason: "length". Give reasoning models room, a few hundred tokens or more.
Keeping costs predictable
note · Always set max_tokens
Before a request runs, Litepod reserves its worst-case cost from your wallet: the prompt plus
max_tokens of output. Without max_tokens, it reserves for 2,048 output tokens. You're only charged for what's actually generated, but a smaller reservation means one request can never hold more balance than it needs.