Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Mock LLM

Rustybin's mock LLM is a deterministic, multi-provider model server. It speaks the native wire format of seven providers, so an AI gateway can be pointed at it exactly as it would be pointed at the real API, and the official client SDKs accept its responses (the conformance/ai/ scripts drive it with the OpenAI, Anthropic and Google Gen AI Python SDKs in CI).

Nothing is generated by a real model: replies come from keyword tables, scripted rules, the prompt itself or a seeded generator, so the same request gives the same answer and demos are reproducible.

What you can demo with it

Gateway capabilityWhat Rustybin provides
AI proxy, provider abstraction, model routingSeven providers' APIs at stable paths; any model name accepted; X-Rustybin-Provider and X-Rustybin-Model response headers
Token based rate limiting, cost accountingDeterministic token counts in native usage fields and rate-limit headers; the ai_token_limit scenario checks a gateway's budget end to end
Prompt decorators and templatesEcho mode returns the exact prompt the upstream received
Prompt guards, response sanitisersScripted mode returns fake PII, secrets, unsafe text, URLs on demand; plus mock guardrail services; the ai_prompt_guard and ai_response_guard scenarios check a gateway's guards end to end
Semantic cachingSimilarity-preserving embeddings; the ai_semantic_cache scenario checks a gateway's cache end to end
Retries, fallback, load balancingNative errors (429 with rate-limit headers, Anthropic 529, timeouts, context length) on demand or at a rate; X-Rustybin-Instance; the ai_model_fallback and ai_provider_balance scenarios check a gateway's fallback and balancing end to end
StreamingNative SSE, NDJSON and AWS event stream framing with configurable pace and time to first token
Credential injection, key vaultsNative credential checks that report the redacted key they received
Tool calling, structured output, agent flowsTool calls with arguments generated from your JSON schema; structured output valid against your schema
Realtime sessions (WebSocket, text and audio)The realtime API: the OpenAI-shaped protocol with events both ways, tools, counted audio, mid-session faults
Batch jobsThe batch APIs in the OpenAI and Anthropic shapes, on a compressed clock, with deterministic results
ObservabilityRequest inspection: what the upstream received, normalised

Pages