Deterministic AST Inference & Multi-Model Routing
Vidura AI dynamically arbitrates generative requests across frontier reasoning engines (Claude 3.7 Sonnet, DeepSeek R1, GPT-4o, and on-prem Llama 3) through a deterministic, client-vaulted AST synthesis pipeline designed to eliminate runtime parsing failures.
Provider API secrets are never transmitted in plaintext to our routing mesh. All payload parameters and custom endpoint credentials undergo client-side envelope encryption via WebCrypto AES-GCM before socket negotiation. Memory heaps within edge workers are wiped using zero-fill on socket termination.
01.Pre-Inference AST Synthesis Lifecycle
Formal Logic VerificationStandard LLM APIs generate unconstrained raw character streams that frequently violate grammar constraints during nested JSX or TypeScript evaluation. Vidura enforces a synchronous compiler state machine:
Client signs payload with ephemeral hash; token rate limits audited.
Evaluates model latency budgets and routes to Sonnet, R1, or Ollama.
Live token stream runs through incremental TS grammar tree validation.
Validated component mounts in sub-10ms isolate sandbox environment.
02.Client SDK Integration
NPM: @vidura/sdk@3.5.2Initialize the Vidura client on the edge runtime or browser worker. Provide local AES keys to keep telemetry locked strictly to your own hardware domain.
import { ViduraClient, StreamingASTParser } from '@vidura/sdk';
// 1. Instantiate the Zero-Telemetry Edge Client
const client = new ViduraClient({
apiKey: process.env.VIDURA_CLIENT_TOKEN,
mode: 'deterministic-ast',
vaultConfig: {
algorithm: 'AES-GCM',
clientKeyId: 'vk_stage_prod_8902',
enforceLocalSecrets: true
},
router: {
primaryEngine: 'anthropic:claude-3-7-sonnet',
failoverEngine: 'deepseek:r1-distill-llama',
divergenceThresholdMs: 450
}
});
// 2. Execute Stream with Live Syntax Tree Guard
const stream = await client.synthesizeStream({
prompt: 'Generate a high-concurrency event subscriber using React 19 Actions',
parser: StreamingASTParser.TSX,
targetSpec: 'nextjs-15-app-router',
onToken: (token, snapshotAST) => {
// Instant snapshot validity check before DOM mounting
if (!snapshotAST.hasUnclosedNodes) {
console.log('[AST Valid Chunk]', token.content);
}
}
});03.Execution Parameters & Typings
Schema: ViduraRoutingConfigThe multi-model router evaluates request parameters synchronously before opening upstream provider sockets. All properties adhere strictly to JSON-Schema Draft 7.
| Parameter | Type | Default | Description |
|---|---|---|---|
| primaryEngine | String (Enum) | 'claude-3-7' | Target frontier model identifier. Automatically resolves upstream credentials from the client-side AES vault. |
| failoverEngine | String (Enum) | null | 'deepseek-r1' | Secondary fallback provider invoked if latency exceeds divergenceThresholdMs or HTTP 429 occurs. |
| parser | ASTParserSpec | StreamingAST.TSX | Grammar parser applied to streaming chunks. Options include TSX, RustAST, and PyBytecode. |
| vaultConfig.enforceLocal | Boolean | true | Guarantees that raw LLM provider API tokens are never written to Vidura Edge logs or persisted disk stores. |
| divergenceThresholdMs | Number (Integer) | 450 | Max millisecond delay allowed for First Token To Arrival (TTFT) before triggering instantaneous gateway arbitration. |