{"openapi":"3.1.0","info":{"title":"Screwtape.ai","version":"1.0.0","summary":"Judge Agent as a Service","description":"Screwtape.ai returns a pass, fail, or retry verdict on another agent's output, and scores consensus across several agents, including false-consensus risk. It is the agent validation API, not the arXiv paper also named Screwtape. Authenticate with Authorization: Bearer or, for a single call, an x402 PAYMENT-SIGNATURE header. That payment is $0.005 USDC on Base (eip155:8453) to 0x028Bb9A57B8C27c22f6B39dd00e7eFF1FB60344B, verified and settled through a facilitator. The worker does not hold a private key. When a model key is configured, the default model is openai/gpt-oss-120b, with qwen/qwen3.8-27b tried once if the primary model returns 404 or 5xx. Judged content is not stored unless retain is true. The public spec omits operator-only routes."},"servers":[{"url":"https://screwtape.ai"}],"paths":{"/v1/health":{"get":{"summary":"Health","description":"Liveness. Does not require an API key and does not report secrets.","responses":{"200":{"description":"Service is up.","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/judge":{"post":{"summary":"Judge one agent output","description":"Returns a verdict, a confidence score, reasons, and a request id. Free keys include 100 calls per UTC day. Prepaid credits are used after that. With no API key, the response is 402 and describes an x402 payment of $0.005 USDC on Base, which is verified and settled through a facilitator.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JudgeRequest"},"examples":{"grounded":{"value":{"task":"State the crew size and launch site.","agent_output":"The crew size was 4. The mission launched from Cape Canaveral.","evidence":["The mission launched on 2024-03-01 from Cape Canaveral.","The crew size was 4."],"criteria":["crew size","Cape Canaveral"]}}}}}},"responses":{"200":{"description":"Verdict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JudgeResponse"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}},"401":{"description":"API key was not recognized.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}},"402":{"description":"Payment required. PAYMENT-REQUIRED carries the x402 requirements. A valid payment is verified and settled through a facilitator.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}},"429":{"description":"Daily quota or rate limit exceeded.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}}}}},"/v1/consensus":{"post":{"summary":"Score consensus across agents","description":"Returns the consensus answer, an agreement score, false-consensus risk, and a request id.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsensusRequest"},"examples":{"verbatim":{"value":{"task":"State the crew size.","answers":[{"agent_id":"alpha","output":"The crew size was 4."},{"agent_id":"beta","output":"The crew size was 4."},{"agent_id":"gamma","output":"The crew size was 4."}]}}}}}},"responses":{"200":{"description":"Consensus.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsensusResponse"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}},"401":{"description":"API key was not recognized.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}},"402":{"description":"Payment required. A valid payment is verified and settled through a facilitator.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}},"429":{"description":"Daily quota or rate limit exceeded.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}}}}},"/v1/keys":{"post":{"summary":"Create a free API key","description":"Returns the secret key once. Only a hash is stored. Limited to three active keys per email.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupRequest"},"examples":{"sample":{"value":{"email":"dev@example.com","name":"Local dev"}}}}}},"responses":{"201":{"description":"Key created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupResponse"}}}},"400":{"description":"Invalid signup.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}},"429":{"description":"Signup rate limit or email cap.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}}}}},"/v1/keys/me":{"get":{"summary":"Current key","description":"Usage and credit balance for the Bearer key. The secret is not returned.","responses":{"200":{"description":"Key metadata.","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"API key was not recognized.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}}}},"delete":{"summary":"Delete the current key and its data","description":"Deletes the key hash, daily counters, payment records, and any opt-in retained judgments.","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"API key was not recognized.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}}}}},"/v1/retention":{"get":{"summary":"List opt-in retained calls","description":"Returns calls this key asked to retain. Rows expire after 24 hours.","responses":{"200":{"description":"Retained rows.","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"API key was not recognized.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}}}}},"/v1/retention/{id}":{"delete":{"summary":"Delete one retained call","parameters":[{"name":"id","in":"path","required":true,"description":"Retention id returned when retain was true.","schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"API key was not recognized.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}},"404":{"description":"No such row for this key.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}}}}},"/v1/billing/checkout":{"post":{"summary":"Start a Stripe test-mode checkout","description":"Starter is $30 for 10,000 calls. Builder is $100 for 50,000 calls. Requires a Bearer key. Live-mode Stripe keys are refused. Credits are applied by the webhook, not by the success page.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["pack"],"properties":{"pack":{"type":"string","enum":["starter","builder"]}}},"examples":{"starter":{"value":{"pack":"starter"}}}}}},"responses":{"200":{"description":"Checkout URL.","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"request_id":{"type":"string"}}}}}},"401":{"description":"API key was not recognized.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}},"503":{"description":"Stripe test checkout is not configured, or a live key was refused.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}}}}},"/mcp":{"post":{"summary":"MCP Streamable HTTP","description":"JSON-RPC for initialize, tools/list, and tools/call. Tools are judge and consensus. tools/call uses the same auth and quota as the REST API. GET is reserved and returns 405 because this server does not open an SSE stream.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"examples":{"list":{"value":{"jsonrpc":"2.0","id":1,"method":"tools/list"}}}}}},"responses":{"200":{"description":"JSON-RPC result.","content":{"application/json":{"schema":{"type":"object"}}}},"202":{"description":"Notification accepted.","content":{"application/json":{"schema":{"type":"object"}}}},"402":{"description":"tools/call requires a key or an x402 payment, which is verified and settled through a facilitator.","content":{"application/json":{"schema":{"type":"object","required":["error","message","request_id"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}}}}}}},"components":{"schemas":{"JudgeRequest":{"type":"object","additionalProperties":false,"required":["task","agent_output"],"properties":{"task":{"type":"string"},"agent_output":{"description":"String, or any JSON value canonicalized to a string.","type":"string"},"evidence":{"type":"array","items":{"type":"string"}},"criteria":{"type":"array","items":{"type":"string"}},"retain":{"type":"boolean","description":"When true, and the caller uses an API key, store this request and result for 24 hours. Omitted or false stores nothing. Any non-boolean value is rejected."}}},"JudgeResponse":{"type":"object","required":["verdict","score","reasons","request_id"],"properties":{"verdict":{"type":"string","enum":["pass","fail","retry"]},"score":{"type":"number","minimum":0,"maximum":1},"reasons":{"type":"array","items":{"type":"string"}},"request_id":{"type":"string"},"engine":{"type":"string","enum":["deterministic","llm"]},"retention":{"type":"object"}}},"ConsensusRequest":{"type":"object","additionalProperties":false,"required":["task","answers"],"properties":{"task":{"type":"string"},"answers":{"type":"array","minItems":2,"items":{"type":"object","required":["output"],"properties":{"agent_id":{"type":"string"},"output":{"type":"string"}}}},"retain":{"type":"boolean","description":"When true, and the caller uses an API key, store this request and result for 24 hours. Omitted or false stores nothing. Any non-boolean value is rejected."}}},"ConsensusResponse":{"type":"object","required":["consensus_answer","agreement_score","false_consensus_risk","request_id"],"properties":{"consensus_answer":{"type":"string"},"agreement_score":{"type":"number"},"false_consensus_risk":{"type":"string","enum":["low","medium","high"]},"reasons":{"type":"array","items":{"type":"string"}},"request_id":{"type":"string"}}},"SignupRequest":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"name":{"type":"string"}}},"SignupResponse":{"type":"object","required":["api_key","key","request_id"],"properties":{"api_key":{"type":"string"},"key":{"type":"object"},"request_id":{"type":"string"}}}}}}