LLM orchestration gateway — intelligent routing, fallback, circuit breakers, redaction, 10+ providers
Project description
ghostcore
LLM orchestration gateway with intelligent routing, fallback, and redaction.
Why
Every project hardcodes model names and API clients. When a model is slow, rate-limited, or refuses a request, the call just fails. ghostcore routes each call to the best available model automatically — with circuit breakers, fallback chains, and post-model redaction baked in.
Install
pip install ghostcore
Quick Start
from ControlCore.config import initialize_controlcore
from ControlCore.adapters.executor import execute_call
from ControlCore.schemas import ControlCoreCall, CallerIdentity, CallIntent, CallTarget
# Initialize registries (reads env vars for API keys)
config, model_registry, adapter_registry = initialize_controlcore()
# Build a call
call = ControlCoreCall(
caller=CallerIdentity(handle="my-app", account_id="00000000-0000-0000-0000-000000000000"),
intent=CallIntent(cls="lookup"),
target=CallTarget(type="model", alias="claude"),
prompt="What is the capital of France?",
)
# Execute with automatic fallback
import asyncio
result, trace = asyncio.run(execute_call(call, model_registry, adapter_registry))
print(result.answer)
Or boot as a daemon and call over HTTP:
ghostcore serve # binds to localhost:8265
ghostcore run claude "Explain recursion"
ghostcore result <job_id> --poll
Architecture
call → bouncer → eligibility filter → routing → adapter → redaction → result
↓
circuit breaker
↓
fallback chain
- Routing — scores eligible models by trust tier, cost, and latency history
- Eligibility — filters models by intent, verbosity, and determinism requirements
- Fallback — tries models in order; switches on timeout, error, refusal, or rate limit
- Adapter — thin shim per provider; no shared state between providers
- Redaction — applied to model output (not the prompt); strips leaked secrets, emails, phone numbers
Providers
| Provider | Models |
|---|---|
| OpenAI | GPT-4, GPT-4o, o1, o1-mini |
| Anthropic | Claude Sonnet, Opus, Haiku |
| Gemini 1.5 Pro/Flash, Gemini 2.0 | |
| xAI | Grok, Grok-2 |
| Mistral | Mistral Large/Medium/Small, Codestral |
| Groq | Llama-70B, Llama-8B, Mixtral, Gemma |
| Together | Llama-405B, Qwen-72B, DeepSeek-V3 |
| DeepSeek | DeepSeek Chat, Coder, Reasoner |
| Perplexity | Sonar (search-augmented) |
| Ollama | Any local model |
Set the relevant *_API_KEY environment variables to enable each provider.
Key Features
- Circuit breakers — automatically open on repeated failures, recover with half-open probing
- Trust tiers — models tagged with trust levels; calls can require a minimum tier
- Post-model redaction — output is scanned and sanitized before returning to caller
- Execution traces — every call records which models were tried, timings, and outcomes
- Structured schemas — Pydantic v2 throughout; strict validation at every boundary
- Async-native — built on httpx + asyncio; runs in Starlette for low overhead
Spine Integration (optional)
ghostcore supports maelspine for zero-import access to registries across a larger application:
from ControlCore.boot import boot
core = boot() # idempotent singleton
# Any module, anywhere:
from spine import Core
registry = Core.instance().get("model_registry")
HTTP API
| Method | Path | Description |
|---|---|---|
| POST | /call |
Submit a call |
| GET | /result/{job_id} |
Poll for result |
| GET | /health |
Health + job stats |
| GET | /jobs |
List recent jobs |
Part of the GhostLogic Stack
maelspine — frozen capability registry
ghostcore — LLM orchestration gateway ← you are here
ghostserver — evidence server (Blackbox)
License
MIT — Copyright 2026 Adam Thomas / GhostLogic LLC
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ghostcore-0.1.1.tar.gz.
File metadata
- Download URL: ghostcore-0.1.1.tar.gz
- Upload date:
- Size: 109.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca54a81d05673f0c04c794ee5e915c41398229ae65be9dd76799b0d6dd57cb92
|
|
| MD5 |
3653fac305f948f6274699e229171a5b
|
|
| BLAKE2b-256 |
9854a427c492c32666b7ff9229e977b0b4f4e010158b1b03978ae63be937c36f
|
File details
Details for the file ghostcore-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ghostcore-0.1.1-py3-none-any.whl
- Upload date:
- Size: 130.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11073f487c3b39ac3aff4b2f8803291811ef5c0db2095d5fd6e6dfa941af6257
|
|
| MD5 |
ddd5d8534e22287b2b6bfbfe586e8852
|
|
| BLAKE2b-256 |
3c03a800281aec8f6160e069eb2dbf6eb8012ba914508e2bbb6e782a62f4fcd4
|