Skip to main content
Docs/Architecture & Inference/Multi-Model Routing
v3.5 ARCHITECTURE SPECIFICATION
RFC-7092 COMPLIANT• Last mutated 3 hours ago

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.

Zero Telemetry & Client-Side AES-256 VaultingSEC-HARDENED

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 Verification

Standard 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:

Inference Stream Vector Pipeline
Babel Rust CoreLatency Overhead: <1.8ms
STAGE 01
Prompt Intake

Client signs payload with ephemeral hash; token rate limits audited.

STAGE 02
Smart Arbiter

Evaluates model latency budgets and routes to Sonnet, R1, or Ollama.

STAGE 03
AST Parse Guard

Live token stream runs through incremental TS grammar tree validation.

STAGE 04
Execution Node

Validated component mounts in sub-10ms isolate sandbox environment.

TOKEN ACCELERATION248.6 tokens/sec
AST DIVERGENCE RATE0.00021%

02.Client SDK Integration

NPM: @vidura/sdk@3.5.2

Initialize the Vidura client on the edge runtime or browser worker. Provide local AES keys to keep telemetry locked strictly to your own hardware domain.

client.worker.ts
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);
    }
  }
});
Deterministic Schema: TSX v5.4.1

03.Execution Parameters & Typings

Schema: ViduraRoutingConfig

The multi-model router evaluates request parameters synchronously before opening upstream provider sockets. All properties adhere strictly to JSON-Schema Draft 7.

ParameterTypeDefaultDescription
primaryEngineString (Enum)'claude-3-7'Target frontier model identifier. Automatically resolves upstream credentials from the client-side AES vault.
failoverEngineString (Enum) | null'deepseek-r1'Secondary fallback provider invoked if latency exceeds divergenceThresholdMs or HTTP 429 occurs.
parserASTParserSpecStreamingAST.TSXGrammar parser applied to streaming chunks. Options include TSX, RustAST, and PyBytecode.
vaultConfig.enforceLocalBooleantrueGuarantees that raw LLM provider API tokens are never written to Vidura Edge logs or persisted disk stores.
divergenceThresholdMsNumber (Integer)450Max millisecond delay allowed for First Token To Arrival (TTFT) before triggering instantaneous gateway arbitration.