{
  "openapi": "3.1.0",
  "info": {
    "title": "Infwave API Gateway Public API",
    "version": "2026-04-24",
    "description": "Public reference for the API-facing surfaces documented on /docs. Runtime behavior remains governed by Sub2API plus the Infwave Operations Runbook."
  },
  "servers": [
    {
      "url": "https://api.infwave.com"
    }
  ],
  "security": [
    {
      "bearerApiKey": []
    },
    {
      "anthropicApiKey": []
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "summary": "List currently callable model aliases",
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OpenAI-compatible model list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["object", "data"],
                  "properties": {
                    "object": {
                      "type": "string",
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Model"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "summary": "OpenAI-compatible chat completions",
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OpenAI-compatible chat completion or SSE stream when stream=true"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "summary": "Anthropic-compatible Messages API",
        "security": [
          {
            "anthropicApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "example": "2023-06-01"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicMessageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Anthropic-compatible message response or SSE stream when stream=true"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/videos/v1/videos/generations": {
      "post": {
        "summary": "Submit a visual-model video generation job",
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoGenerationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Video job accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoJobAccepted"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/videos/v1/videos/jobs/{id}": {
      "get": {
        "summary": "Poll a visual-model video job",
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current video job state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoJob"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Job not found"
          }
        }
      }
    },
    "/transparency/schema.json": {
      "get": {
        "summary": "Public schema snapshot proving prompt/response content is not stored in the normal database layer",
        "security": [],
        "responses": {
          "200": {
            "description": "Published schema snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerApiKey": {
        "type": "http",
        "scheme": "bearer"
      },
      "anthropicApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "Model": {
        "type": "object",
        "required": ["id", "object"],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "model"
          },
          "owned_by": {
            "type": "string"
          }
        }
      },
      "ChatCompletionRequest": {
        "type": "object",
        "required": ["model", "messages"],
        "properties": {
          "model": {
            "type": "string",
            "description": "Use GET /v1/models for the current callable alias."
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "temperature": {
            "type": "number"
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "AnthropicMessageRequest": {
        "type": "object",
        "required": ["model", "messages", "max_tokens"],
        "properties": {
          "model": {
            "type": "string",
            "description": "Use GET /v1/models or the customer-provided model alias list for current availability."
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "stream": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "VideoGenerationRequest": {
        "type": "object",
        "required": ["model", "prompt"],
        "properties": {
          "model": {
            "type": "string",
            "example": "doubao-seedance-2.0"
          },
          "prompt": {
            "type": "string",
            "maxLength": 2000
          },
          "duration": {
            "type": "integer",
            "minimum": 4,
            "maximum": 15,
            "default": 5
          },
          "resolution": {
            "type": "string",
            "enum": ["480p", "720p", "1080p"],
            "default": "720p",
            "example": "480p"
          },
          "aspect_ratio": {
            "type": "string",
            "enum": ["16:9", "4:3", "1:1", "3:4", "9:16", "21:9", "adaptive"],
            "example": "16:9"
          },
          "generate_audio": {
            "type": "boolean"
          },
          "watermark": {
            "type": "boolean"
          },
          "seed": {
            "type": "integer"
          },
          "callback_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "VideoJobAccepted": {
        "type": "object",
        "required": ["job_id", "status", "poll_url", "created_at"],
        "properties": {
          "job_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "example": "running"
          },
          "poll_url": {
            "type": "string",
            "format": "uri"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "VideoJob": {
        "type": "object",
        "required": ["job_id", "status", "model", "created_at"],
        "properties": {
          "job_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["queued", "running", "completed", "failed", "cancelled", "timeout"]
          },
          "model": {
            "type": "string"
          },
          "video_url": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "error": {
            "type": "object",
            "nullable": true
          },
          "cost_pending": {
            "type": "number"
          },
          "cost_final": {
            "type": "number"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object"
          },
          "detail": {
            "type": "string"
          }
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Invalid or missing API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Quota or upstream rate limit exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    }
  }
}
