- Switch providers with one line
- Sync usage (no asyncio)
- Structured output with Pydantic
- PII-guard any model
- Budget-capped calls
- Detect hallucinations in RAG answers
- Switch models mid-conversation without losing knowledge
- Agents that spawn sub-agents (bounded)
- Run the gateway API
- Fully local stack with docker compose
Switch providers with one line
Every provider implements the same interface — swap the constructor, nothing else changes.Sync usage (no asyncio)
Every model hasgenerate_sync, chat_sync, and embeddings_sync:
Structured output with Pydantic
Pass a Pydantic class asresponse_format and get an instance back, not a string:
OpenAIModel, ClaudeModel, GeminiModel, MistralAIModel, GroqModel, and DeepSeekModel.
PII-guard any model
guard() wraps a model so PII is redacted before it reaches the provider, blocked types raise, and every event lands in a JSONL audit trail:
generate (and optionally chat / generate_stream) can be wrapped — including clients that are not MultiMind models:
Budget-capped calls
Budget enforces a hard spending ceiling — the call past the limit is blocked before it is dispatched:
warn_ratio). Offline demo that runs with no API key: examples/observability/cost_tracking.py.
Detect hallucinations in RAG answers
Wrap the generating model so every answer is grounding-checked against the retrieved sources. The default check is lexical (deterministic, offline, no judge LLM needed):sources=callable, sources are fetched per prompt — plug in your retriever for RAG. on_flag="retry" regenerates once with a strict grounding instruction. For a score without wrapping anything:
Switch models mid-conversation without losing knowledge
Start a conversation on one provider, move to another — the context travels with you."full" (replay raw history, zero loss), "summary" (compact — best for
long chats crossing context limits), "adapted" (provider-specific formatting).
With max_history_tokens=... long conversations are compacted automatically.
Composes with guard(...) and track_costs(...) wrappers.
Runnable demo: examples/context_transfer/model_switching.py
Agents that spawn sub-agents (bounded)
The coordinator decides at runtime whether to answer, delegate, or create a new sub-agent for a subtask — inside hard safety bounds.budget_tracker= (a multimind.observability Budget-backed tracker) to cap
spend across the whole agent tree, and audit_hook= to log every spawn/delegate
event. Runnable demo: examples/agents/self_orchestrating_agent.py
Run the gateway API
Expose chat, generation, and model comparison over HTTP:- Swagger UI (interactive docs): http://localhost:8000/docs
- Health check:
curl http://localhost:8000/health - Chat:
Fully local stack with docker compose
Gateway plus Ollama, no API keys, nothing leaves your machine:ollama_models volume. Full container reference (env vars, health checks, production notes): deployment guide.