{
  "openapi": "3.1.0",
  "info": {
    "title": "OriginTensor Developer API",
    "version": "1.0.0",
    "description": "Open-weight LLM inference API supporting OpenAI /v1/chat/completions, native Anthropic /v1/messages with 1:1 Prompt Cache pass-through, open-weight image generation, and public Intel TDX aci/1 hardware attestation.",
    "contact": {
      "name": "OriginTensor Support",
      "email": "support@origintensor.com",
      "url": "https://origintensor.com/"
    }
  },
  "servers": [
    {
      "url": "https://api.origintensor.com",
      "description": "Production Inference API Gateway"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "OriginTensor API Key (sk-...) for OpenAI-compatible endpoints"
      },
      "AnthropicApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "OriginTensor API Key (sk-...) for native Anthropic /v1/messages"
      }
    }
  },
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "summary": "Create chat completion (OpenAI-compatible)",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "glm-5.3"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  },
                  "max_tokens": {
                    "type": "integer",
                    "example": 4096
                  },
                  "temperature": {
                    "type": "number",
                    "example": 0.7
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "response_format": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion JSON or text/event-stream SSE"
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "summary": "Create message (Native Anthropic Messages protocol with cache_control)",
        "security": [
          {
            "AnthropicApiKey": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "default": "2023-06-01"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "max_tokens",
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "glm-5.3"
                  },
                  "max_tokens": {
                    "type": "integer",
                    "example": 1024
                  },
                  "system": {
                    "description": "String or content blocks with cache_control"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Anthropic Message object or SSE event stream"
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "summary": "List active models accessible by current API key",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OpenAI-format model list"
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "summary": "Generate images using open-weight Flux / SDXL / Seedream / Vector models",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "flux-2-flash"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "size": {
                    "type": "string",
                    "example": "1024x1024"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "url",
                      "b64_json"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated image URL or base64 JSON"
          }
        }
      }
    },
    "/v1/tee/attestation": {
      "get": {
        "summary": "Public zero-login Intel TDX aci/1 hardware attestation & TEE model registry",
        "parameters": [
          {
            "name": "model",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "glm-5.3-uncensored-private"
            }
          },
          {
            "name": "nonce",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "64-char hex (32-byte random nonce)"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Live TEE model registry or signed Intel TDX aci/1 quote bound to caller nonce"
          }
        }
      }
    }
  }
}
