Architecture & Gateway Overview
Tanvelo sits between your application and upstream LLM providers, providing unified routing, automated failovers, distributed token-bucket rate limits, and an auditable request ledger with zero prompt retention.
Deterministic Failover
Upstream 429s and 5xx outages failover to secondary models in under 180ms without dropping the active stream.
Distributed Limits
Redis-backed atomic token buckets enforce requests-per-minute (RPM) and tokens-per-minute (TPM) per API key.
Zero Retention
Prompts and provider outputs stream in-flight and are never stored on disk. Only cryptographic telemetry is logged.
Quickstart
Connect your upstream providers in the Tanvelo Dashboard, generate an API key, and make your first completion with automatic failover.
import { Tanvelo } from "tanvelo";
const tanvelo = new Tanvelo({
apiKey: process.env.TANVELO_API_KEY, // "tv_live_..."
});
async function main() {
const response = await tanvelo.chat.completions.create({
model: "provider/your-model-name",
fallbacks: ["fallback-provider/your-fallback-model-name"],
messages: [
{ role: "system", content: "You are a concise production AI engineer." },
{ role: "user", content: "Explain deterministic circuit breakers." }
],
temperature: 0.7,
});
console.log(response.choices[0].message.content);
console.log("Provider:", response._tanvelo?.provider);
console.log("Latency:", response._tanvelo?.latencyMs, "ms");
}
main();Official TypeScript & Node.js SDK
Published as tanvelo. Zero third-party runtime dependencies with complete typings for completions, SSE streaming, and telemetry.
import { Tanvelo } from "tanvelo";
const tanvelo = new Tanvelo({ apiKey: process.env.TANVELO_API_KEY });
const stream = await tanvelo.chat.completions.create({
model: "provider/your-model-name",
fallbacks: ["fallback-provider/your-fallback-model-name"],
messages: [{ role: "user", content: "Stream a high-availability checklist." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || "");
}Official Python SDK
Published as tanvelo on PyPI. Requires zero external packages, leveraging Python's standard library for fast microservice and container runtimes.
from tanvelo import Tanvelo
client = Tanvelo()
stream = client.chat.completions.create(
model="provider/your-model-name",
fallbacks=["fallback-provider/your-fallback-model-name"],
messages=[{"role": "user", "content": "Stream a high-availability checklist."}],
stream=True
)
for chunk in stream:
print(chunk.delta, end="", flush=True)
print()Direct HTTP / REST API Reference
Connect from any HTTP client by sending a standard POST request:
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Primary model identifier in format "provider/your-model-name" |
| messages | array | Yes | Array of message objects with role and content |
| fallbacks | string[] | No | Ordered backup models to execute on failure (e.g. ["fallback-provider/your-fallback-model-name"]) |
| stream | boolean | No | If true, returns Server-Sent Events (SSE) |
140+ AI Providers & Universal Custom Endpoints
Like LiteLLM, Tanvelo provides out-of-the-box routing and parameter translation across 140+ foundational providers and inference engines. You can invoke any provider using explicit prefix notation (<provider>/<your-model-name>) or configure automated routing rules.
// Wafer-Scale Fast Silicon model: "cerebras/your-model-name" // Open-Weights Provider model: "together/your-model-name" // Frontier Reasoning Provider model: "openai/your-model-name" // Enterprise Managed Cloud model: "azure/your-model-name" // Self-Hosted / On-Prem vLLM model: "vllm/your-model-name"
Connect ANY private cluster, corporate proxy, or third-party service:
- Supports any Base URL (e.g.
https://llm.corp.net/v1) - Flexible auth: Bearer, Azure
api-key, custom headers, or unauthenticated local runners - Automatic fallback to other providers upon timeouts or outages
Deterministic Fallbacks & Circuit Breakers
When upstream providers return rate limits (429) or server errors (500/502/503), Tanvelo immediately shifts in-flight execution to your secondary choices in under 180ms without interrupting active streaming connections.
Distributed Rate Limits & Spend Caps
Configure atomic Redis token-bucket limits per API key (RPM/TPM). Monthly budget caps automatically block requests with standard 429 errors when spend ceilings are hit.
Webhook Signature Verification (HMAC-SHA256)
Tanvelo delivers webhooks with a cryptographically verifiable Tanvelo-Signature header (t=TIMESTAMP,v1=SIGNATURE).
import crypto from 'crypto';
// Verify Tanvelo webhook signatures: "t=TIMESTAMP,v1=SIGNATURE"
export function verifyTanveloWebhook(payloadRaw, signatureHeader, secret) {
const parts = Object.fromEntries(
signatureHeader.split(',').map((p) => p.split('='))
);
const timestamp = parts.t;
const signature = parts.v1;
// Protect against replay attacks (5 minute threshold)
if (Math.abs(Math.floor(Date.now() / 1000) - parseInt(timestamp, 10)) > 300) {
return false;
}
const expected = crypto
.createHmac('sha256', secret)
.update(`${timestamp}.${payloadRaw}`)
.digest('hex');
return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}import hmac
import hashlib
import time
def verify_tanvelo_webhook(payload_raw: bytes, signature_header: str, secret: str) -> bool:
parts = dict(item.split("=") for item in signature_header.split(","))
timestamp = parts.get("t")
signature = parts.get("v1")
if not timestamp or not signature:
return False
if abs(time.time() - int(timestamp)) > 300:
return False
signed_payload = f"{timestamp}.".encode("utf-8") + payload_raw
expected = hmac.new(secret.encode("utf-8"), signed_payload, hashlib.sha256).hexdigest()
return hmac.compare_digest(signature, expected)HTTP Status Codes & Error Payloads
| Status Code | Type | Description |
|---|---|---|
| 400 Bad Request | invalid_request_error | Missing required fields or invalid JSON payload |
| 401 Unauthorized | authentication_error | Missing or invalid Tanvelo API key (must begin with tv_live_) |
| 429 Too Many Requests | rate_limit_exceeded | Rate limit quota exceeded or hard monthly spending budget reached |
| 502 Bad Gateway | upstream_provider_error | Primary provider and all configured fallbacks failed or timed out |
| 503 Service Unavailable | provider_unavailable | No provider credentials configured in dashboard for requested model |