{"openapi":"3.1.0","info":{"title":"Schema Gateway API","version":"0.1.3","description":"Prepaid machine-to-machine API for structured output normalization, repair, and signed responses."},"servers":[{"url":"https://schema-gateway.example"}],"paths":{"/health":{"get":{"summary":"Health check","responses":{"200":{"description":"Worker status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"storage":{"type":"string"},"ephemeralStorageAllowed":{"type":"boolean"},"starterAccessConfigured":{"type":"boolean"},"starterAccessIssues":{"type":"array","items":{"type":"string"}},"starterAccessWarnings":{"type":"array","items":{"type":"string"}}},"required":["ok","storage","ephemeralStorageAllowed","starterAccessConfigured","starterAccessIssues","starterAccessWarnings"]}}}}}}},"/v1/demo/compile":{"post":{"summary":"Run the public compiler demo","description":"Compiles a small schema into provider-ready request fragments without an API key. Intended for interactive evaluation before purchase.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"schema":{"type":"object","additionalProperties":true},"targets":{"type":"array","items":{"type":"string","enum":["openai","gemini","anthropic","ollama"]}},"name":{"type":"string"},"description":{"type":"string"},"prompt":{"type":"string"}},"required":["schema"]}}}},"responses":{"200":{"description":"Signed demo compilation bundle"},"400":{"description":"Invalid JSON or request body"},"413":{"description":"Demo body or schema exceeded size limits"}}}},"/v1/demo/diff":{"post":{"summary":"Run the public schema regression demo","description":"Compares two small schemas and reports provider-specific portability regressions without an API key. Intended for interactive evaluation before purchase.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"baselineSchema":{"type":"object","additionalProperties":true},"candidateSchema":{"type":"object","additionalProperties":true},"targets":{"type":"array","items":{"type":"string","enum":["openai","gemini","anthropic","ollama"]}}},"required":["baselineSchema","candidateSchema"]}}}},"responses":{"200":{"description":"Signed demo regression report"},"400":{"description":"Invalid JSON or request body"},"413":{"description":"Demo body or schema exceeded size limits"}}}},"/v1/access/redeem":{"post":{"summary":"Redeem an on-chain purchase receipt for an API key","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"txHash":{"type":"string","pattern":"^0x[a-fA-F0-9]{64}$"},"label":{"type":"string","minLength":3,"maxLength":64},"chainId":{"type":"integer"}},"required":["txHash","label"]}}}},"responses":{"201":{"description":"A newly issued API key and credit balance"},"409":{"description":"The transaction has already been redeemed"}}}},"/v1/access/polar/claim":{"post":{"summary":"Claim paid access for a Polar order","description":"Verifies a paid Polar Starter Access order live and returns a stateless signed API key with time-boxed access.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"orderId":{"type":"string"},"email":{"type":"string","format":"email"}},"required":["orderId","email"]}}}},"responses":{"200":{"description":"Issued stateless signed API key and expiry for the matching order"},"403":{"description":"Email or product does not match the paid Polar order"},"404":{"description":"No matching Polar order was found"},"409":{"description":"Polar order is missing a recognized paid status or is not in an accepted paid state"},"503":{"description":"Starter Access claim is misconfigured server-side"}}}},"/v1/webhooks/polar":{"post":{"summary":"Receive Polar billing webhooks","description":"Acknowledges Polar billing webhooks. Starter Access entitlements are claimed live from paid orders and are not provisioned from webhook state in the launch model.","responses":{"202":{"description":"Webhook acknowledged but ignored for stateless Starter Access"}}}},"/v1/normalize":{"post":{"summary":"Normalize a provider payload against a JSON Schema","security":[{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["generic","openai","langchain","ollama"]},"schema":{"type":"object","additionalProperties":true},"payload":{}},"required":["schema","payload"]}}}},"responses":{"200":{"description":"Signed normalization result"},"401":{"description":"Missing or invalid API key"},"402":{"description":"API key has no credits remaining"}}}},"/v1/compile":{"post":{"summary":"Compile a schema into provider-ready request fragments","description":"Returns provider-specific request payloads for OpenAI, Gemini, Anthropic, and Ollama, together with signed metadata and remaining credits.","security":[{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"schema":{"type":"object","additionalProperties":true},"targets":{"type":"array","items":{"type":"string","enum":["openai","gemini","anthropic","ollama"]}},"name":{"type":"string"},"description":{"type":"string"},"prompt":{"type":"string"}},"required":["schema"]}}}},"responses":{"200":{"description":"Signed provider compilation bundle"},"401":{"description":"Missing or invalid API key"},"402":{"description":"API key has no credits remaining"}}}},"/v1/diff":{"post":{"summary":"Compare two schemas for provider portability regressions","description":"Returns provider-specific introduced issues, resolved issues, score deltas, and generic schema change risks so CI can catch regressions before rollout.","security":[{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"baselineSchema":{"type":"object","additionalProperties":true},"candidateSchema":{"type":"object","additionalProperties":true},"targets":{"type":"array","items":{"type":"string","enum":["openai","gemini","anthropic","ollama"]}}},"required":["baselineSchema","candidateSchema"]}}}},"responses":{"200":{"description":"Signed schema regression report"},"401":{"description":"Missing or invalid API key"},"402":{"description":"API key has no credits remaining"}}}},"/v1/lint":{"post":{"summary":"Lint a schema for provider portability","description":"Returns provider-specific compatibility diagnostics and auto-rewritten schema variants for OpenAI, Gemini, Anthropic, and Ollama.","security":[{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"schema":{"type":"object","additionalProperties":true},"targets":{"type":"array","items":{"type":"string","enum":["openai","gemini","anthropic","ollama"]}}},"required":["schema"]}}}},"responses":{"200":{"description":"Signed portability report"},"401":{"description":"Missing or invalid API key"},"402":{"description":"API key has no credits remaining"}}}}},"components":{"securitySchemes":{"apiKeyHeader":{"type":"apiKey","in":"header","name":"x-api-key"}}}}