https://api.vaelor.chat/v1/chatGenerates a reply to text, optionally with earlier turns in context and files in attachments. The reply is streamed as plain text. Vaelor is stateless here: send the conversation history you want the model to see on every request.
Body#
textstringRequiredThe user's message. Up to 100,000 characters.
attachmentsobject[]RequiredFiles the model should read, up to 10. Pass an empty array for none. Upload files first with Upload a file.
namestringRequiredmediaTypestringRequiredapplication/pdf or image/png.urlstringRequiredurl from the upload response.configobjectRequiredModel settings.
modelenumRequiredmodesenum[]Requiredreasoning and deep-research.uncensoredbooleanRequiredcontextobject[]Earlier turns, oldest first. Each item has a role of user or assistant and a content string. Counted as input tokens.
usageRequestIduuidTies the charge to a reservation you created earlier. See Idempotency.
sourceIdstringYour own identifier for the conversation, up to 120 characters. Shown in your usage activity.
Response#
A text/plain stream containing the reply. The response includes these headers:
x-vaelor-usage-request-idheaderThe usage record for this response. The final charge is settled when the stream ends.
Example#
curl -N https://api.vaelor.chat/v1/chat \
-H "Authorization: Bearer $VAELOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Now make it a checklist.",
"attachments": [],
"context": [
{ "role": "user", "content": "Plan a 3-day trip to Lisbon under $600, no car." },
{ "role": "assistant", "content": "Day 1: Alfama and the castle..." }
],
"config": { "model": "medium", "modes": [], "uncensored": false }
}'const response = await fetch('https://api.vaelor.chat/v1/chat', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VAELOR_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'Now make it a checklist.',
attachments: [],
context: [
{ role: 'user', content: 'Plan a 3-day trip to Lisbon under $600, no car.' },
{ role: 'assistant', content: 'Day 1: Alfama and the castle...' }
],
config: { model: 'medium', modes: [], uncensored: false }
})
})
for await (const chunk of response.body!.pipeThrough(new TextDecoderStream())) {
process.stdout.write(chunk)
}import os
import requests
with requests.post(
"https://api.vaelor.chat/v1/chat",
headers={"Authorization": f"Bearer {os.environ['VAELOR_API_KEY']}"},
json={
"text": "Now make it a checklist.",
"attachments": [],
"context": [
{"role": "user", "content": "Plan a 3-day trip to Lisbon under $600, no car."},
{"role": "assistant", "content": "Day 1: Alfama and the castle..."},
],
"config": {"model": "medium", "modes": [], "uncensored": False},
},
stream=True,
) as response:
for chunk in response.iter_content(chunk_size=None, decode_unicode=True):
print(chunk, end="", flush=True)Response200
**Lisbon in 3 days — checklist**
Day 1 · Alfama
- [ ] Tram 28 to Graça (€3.10)
- [ ] São Jorge Castle (€15)
- [ ] Fado dinner in Alfama
...Attachments#
Images are read with vision; PDFs, Word files and spreadsheets are converted to text. Parsing documents is billed as tool calls.
{
"text": "What is the total on this invoice?",
"attachments": [
{ "name": "invoice-0042.pdf", "mediaType": "application/pdf", "url": "https://files.vaelor.chat/…" }
],
"config": { "model": "flash", "modes": [], "uncensored": false }
}Billing#
1 credit is reserved when the request arrives. When the stream ends, the charge is settled from the tokens used at the tier's rates. If the client disconnects before any output, the reservation is refunded.
Errors#
| Status | When |
|---|---|
400 | The body failed validation. |
402 | Not enough credits for the 1-credit reservation. |
502 | The model provider failed. Safe to retry. |
503 | Chat is temporarily unavailable. |