{
  "openapi":"3.1.0",
  "info":{"title":"MegaRider API","version":"0.2.0","description":"Text inference and partner integration API. Availability and rates are agreed during onboarding.","termsOfService":"https://megarider.pro/terms/","contact":{"email":"independ.app@proton.me","url":"https://megarider.pro"}},
  "servers":[{"url":"https://api.megarider.pro"}],
  "security":[{"bearerAuth":[]}],
  "paths":{
    "/health":{"get":{"summary":"Gateway liveness (not inference readiness)","security":[],"responses":{"200":{"description":"Gateway is running"},"503":{"description":"Gateway is draining"}}}},
    "/status":{"get":{"summary":"Gateway and recent dependency checks","security":[],"responses":{"200":{"description":"Current status snapshot; dependency checks may be absent or stale"}}}},
    "/v1/models":{"get":{"summary":"Available model IDs","responses":{"200":{"description":"OpenAI-compatible model list","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","required":["id","object","owned_by"],"properties":{"id":{"type":"string"},"object":{"const":"model"},"owned_by":{"const":"megarider"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"503":{"description":"Catalog unavailable"}}}},
    "/v1/provider/models":{"get":{"summary":"Partner capability and pricing declaration","description":"OpenRouter provider document schema 2.4. Rates are proposals while is_ready is false. Configure commercial terms before activation.","responses":{"200":{"description":"Provider model documents"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},
    "/v1/chat/completions":{"post":{"summary":"Generate a chat completion","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"Completion JSON, or SSE data events ending in [DONE]. A stream error or early EOF means the response is incomplete.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Invalid or unsupported request"},"401":{"$ref":"#/components/responses/Unauthorized"},"413":{"description":"Request body exceeds 1 MiB"},"415":{"description":"Expected application/json"},"429":{"description":"Rate or concurrent capacity limit","headers":{"Retry-After":{"schema":{"type":"string"}}}},"502":{"description":"Inference service error or invalid upstream response"},"503":{"description":"Dependency unavailable"},"504":{"description":"Request deadline exceeded"}}}}
  },
  "components":{
    "securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},
    "responses":{"Unauthorized":{"description":"Missing or invalid API key"}},
    "schemas":{"ChatRequest":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","description":"Exact ID from GET /v1/models"},"messages":{"type":"array","minItems":1,"items":{"type":"object","required":["role"],"properties":{"role":{"enum":["system","developer","user","assistant","tool"]},"content":{"type":["string","null"]},"tool_calls":{"type":"array"},"tool_call_id":{"type":"string"}}}},"stream":{"type":"boolean","default":false},"max_tokens":{"type":"integer","minimum":1,"maximum":8192,"default":1024},"max_completion_tokens":{"type":"integer","minimum":1,"maximum":8192,"description":"Alias for max_tokens; do not supply both"},"temperature":{"type":"number","minimum":0,"maximum":2},"top_p":{"type":"number","minimum":0,"maximum":1},"tools":{"type":"array","maxItems":64},"tool_choice":{"oneOf":[{"type":"string"},{"type":"object"}]},"stream_options":{"type":"object"},"stop":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"parallel_tool_calls":{"type":"boolean"},"response_format":{"type":"object","properties":{"type":{"const":"text"}},"required":["type"]},"n":{"const":1},"seed":{"type":"integer"},"frequency_penalty":{"type":"number"},"presence_penalty":{"type":"number"}},"additionalProperties":false}}
  }
}
