{"openapi":"3.1.0","info":{"title":"UncensoredLabs API","version":"0.1.0","description":"Prepaid OpenAI-compatible chat API. Models must be enabled in the verified catalog. All prices are integer nano-USD. No application prompt or completion retention."},"servers":[{"url":"https://api.example.com","description":"Replace with your configured API domain"},{"url":"http://localhost:8787","description":"Local development mock"}],"paths":{"/health":{"get":{"summary":"Liveness check","responses":{"200":{"description":"Worker is alive"}}}},"/ready":{"get":{"summary":"Database and inference readiness","responses":{"200":{"description":"Ready"},"503":{"description":"Launch gated or unavailable"}}}},"/v1/models":{"get":{"summary":"List approved, enabled models","responses":{"200":{"description":"OpenAI list with verified metadata","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Model"}}}}}}}}}},"/v1/models/{model_id}":{"get":{"summary":"Get an approved model","parameters":[{"name":"model_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Approved model","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model"}}}},"404":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/chat/completions":{"post":{"summary":"Generate a billed chat completion","security":[{"ApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","description":"1–128 safe characters. Reusing a reference returns409 and never reruns inference.","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"OpenAI-compatible JSON completion or SSE deltas ending in data: [DONE]. Trusted usage is required for final settlement. Uncertain responses retain credit for reconciliation.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"chat.completion"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object"}},"usage":{"type":"object"}}}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Structured API error","headers":{"Retry-After":{"description":"Seconds to wait before retrying. Active or pending reservations may also need completion or reconciliation.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Structured API error","headers":{"X-Should-Retry":{"description":"false prevents automatic replay. Inspect activity before retrying an uncertain billable request.","schema":{"type":"string","enum":["false"]}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"ApiKey":{"type":"http","scheme":"bearer","bearerFormat":"ul_<secure-random-secret>"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["message","type","code"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"}}}}},"Model":{"type":"object","properties":{"id":{"type":"string"},"object":{"const":"model"},"owned_by":{"type":"string"},"classification":{"enum":["uncensored","abliterated"]},"context_length":{"type":"integer"},"max_output_tokens":{"type":"integer"},"capabilities":{"type":"array","items":{"enum":["text","streaming","tools"]}},"pricing":{"type":"object","properties":{"input_nano_per_million":{"type":"string"},"cached_nano_per_million":{"type":"string"},"output_nano_per_million":{"type":"string"},"version":{"type":"string"}}}}},"ChatRequest":{"type":"object","additionalProperties":false,"required":["model","messages"],"properties":{"model":{"type":"string","maxLength":200},"messages":{"type":"array","minItems":1,"maxItems":128,"items":{"type":"object","additionalProperties":false,"required":["role"],"properties":{"role":{"enum":["system","developer","user","assistant","tool"]},"content":{"type":["string","null"]},"name":{"type":"string"},"tool_call_id":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object"}}}}},"stream":{"type":"boolean"},"temperature":{"type":"number","minimum":0,"maximum":2},"max_tokens":{"type":"integer","minimum":1,"maximum":131072},"max_completion_tokens":{"type":"integer","minimum":1,"maximum":131072},"top_p":{"type":"number","minimum":0,"maximum":1},"stop":{"oneOf":[{"type":"string"},{"type":"array","maxItems":4,"items":{"type":"string"}}]},"tools":{"type":"array","maxItems":32,"items":{"type":"object"}},"tool_choice":{"oneOf":[{"enum":["auto","none","required"]},{"type":"object"}]},"stream_options":{"type":"object","properties":{"include_usage":{"type":"boolean"}}},"n":{"const":1}}}}}}