{
  "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"
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "summary": "OpenAI-compatible image generation (per-image billed)",
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenerationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OpenAI-compatible image generation response (data array with the generated image)"
          },
          "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/{job_id}": {
      "get": {
        "summary": "Poll a visual-model video job using the poll_url returned by submission",
        "security": [
          {
            "bearerApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "job_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"
            ]
          }
        }
      },
      "ImageGenerationRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "gpt-image-2",
            "description": "Use GET /v1/models for the current callable alias."
          },
          "prompt": {
            "type": "string"
          },
          "size": {
            "type": "string",
            "description": "Accepted for OpenAI SDK compatibility. Does not currently affect the output — actual output size is fixed at approximately 1536x1024 regardless of the requested value (verified 2026-07-13)."
          },
          "quality": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ],
            "description": "OpenAI-standard image rendering fidelity value, accepted for SDK compatibility. Note: the actual rendering quality and price are determined by your account's billing tier (Standard / Fine on the model market), not by this field — the server enforces the tier's quality and this value does not override or upgrade it. See /models for current tiers and pricing."
          }
        }
      },
      "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"
          },
          "generation_type": {
            "type": "string",
            "enum": [
              "omni_reference",
              "first_and_last_frames"
            ],
            "description": "Optional generation mode. 'first_and_last_frames' requires 1-2 image_urls entries in positional order (first entry = first frame, optional second entry = last frame; explicit roles, if provided, must match that order). In this mode video_urls/audio_urls are always ignored (never forwarded upstream) and the job is billed at the no-reference rate — this behavior is uniform across every model that supports the mode. Models that do not support 'first_and_last_frames' reject the request with HTTP 400 naming the model, before any charge or hold is made. 'omni_reference' enables mixed reference media."
          },
          "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"
          }
        }
      },
      "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",
            "description": "Canonical URL for polling this job. Clients should use this returned value instead of constructing a URL."
          },
          "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"
          },
          "request_params": {
            "type": "object",
            "nullable": true,
            "description": "Sanitized copy of the original generation request. Whitelisted fields only: model, prompt, duration, resolution, aspect_ratio, generation_type, image_urls, video_urls, audio_urls, generate_audio, watermark, seed (see VideoGenerationRequest for field shapes). callback_url and any undeclared fields are never returned. Jobs created before this field was recorded return an empty object."
          },
          "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"
            }
          }
        }
      }
    }
  }
}
