Correctover is an embedded LLM API reliability runtime. Install it in 30 seconds and add verified failover with 6-dimension contract validation to any Python or JavaScript application.
pip install correctover==1.1.0
Requires Python 3.9+. Zero external dependencies (only httpx also installs).
npm install correctover
Zero dependencies. Works with Node.js 18+.
from correctover import AIProvider, Contract
provider = AIProvider(
default="openai/gpt-4o",
fallbacks=[
"anthropic/claude-3-opus-20250219",
"google/gemini-2.0-pro-001",
"deepseek/deepseek-chat",
],
# Optional: BYOK credentials
credentials={
"openai": {"api_key": "sk-..."},
"anthropic": {"api_key": "sk-ant-..."},
"google": {"api_key": "AIza..."},
"deepseek": {"api_key": "sk-..."},
}
)
output_schema = {
"type": "object",
"properties": {
"summary": {"type": "string", "minLength": 20},
"confidence": {"type": "number", "minimum": 0, "maximum": 1},
"sources": {"type": "array", "items": {"type": "string"}},
},
"required": ["summary", "confidence"]
}
contracts = [
Contract.structure("response_format", output_schema),
Contract.latency("response_time", max_ms=5000),
Contract.cost("budget", max_cents=0.5),
]
response = provider.complete(
system="You are a technical analyst.",
messages=[{"role": "user", "content": "Analyze this: " + input_text}],
contracts=contracts
)
if response.validated:
print(f"β
{response.provider_used}")
print(f" Latency: {response.latency_ms}ms")
print(f" Cost: {response.cost_cents}c")
print(f" Contracts passed: {len(response.contract_results)}/4")
return response.parsed
else:
print(f"β All providers exhausted")
print(f" Contract report: {response.contract_report}")
return fallback_response()