{
  "openapi": "3.1.0",
  "info": {
    "title": "Try AI API Gateway Public API",
    "version": "2026-04-24",
    "description": "Public reference for the API-facing surfaces documented on /docs. Runtime behavior remains governed by the NewAPI customer-facing gateway and the Try AI API operations runbook."
  },
  "servers": [
    {
      "url": "https://tryaiapi.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/generations/{task_id}": {
      "get": {
        "summary": "Poll a visual-model video job",
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "task_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"
            }
          },
          "reasoning_effort": {
            "type": "string",
            "enum": ["low", "medium", "high"],
            "description": "OpenAI reasoning effort level. Supported on reasoning-capable models (e.g. gpt-5.5). Default: medium."
          }
        }
      },
      "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
          },
          "thinking": {
            "type": "object",
            "description": "Anthropic extended thinking. Enable with {\"type\": \"enabled\", \"budget_tokens\": N} (N >= 1024). Supported on claude-sonnet-4-6 and claude-opus-4-x. Billed as standard output tokens.",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["enabled", "disabled"]
              },
              "budget_tokens": {
                "type": "integer",
                "minimum": 1024,
                "description": "Maximum thinking token budget. Must be less than max_tokens."
              }
            },
            "required": ["type"]
          }
        }
      },
      "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"],
            "description": "1080p not available for doubao-seedance-2.0-fast",
            "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"
          },
          "image_urls": {
            "type": "array",
            "maxItems": 9,
            "description": "Reference images. Each item is either a URL string (default role = first_frame, image-to-video) or an object {\"url\": \"...\", \"role\": \"first_frame|last_frame|reference_image\"}.",
            "items": {
              "oneOf": [
                { "type": "string", "format": "uri" },
                {
                  "type": "object",
                  "required": ["url"],
                  "properties": {
                    "url": { "type": "string", "format": "uri" },
                    "role": {
                      "type": "string",
                      "enum": ["first_frame", "last_frame", "reference_image"]
                    }
                  }
                }
              ]
            }
          },
          "video_urls": {
            "type": "array",
            "maxItems": 3,
            "description": "Reference videos.",
            "items": { "type": "string", "format": "uri" }
          },
          "audio_urls": {
            "type": "array",
            "maxItems": 3,
            "description": "Reference audio tracks. Cannot be used alone — must be accompanied by image_urls items with role=reference_image or by video_urls. Note: first_frame/last_frame images cannot be combined with audio_urls.",
            "items": { "type": "string", "format": "uri" }
          },
          "generate_audio": {
            "type": "boolean",
            "description": "Whether the output video should include audio. Default false.",
            "default": false
          },
          "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"
            }
          }
        }
      }
    }
  }
}
