Velora SDK

One script tag gives any web app Velora's hosted AI, payments, chat and wallets. Apps built in Velora Studio already have it loaded as window.Velora.

<script src="https://veloraforge.ai/sdk/velora.js" data-project="YOUR_PROJECT_ID"></script>

All methods return Promises. data-project is needed for Payments, Chat and Wallet (find it in your Studio URL). The AI API needs an API key instead.

AI API

Create a key on the AI API page. Each request uses 1 AI credit from the key owner. Keep keys on your server where possible.

const velora = Velora.init({ apiKey: "vk_...", baseUrl: "https://veloraforge.ai" });

const answer = await velora.ai.chat(
  [{ role: "user", content: "Suggest a name for my bakery" }],
  { onToken: (t) => output.textContent += t }   // streams word by word
);

REST endpoint

POST /api/public/v1/chat — streams plain text. Body: { messages: [{ role, content }], system? }, up to 50 messages.

curl -N https://veloraforge.ai/api/public/v1/chat \
  -H "Authorization: Bearer vk_..." \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"Hello"}]}'

Payments

One-off checkouts and subscriptions. Currently in test mode — no real money moves.

const res = await Velora.payments.checkout("Coffee", 3.5, "EUR");
// → { status: "paid", mode: "test" }
const history = await Velora.payments.list();

await Velora.subscriptions.subscribe("pro", 9, "month");
const subs = await Velora.subscriptions.status(); // [{ plan, status, renews_at }]
await Velora.subscriptions.cancel("pro");

Chat

Channel-based messaging saved per app. Set a display name with Identity first.

await Velora.identity.save({ name: "Sam" });
await Velora.chat.send("Hi everyone!", "general");
const messages = await Velora.chat.list("general");

const stop = Velora.chat.subscribe("general", (msgs) => {
  render(msgs.map((m) => m.data.text));
});
// later: stop();

Wallet

In-app balances in EUR, with transfers and tips between users.

const { balance } = await Velora.wallet.balance();
await Velora.wallet.topup(10);                 // test mode
await Velora.wallet.transfer(otherUserId, 2.5);
await Velora.tips.send(creatorId, 1, "Great stream!");
const history = await Velora.wallet.history();
const me = await Velora.user();                // current user id

Errors & limits

  • 401 — missing, invalid or revoked API key.
  • 402 — the key owner is out of AI credits.
  • 429 — busy; retry after a few seconds.
  • Wrap SDK calls in try/catch and show a friendly message.