$git clone https://github.com/yanzai-4/Contrix> Stop writing fragile prompts. > Start building contract-checked AI interfaces.
| 1 |  |
| 2 | |
| 3 | # Contrix |
| 4 | **Contract-first local workflow for structured LLM endpoints, comparison, validation/recovery, and app integration.** |
| 5 | |
| 6 | > Stop writing fragile prompts. |
| 7 | > Start building contract-checked AI interfaces. |
| 8 | |
| 9 | Contrix helps AI engineers, backend/fullstack teams, and product builders turn LLM calls into reliable local JSON APIs they can actually integrate into real software. |
| 10 | |
| 11 | Instead of hand-maintaining fragile prompts, provider-specific schema glue, and custom output parsers, you define endpoint contracts through a GUI, generate spec-driven prompts, compare prompts/models/providers under the same contract, validate outputs, and recover from failures with retry, timeout, fallback, and repair flows. |
| 12 | |
| 13 | It is built for teams that need a structured-output workflow they can design, test, compare, observe, and integrate — not just one-off prompt demos. |
| 14 | |
| 15 | Contrix is not just a wrapper around provider-native structured outputs — it adds a contract-first workflow for comparison, recovery, observability, and integration. |
| 16 | |
| 17 | [](#quick-start) |
| 18 | [](./docs/README.md) |
| 19 | |
| 20 | ## Quick Navigation |
| 21 | - [What This Is](#1-what-this-is) |
| 22 | - [Core Capabilities](#5-core-capabilities) |
| 23 | - [Use Cases](#6-example-use-cases) |
| 24 | - [Why Not Just Call a Model API Directly?](#7-why-not-just-call-a-model-api-directly) |
| 25 | |
| 26 | --- |
| 27 | |
| 28 | ## 1. What This Is |
| 29 | Contrix is a contract-first local control layer for LLM integration. You define endpoint contracts with schemas, field-level requirements, and shared instructions, then Contrix generates spec-driven prompts and serves local runtime endpoints that return validated structured outputs. |
| 30 | |
| 31 | When supported by the provider, Contrix can use native structured outputs / JSON Schema enforcement directly. But Contrix is more than a wrapper around provider-native schema features: it adds prompt/model/provider comparison, validation and recovery flows, observability, and integration-ready local runtime endpoints around the contract itself. |
| 32 | |
| 33 | Why local matters: |
| 34 | - Keep control of runtime behavior and provider configuration |
| 35 | - Test and inspect calls without relying on a hosted orchestration layer |
| 36 | - Integrate faster into existing backend and CI workflows |
| 37 | |
| 38 | ### Product Areas |
| 39 | | Area | What it does | |
| 40 | |---|---| |
| 41 | | Contract Builder | Define endpoint input/output schemas, field-level requirements, and shared instructions through a GUI. | |
| 42 | | Spec & Prompt Compiler | Generates spec-driven prompts from endpoint configuration with traceable structure. | |
| 43 | | Comparison Workflow | Compare prompts, model versions, and providers side by side under the same endpoint contract. | |
| 44 | | Structured Output Runtime | Uses provider-native structured outputs / JSON Schema enforcement when available, while keeping one contract workflow across providers. | |
| 45 | | Validation & Recovery | Checks JSON formatting, required fields, types, and non-empty expectations, then applies repair/retry/timeout/fallback logic when needed. | |
| 46 | | Observability | Records latency, attempts, input/output tokens, cached tokens, and failure context. | |
| 47 | | Integration | Exposes integration-ready local runtime endpoints and generates code examples plus one-click copyable vibe-coding prompts. | |
| 48 | |
| 49 | --- |
| 50 | |
| 51 | ## 2. The Problem |
| 52 | Raw model API integration often fails under production constraints: |
| 53 | |
| 54 | - Output can drift (invalid JSON shape, missing fields, unexpected types) |
| 55 | - Structured output support is provider-specific and tied to each API style |
| 56 | - Prompt, schema, and parser logic becomes scattered across services and scripts |
| 57 | - No built-in validation/recovery path means higher production risk |
| 58 | - Hard to compare prompts/models/providers fairly under one contract |
| 59 | - Weak observability for tokens, cached tokens, latency, retries, and failures |
| 60 | |
| 61 | --- |
| 62 | |
| 63 | ## 3. The Solution |
| 64 | Contrix adds a contract, comparison, validation, and i |