This guide takes you from zero to a streamed response. You need a Vaelor account; the Free plan includes 20 credits every 12 hours, which is plenty to follow along.
- 1
Create an API key
Open API keys in the dashboard, select Create key, and give it a name like
local-dev. Copy the key — it starts withvk_live_. - 2
Store it as an environment variable
Keep the key out of your source code. Export it in your shell, or add it to your
.envfile.Shellexport VAELOR_API_KEY="vk_live_..." - 3
Send your first request
Call the chat endpoint with the
flashmodel. The response body is the generated text, streamed as it's written.curl https://api.vaelor.chat/v1/chat \ -H "Authorization: Bearer $VAELOR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "Write a haiku about the first snow in Lisbon.", "attachments": [], "config": { "model": "flash", "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: 'Write a haiku about the first snow in Lisbon.', attachments: [], config: { model: 'flash', modes: [], uncensored: false } }) }) console.log(await response.text())import os import requests response = requests.post( "https://api.vaelor.chat/v1/chat", headers={"Authorization": f"Bearer {os.environ['VAELOR_API_KEY']}"}, json={ "text": "Write a haiku about the first snow in Lisbon.", "attachments": [], "config": {"model": "flash", "modes": [], "uncensored": False}, }, ) print(response.text) - 4
Stream tokens as they arrive
For chat UIs, read the body incrementally instead of waiting for the full reply.
TypeScriptconst reader = response.body!.pipeThrough(new TextDecoderStream()).getReader() while (true) { const { value, done } = await reader.read() if (done) break process.stdout.write(value) } - 5
Check what it cost
Every response carries an
x-vaelor-usage-request-idheader. Look it up in usage to see the credits it was charged.