{
  "openapi": "3.1.0",
  "info": {
    "title": "OkayPic API",
    "version": "1.0.0",
    "description": "AI video and image generation (MiniMax H3, Seedance, Veo 3.1, GPT Image, Seedream, Gemini). Submit a task, then poll it. Docs: https://okaypic.com/api-docs · https://okaypic.com/api.md"
  },
  "servers": [
    {
      "url": "https://api.okaypic.com"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key from https://okaypic.com/developer"
      }
    }
  },
  "paths": {
    "/api/video/generate": {
      "post": {
        "operationId": "generateVideo",
        "summary": "Submit a video generation task",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "enum": [
                      "minimax-h3",
                      "seedance-2.5",
                      "seedance-2.0",
                      "seedance-2.0-mini",
                      "veo3.1"
                    ]
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "duration": {
                    "type": "integer",
                    "description": "Seconds (per model)"
                  },
                  "ratio": {
                    "type": "string",
                    "examples": [
                      "16:9",
                      "9:16",
                      "1:1"
                    ]
                  },
                  "resolution": {
                    "type": "string",
                    "examples": [
                      "480p",
                      "768p",
                      "720p",
                      "1080p"
                    ]
                  },
                  "media": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "type",
                        "url"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "image",
                            "video",
                            "audio"
                          ]
                        },
                        "url": {
                          "type": "string",
                          "description": "Public https URL or base64 data URI"
                        }
                      }
                    }
                  },
                  "ref_mode": {
                    "type": "string",
                    "enum": [
                      "omni",
                      "first-last",
                      "okay",
                      "lip-sync"
                    ],
                    "description": "minimax-h3 only"
                  },
                  "first_frame": {
                    "type": "string",
                    "description": "minimax-h3 first-last / okay"
                  },
                  "last_frame": {
                    "type": "string",
                    "description": "minimax-h3 first-last / okay"
                  },
                  "optimize_prompt": {
                    "type": "boolean",
                    "description": "minimax-h3"
                  },
                  "seed": {
                    "type": "integer",
                    "description": "minimax-h3"
                  },
                  "tier": {
                    "type": "string",
                    "enum": [
                      "third-party",
                      "official"
                    ],
                    "description": "Seedance"
                  },
                  "variant": {
                    "type": "string",
                    "enum": [
                      "veo3.1-fast",
                      "veo3.1-components",
                      "veo3.1-pro"
                    ],
                    "description": "veo3.1"
                  },
                  "client_request_id": {
                    "type": "string",
                    "maxLength": 255
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task submitted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "taskId": {
                      "type": "string"
                    },
                    "generationId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed"
                      ]
                    },
                    "resultUrls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Balance too low"
          },
          "409": {
            "description": "A request with this idempotency key is still processing"
          },
          "429": {
            "description": "Too many concurrent tasks"
          }
        }
      }
    },
    "/api/video/tasks/{taskId}": {
      "get": {
        "operationId": "getVideoTask",
        "summary": "Poll a video task",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Task state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed",
                        "failed"
                      ]
                    },
                    "progress": {
                      "type": "integer"
                    },
                    "resultUrls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "errorCode": {
                      "type": "string",
                      "enum": [
                        "content_violation",
                        "generation_failed",
                        "no_result",
                        "timeout"
                      ]
                    },
                    "retryable": {
                      "type": "boolean"
                    },
                    "errorMessage": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "video",
                        "image"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Task not found"
          }
        }
      }
    },
    "/api/image/generate": {
      "post": {
        "operationId": "generateImage",
        "summary": "Submit an image generation task",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "enum": [
                      "doubao-seedream-5.0",
                      "gpt-image-2.5",
                      "nano-banana-2.1",
                      "gpt-image-2",
                      "gemini-3-pro-image-preview",
                      "gemini-3.1-flash-image-preview",
                      "gemini-2.5-flash-image"
                    ]
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "ratio": {
                    "type": "string",
                    "examples": [
                      "1:1",
                      "16:9",
                      "9:16"
                    ]
                  },
                  "resolution": {
                    "type": "string",
                    "enum": [
                      "1k",
                      "2k",
                      "4k"
                    ]
                  },
                  "images": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Reference image URLs or data URIs"
                  },
                  "client_request_id": {
                    "type": "string",
                    "maxLength": 255
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task submitted (or completed)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "taskId": {
                      "type": "string"
                    },
                    "generationId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed"
                      ]
                    },
                    "resultUrls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Balance too low"
          },
          "409": {
            "description": "A request with this idempotency key is still processing"
          },
          "429": {
            "description": "Too many concurrent tasks"
          }
        }
      }
    },
    "/api/image/tasks/{taskId}": {
      "get": {
        "operationId": "getImageTask",
        "summary": "Poll a image task",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Task state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed",
                        "failed"
                      ]
                    },
                    "progress": {
                      "type": "integer"
                    },
                    "resultUrls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "errorCode": {
                      "type": "string",
                      "enum": [
                        "content_violation",
                        "generation_failed",
                        "no_result",
                        "timeout"
                      ]
                    },
                    "retryable": {
                      "type": "boolean"
                    },
                    "errorMessage": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "video",
                        "image"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Task not found"
          }
        }
      }
    }
  }
}