Skip to content

Chat Completions

LootVM accepts OpenAI-compatible chat completion requests at:

POST https://api.lootvm.com/v1/chat/completions

Authenticate with a LootVM-issued API key (Authorization: Bearer).

For Claude-shaped clients that expect Anthropic’s Messages API, use Messages (Claude) (POST /v1/messages) instead of translating prompts into Chat Completions by hand.

Terminal window
curl --fail-with-body https://api.lootvm.com/v1/chat/completions \
-H "Authorization: Bearer ${LOOTVM_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "your-enabled-model",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello in one sentence."}
]
}'

Choose model from the ids returned by GET /v1/models for your key. Models that are not enabled for your workspace return an error.

Send at least one user turn. Optional system (or a system role message) sets instructions. Keep content as a string for these examples unless your client needs multimodal parts the model supports.

A successful non-stream response looks like an OpenAI chat completion object (ids and usage vary by model):

{
"id": "chatcmpl-…",
"object": "chat.completion",
"model": "your-enabled-model",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
]
}
Field Notes
model Required. Must be enabled for your key.
messages Required. OpenAI-style role / content turns (system, user, assistant, and tool roles when the model supports them).
stream Optional. When true, the response is sent as server-sent events when the selected model and path support streaming.
temperature, max_tokens / max_completion_tokens, and related sampling fields Optional. Forwarded according to gateway and upstream support for that model. Omit fields your model rejects.

Exact accepted fields depend on the model and channel behind the gateway. Prefer starting with model and messages, then add optional parameters your client needs.

Set "stream": true and keep the HTTP connection open (for example curl -N). The body is a sequence of data: server-sent events in the OpenAI chat chunk shape when streaming is supported for that model.

Terminal window
curl --fail-with-body -N https://api.lootvm.com/v1/chat/completions \
-H "Authorization: Bearer ${LOOTVM_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "your-enabled-model",
"stream": true,
"messages": [
{"role": "user", "content": "Stream a short greeting."}
]
}'

If streaming fails or returns a non-stream JSON error body, confirm the model supports streaming in the Console or Model Square, and that your client does not buffer the entire response before reading events.

Use When
Chat Completions OpenAI SDKs, OpenAI-compatible IDE/CLI plugins, or any client that posts to /v1/chat/completions.
Messages (Claude) Anthropic SDKs, Claude CLI, or clients that post to /v1/messages with Anthropic headers.

Both paths use the same LootVM key and base host. Pick the protocol your client already speaks.

LootVM also exposes other OpenAI-compatible surfaces (for example Responses). Start with chat completions when your SDK expects /v1/chat/completions, then confirm model support in the Console or Model Square.