Skip to content

API

Chat endpoint

POST /api/v1/chat — one conversation turn with no streaming and no persistence. Request fields, limits, response shape, and examples.

On this page

Request

POST /api/v1/chat runs one conversation turn. There is no streaming and nothing is persisted — your caller keeps its own history and sends the messages each time. The credit hold is taken before the provider is called and released in full whenever the call does not complete.

FieldTypeNotes
messagesarray (required)1–100 messages. Each message is { role, content } with role user, assistant, or system and string content.
modelstring (optional)A Chat model id such as openai/gpt-6.2-sol. Omit it to use your saved default model. Unknown ids return 400.

Response

{
  "message": { "role": "assistant", "content": "..." },
  "provider": "openai",
  "model": "openai/gpt-6.2-sol",
  "credits": { "charged": 1, "remaining": 1999 }
}

The model runs on your connected key for its provider. If that provider is not connected, the call returns 402; if the provider rejects the request, the error names the exact problem and no credit is charged.

Examples

curl

curl https://www.lumivoralabs.com/api/v1/chat \
  -H "Authorization: Bearer lv_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-fable-5-2",
    "messages": [
      { "role": "system", "content": "Answer in one sentence." },
      { "role": "user", "content": "What is bring-your-own-key?" }
    ]
  }'

JavaScript

const res = await fetch("https://www.lumivoralabs.com/api/v1/chat", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LUMIVORA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    messages: [{ role: "user", content: "Summarize BYOK in one line." }],
  }),
})
const data = await res.json()
console.log(data.message.content)

Questions this page does not answer? Email support@lumivoralabs.com.