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
Metadata
Release files for ghostcore 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ghostcore-0.1.1.tar.gz | 109.8 kB | Without provenance | Details for ghostcore-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ghostcore-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ghostcore-0.1.1-py3-none-any.whl |
Total release size: 240.2 kB
Release files / ghostcore-0.1.1.tar.gz
| Download URL | ghostcore-0.1.1.tar.gz |
|---|---|
| Size | 109.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca54a81d05673f0c04c794ee5e915c41398229ae65be9dd76799b0d6dd57cb92
|
|
BLAKE2b-256 checksum How to use checksums |
9854a427c492c32666b7ff9229e977b0b4f4e010158b1b03978ae63be937c36f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / ghostcore-0.1.1-py3-none-any.whl
| Download URL | ghostcore-0.1.1-py3-none-any.whl |
|---|---|
| Size | 130.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11073f487c3b39ac3aff4b2f8803291811ef5c0db2095d5fd6e6dfa941af6257
|
|
BLAKE2b-256 checksum How to use checksums |
3c03a800281aec8f6160e069eb2dbf6eb8012ba914508e2bbb6e782a62f4fcd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for ghostcore 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.