{
  "openapi": "3.1.0",
  "info": {
    "title": "Cormak API",
    "version": "2026-11-22",
    "summary": "AI video, image and 3D generation API",
    "description": "REST API for AI video, image and 3D generation paid with Cormak credits. API keys require a Pro, Business or Elite plan; the plan is checked on every request. Docs: https://cormak.app/api/docs",
    "contact": {
      "email": "support@cormak.app",
      "url": "https://cormak.app/contact"
    },
    "termsOfService": "https://cormak.app/terms"
  },
  "servers": [
    {
      "url": "https://api.cormak.app/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/models": {
      "get": {
        "summary": "List models with settings and prices",
        "security": [],
        "responses": {
          "200": {
            "description": "Model catalog"
          }
        }
      }
    },
    "/quote": {
      "post": {
        "summary": "Price a request without starting it",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "video"
                          }
                        },
                        "required": [
                          "kind"
                        ]
                      },
                      {
                        "type": "object",
                        "required": [
                          "prompt"
                        ],
                        "properties": {
                          "model": {
                            "enum": [
                              "veo-3.1-fast",
                              "veo-3.1",
                              "veo-3.1-lite",
                              "seedance-2.5",
                              "seedance-2.0",
                              "seedance-2.0-fast",
                              "kling-3.0-pro",
                              "kling-3.0-standard",
                              "kling-o1",
                              "wan-3.0",
                              "hailuo-3",
                              "flux-3-video",
                              "runway-gen-4.5",
                              "grok-imagine-1.5"
                            ],
                            "default": "veo-3.1-lite"
                          },
                          "prompt": {
                            "type": "string",
                            "maxLength": 2000
                          },
                          "duration_seconds": {
                            "type": "integer",
                            "default": 8
                          },
                          "resolution": {
                            "enum": [
                              "480p",
                              "720p",
                              "1080p",
                              "2k",
                              "4k"
                            ],
                            "default": "720p"
                          },
                          "aspect_ratio": {
                            "enum": [
                              "16:9",
                              "9:16",
                              "1:1",
                              "4:3",
                              "3:4",
                              "21:9"
                            ],
                            "default": "16:9"
                          },
                          "audio": {
                            "type": "boolean",
                            "default": true
                          },
                          "image": {
                            "type": "object",
                            "required": [
                              "mime_type",
                              "data"
                            ],
                            "properties": {
                              "mime_type": {
                                "enum": [
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp"
                                ]
                              },
                              "data": {
                                "type": "string",
                                "description": "Base64, up to about 3 MB decoded."
                              }
                            }
                          },
                          "request_id": {
                            "type": "string",
                            "format": "uuid"
                          }
                        }
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "image"
                          }
                        },
                        "required": [
                          "kind"
                        ]
                      },
                      {
                        "type": "object",
                        "required": [
                          "prompt"
                        ],
                        "properties": {
                          "model": {
                            "enum": [
                              "nano-banana-2",
                              "nano-banana-pro",
                              "seedream-5-pro"
                            ],
                            "default": "nano-banana-2"
                          },
                          "prompt": {
                            "type": "string",
                            "maxLength": 2000
                          },
                          "quality": {
                            "enum": [
                              "standard",
                              "high"
                            ],
                            "default": "standard"
                          },
                          "aspect_ratio": {
                            "enum": [
                              "1:1",
                              "16:9",
                              "9:16",
                              "4:3",
                              "3:4"
                            ],
                            "default": "1:1"
                          },
                          "style": {
                            "enum": [
                              "realistic",
                              "vector",
                              "gold",
                              "neon",
                              "logo"
                            ],
                            "default": "realistic"
                          },
                          "reference_image": {
                            "type": "object",
                            "required": [
                              "mime_type",
                              "data"
                            ],
                            "properties": {
                              "mime_type": {
                                "enum": [
                                  "image/png",
                                  "image/jpeg",
                                  "image/webp"
                                ]
                              },
                              "data": {
                                "type": "string",
                                "description": "Base64, up to about 3 MB decoded."
                              }
                            }
                          },
                          "request_id": {
                            "type": "string",
                            "format": "uuid"
                          }
                        }
                      }
                    ]
                  },
                  {
                    "type": "object",
                    "required": [
                      "kind"
                    ],
                    "properties": {
                      "kind": {
                        "const": "3d"
                      },
                      "model": {
                        "type": "string",
                        "const": "meshy-7.1",
                        "default": "meshy-7.1"
                      },
                      "quality": {
                        "type": "string",
                        "enum": [
                          "basic",
                          "medium",
                          "high"
                        ],
                        "default": "basic",
                        "description": "25, 35 or 50 AI credits before account discounts."
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quote",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "credits": {
                      "type": "integer"
                    },
                    "currency": {
                      "enum": [
                        "ai_credits",
                        "video_credits"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/videos": {
      "post": {
        "summary": "Start a video generation",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Same as request_id in the body."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "enum": [
                      "veo-3.1-fast",
                      "veo-3.1",
                      "veo-3.1-lite",
                      "seedance-2.5",
                      "seedance-2.0",
                      "seedance-2.0-fast",
                      "kling-3.0-pro",
                      "kling-3.0-standard",
                      "kling-o1",
                      "wan-3.0",
                      "hailuo-3",
                      "flux-3-video",
                      "runway-gen-4.5",
                      "grok-imagine-1.5"
                    ],
                    "default": "veo-3.1-lite"
                  },
                  "prompt": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "duration_seconds": {
                    "type": "integer",
                    "default": 8
                  },
                  "resolution": {
                    "enum": [
                      "480p",
                      "720p",
                      "1080p",
                      "2k",
                      "4k"
                    ],
                    "default": "720p"
                  },
                  "aspect_ratio": {
                    "enum": [
                      "16:9",
                      "9:16",
                      "1:1",
                      "4:3",
                      "3:4",
                      "21:9"
                    ],
                    "default": "16:9"
                  },
                  "audio": {
                    "type": "boolean",
                    "default": true
                  },
                  "image": {
                    "type": "object",
                    "required": [
                      "mime_type",
                      "data"
                    ],
                    "properties": {
                      "mime_type": {
                        "enum": [
                          "image/png",
                          "image/jpeg",
                          "image/webp"
                        ]
                      },
                      "data": {
                        "type": "string",
                        "description": "Base64, up to about 3 MB decoded."
                      }
                    }
                  },
                  "request_id": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Job accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "200": {
            "description": "Replay of an existing request_id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan below Pro, AI consent required or account unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or changed quote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Content blocked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate or daily limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/images": {
      "post": {
        "summary": "Start an image generation",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Same as request_id in the body."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "enum": [
                      "nano-banana-2",
                      "nano-banana-pro",
                      "seedream-5-pro"
                    ],
                    "default": "nano-banana-2"
                  },
                  "prompt": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "quality": {
                    "enum": [
                      "standard",
                      "high"
                    ],
                    "default": "standard"
                  },
                  "aspect_ratio": {
                    "enum": [
                      "1:1",
                      "16:9",
                      "9:16",
                      "4:3",
                      "3:4"
                    ],
                    "default": "1:1"
                  },
                  "style": {
                    "enum": [
                      "realistic",
                      "vector",
                      "gold",
                      "neon",
                      "logo"
                    ],
                    "default": "realistic"
                  },
                  "reference_image": {
                    "type": "object",
                    "required": [
                      "mime_type",
                      "data"
                    ],
                    "properties": {
                      "mime_type": {
                        "enum": [
                          "image/png",
                          "image/jpeg",
                          "image/webp"
                        ]
                      },
                      "data": {
                        "type": "string",
                        "description": "Base64, up to about 3 MB decoded."
                      }
                    }
                  },
                  "request_id": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Job accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "200": {
            "description": "Replay of an existing request_id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan below Pro, AI consent required or account unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or changed quote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Content blocked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate or daily limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}": {
      "get": {
        "summary": "Get job status and result",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan below Pro, AI consent required or account unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/3d": {
      "post": {
        "summary": "Start a 3D model generation from a description or one to four photos",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Same as request_id in the body."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Start3D"
              },
              "example": {
                "input_mode": "prompt",
                "prompt": "A single white ceramic mug with a round handle",
                "quality": "basic",
                "expected_max_credits": 25
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Job accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "200": {
            "description": "Replay of an existing request_id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan below Pro, AI consent required or account unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or changed quote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Content blocked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate or daily limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body is too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/jobs": {
      "get": {
        "summary": "List recent jobs",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of jobs"
          },
          "401": {
            "description": "Missing, malformed or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan below Pro, AI consent required or account unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/account": {
      "get": {
        "summary": "Plan, balances and key limits",
        "responses": {
          "200": {
            "description": "Account"
          },
          "401": {
            "description": "Missing, malformed or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan below Pro, AI consent required or account unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/usage": {
      "get": {
        "summary": "Requests and credits spent per day",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Usage"
          },
          "401": {
            "description": "Missing, malformed or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan below Pro, AI consent required or account unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "summary": "List webhooks (manage them in the Cormak dashboard)",
        "responses": {
          "200": {
            "description": "Webhooks"
          },
          "401": {
            "description": "Missing, malformed or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Plan below Pro, AI consent required or account unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "job.completed": {
      "post": {
        "summary": "A job completed",
        "description": "Header Cormak-Signature: t=<unix>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook secret>.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "const": "job.completed"
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "job": {
                        "$ref": "#/components/schemas/Job"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx to acknowledge"
          }
        }
      }
    },
    "job.failed": {
      "post": {
        "summary": "A job failed (credits refunded)",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx to acknowledge"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ck_live_…",
        "description": "API key from the Cormak dashboard (Pro plan and above). X-API-Key is also accepted."
      }
    },
    "schemas": {
      "Job": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "const": "job"
          },
          "kind": {
            "enum": [
              "video",
              "image",
              "3d"
            ]
          },
          "model": {
            "type": "string"
          },
          "status": {
            "enum": [
              "running",
              "complete",
              "failed",
              "unknown"
            ]
          },
          "credits": {
            "type": "integer",
            "description": "Charged credits; 0 until complete."
          },
          "credits_quoted": {
            "type": "integer",
            "description": "Maximum before account discount for 3D."
          },
          "currency": {
            "enum": [
              "ai_credits",
              "video_credits"
            ]
          },
          "error": {
            "type": [
              "object",
              "null"
            ]
          },
          "output": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "mime_type": {
                "type": "string",
                "description": "3D models are returned as model/gltf-binary (GLB)."
              },
              "expires_in": {
                "type": "integer"
              },
              "thumbnail_url": {
                "type": "string",
                "format": "uri",
                "description": "Private preview when available for 3D."
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "progress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Progress when returned for a 3D job."
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        }
      },
      "Start3D": {
        "type": "object",
        "required": [
          "input_mode"
        ],
        "properties": {
          "input_mode": {
            "enum": [
              "prompt",
              "photo"
            ]
          },
          "model": {
            "type": "string",
            "const": "meshy-7.1",
            "default": "meshy-7.1"
          },
          "quality": {
            "type": "string",
            "enum": [
              "basic",
              "medium",
              "high"
            ],
            "default": "basic",
            "description": "25, 35 or 50 AI credits before account discounts."
          },
          "prompt": {
            "type": "string",
            "maxLength": 600,
            "description": "Text description in prompt mode or optional texture note in photo mode."
          },
          "images": {
            "type": "array",
            "minItems": 1,
            "maxItems": 4,
            "description": "Photo mode only. At most 10,000,000 base64 characters total.",
            "items": {
              "type": "object",
              "required": [
                "mime_type",
                "data"
              ],
              "properties": {
                "mime_type": {
                  "enum": [
                    "image/png",
                    "image/jpeg",
                    "image/webp"
                  ]
                },
                "data": {
                  "type": "string",
                  "contentEncoding": "base64",
                  "maxLength": 3000000
                }
              }
            }
          },
          "expected_max_credits": {
            "type": "integer",
            "minimum": 0,
            "description": "Optional spend cap. Returns quote_changed if below the quoted maximum."
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "oneOf": [
          {
            "properties": {
              "input_mode": {
                "const": "prompt"
              },
              "prompt": {
                "minLength": 10
              },
              "images": false
            },
            "required": [
              "prompt"
            ]
          },
          {
            "properties": {
              "input_mode": {
                "const": "photo"
              },
              "prompt": {
                "minLength": 3
              }
            },
            "required": [
              "images"
            ]
          }
        ]
      }
    }
  }
}
