Vazian API
One API to route prompts across multiple AI models — Smart, Direct, or Compare. Current chat endpoint contracts. Self-service developer API keys and usage-based billing have not launched.
auto for Smart, single for Direct,
compare for Compare, or loop for Debate.
Endpoint:
POST https://api.vazian.ai/v1/route
POST /v1/route
One endpoint for all modes. Your UI already sends one of these payloads:
{
"prompt": "Explain this like I’m five: what is an LLM router?",
"mode": "auto"
}
{
"prompt": "Draft a customer email about a delayed shipment.",
"mode": "single",
"model": "gpt"
}
{
"prompt": "Summarize this contract in plain English.",
"mode": "compare",
"models": ["gpt", "claude", "gemini"]
}
{
"status": "pending",
"request_id": "r_example"
}
Quick curl example
curl -X POST "https://api.vazian.ai/v1/route" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"prompt": "Give me 5 bullet points for a product launch plan.",
"mode": "auto"
}'
JavaScript fetch example
const url = "https://api.vazian.ai/v1/route";
const res = await fetch(url, {
method: "POST",
credentials: "include",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
body: JSON.stringify({ prompt: "Write a 2-sentence elevator pitch.", mode: "auto" })
});
let data = await res.json();
if (!res.ok) throw new Error(data.error || "Chat request failed");
while (data.status === "pending") {
await new Promise(resolve => setTimeout(resolve, 1000));
const poll = await fetch(`https://api.vazian.ai/v1/result/${data.request_id}`, { credentials: "include" });
data = await poll.json();
if (!poll.ok && poll.status !== 202) throw new Error(data.error || "Chat job failed");
}
console.log(data.answer);
Authorization: Bearer YOUR_API_KEY.
Decision briefs (live)
After at least two AIs return successful text answers, create one structured brief with shared ground, differences, a recommendation, and next steps. A successful brief uses one existing Compare allowance. It synthesizes the supplied answers; it does not independently verify them.
{
"task": "compare_brief",
"mode": "compare",
"request_id": "r_brief_example",
"chat_id": "c_example",
"comparison_id": "r_comparison_example",
"prompt": "Evaluate a subscription idea",
"results": [
{"key": "gpt", "answer": "Interview customers first."},
{"key": "grok", "answer": "Validate demand with interviews."}
]
}
{
"status": "done",
"task": "compare_brief",
"mode": "compare",
"brief": {
"summary": "Validate demand first.",
"agreements": [{"claim": "Interview customers.", "models": ["gpt", "grok"]}],
"differences": [],
"recommendation": "Interview five potential customers.",
"next_steps": ["Recruit interviewees.", "Test their problem."],
"caveat": "Agreement is not proof. This is not independent verification."
},
"answer": "Readable Markdown brief"
}
POST /v1/stream (SSE)
Smart and Direct text requests support text/event-stream. Each data line contains JSON. Compare, Debate, and image generation use /v1/route jobs.
SSE format
HTTP/1.1 200 OK
Content-Type: text/event-stream
data: {"type":"start","provider":"openai","model":"configured-model"}
data: {"type":"token","text":"Hello"}
data: {"type":"done","fullText":"Hello"}
Client example (EventSource-style parsing)
// Your UI already handles this internally.
// If you build your own client:
const res = await fetch("https://api.vazian.ai/v1/stream", { method:"POST", credentials:"include", headers:{ "Content-Type":"application/json" }, body: JSON.stringify({ prompt:"Hi", mode:"auto" }) });
if (!res.ok) throw new Error("Stream request failed");
const reader = res.body.getReader();
const decoder = new TextDecoder();
let buf = "";
while (true) {
const { value, done } = await reader.read();
if (done) break;
buf += decoder.decode(value, { stream: true });
// If SSE, parse lines like "data: ..."
}
done event. A JSON
error event or a connection ending before done is a failed request,
not a successful partial answer.
Error handling
Keep errors human-readable. The UI will show a friendly message and keep the conversation intact.
{
"error": "Rate limit exceeded. Try again in 30 seconds."
}
- 400 — invalid request (missing prompt, unknown mode)
- 401 — authentication required for account and billing endpoints
- 429 — rate limited
- 500 — backend error