{
  "openapi": "3.1.0",
  "info": {
    "title": "AICU API Platform",
    "description": "AI API 統合プラットフォーム（LLM / TTS / Images / X / Certs）。仕様の単一の真実は scripts/gen-api-spec.mjs。",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.aicu.ai"
    }
  ],
  "tags": [
    {
      "name": "Health / Index"
    },
    {
      "name": "Public Stats（公開統計）"
    },
    {
      "name": "週次のお知らせ（メールニュースの素）"
    },
    {
      "name": "LLM (OpenAI 互換)"
    },
    {
      "name": "Jev（TypeSafe・確率を返す）"
    },
    {
      "name": "LLM モデル"
    },
    {
      "name": "TTS / STT"
    },
    {
      "name": "Audio（OpenAI 標準パス別名）"
    },
    {
      "name": "TTS（ElevenLabs 互換パス）"
    },
    {
      "name": "Images（生成・証明・ギャラリー）"
    },
    {
      "name": "動画生成（Video）"
    },
    {
      "name": "Images（OpenAI 同形 /v2.5・SDK は base_url を向けるだけ）"
    },
    {
      "name": "Characters"
    },
    {
      "name": "Services（段階: 社内企画 → 無料 → 企画 → 課金）"
    },
    {
      "name": "X 読み取りゲートウェイ"
    },
    {
      "name": "Certs（AGT）"
    },
    {
      "name": "Me（利用者本人の面・X-AICU-User-Token）"
    },
    {
      "name": "Royalty（支払先ダッシュボード）"
    },
    {
      "name": "API Keys（introspection）"
    },
    {
      "name": "Usage / Credits"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "aicu_live_... API key"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "機械可読の契約（英語・固定）。分岐は必ずこれで。"
              },
              "message": {
                "type": "string",
                "description": "人間可読。所有者の言語（設定→Accept-Language→en）。"
              }
            }
          }
        },
        "description": "エラー応答の共通形。詳細は /docs の ERROR_CODES。"
      }
    },
    "responses": {
      "Error400": {
        "description": "400 — code: `invalid_json` / `invalid_parameter` / `invalid_prefix` / `prompt_required` / `quality_not_priced` / `size_not_priced` / `text_required` / `text_too_long` / `unknown_character` / `unsupported_format` / `unsupported_parameter`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "invalid_json",
                        "invalid_parameter",
                        "invalid_prefix",
                        "prompt_required",
                        "quality_not_priced",
                        "size_not_priced",
                        "text_required",
                        "text_too_long",
                        "unknown_character",
                        "unsupported_format",
                        "unsupported_parameter"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "invalid_json",
                "message": "Request body is not valid JSON."
              }
            }
          }
        }
      },
      "Error401": {
        "description": "401 — code: `invalid_api_key` / `invalid_user_token` / `key_expired` / `key_revoked` / `not_authenticated` / `unauthorized`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "invalid_api_key",
                        "invalid_user_token",
                        "key_expired",
                        "key_revoked",
                        "not_authenticated",
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "invalid_api_key",
                "message": "Invalid API key."
              }
            }
          }
        }
      },
      "Error402": {
        "description": "402 — code: `insufficient_ap` / `service_budget_exhausted` / `service_closed`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "insufficient_ap",
                        "service_budget_exhausted",
                        "service_closed"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "insufficient_ap",
                "message": "Insufficient AP balance."
              }
            }
          }
        }
      },
      "Error403": {
        "description": "403 — code: `account_too_new` / `card_required` / `enterprise_manual_approval` / `forbidden_scope` / `model_not_allowed` / `paid_requires_user_billing` / `request_over_key_cap` / `sponsor_stage_no_on_behalf` / `subject_required`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "account_too_new",
                        "card_required",
                        "enterprise_manual_approval",
                        "forbidden_scope",
                        "model_not_allowed",
                        "paid_requires_user_billing",
                        "request_over_key_cap",
                        "sponsor_stage_no_on_behalf",
                        "subject_required"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "account_too_new",
                "message": "The free allowance is for accounts older than the minimum age."
              }
            }
          }
        }
      },
      "Error404": {
        "description": "404 — code: `api_key_not_found` / `model_not_found` / `no_credits_record` / `not_found`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "api_key_not_found",
                        "model_not_found",
                        "no_credits_record",
                        "not_found"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "api_key_not_found",
                "message": "API key not found."
              }
            }
          }
        }
      },
      "Error409": {
        "description": "409 — code: `entry_already_certified`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "entry_already_certified"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "entry_already_certified",
                "message": "A participation certificate already exists for this entry"
              }
            }
          }
        }
      },
      "Error410": {
        "description": "410 — code: `expired` / `gone`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "expired",
                        "gone"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "expired",
                "message": "The generated asset has passed its retention period."
              }
            }
          }
        }
      },
      "Error422": {
        "description": "422 — code: `content_moderated`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "content_moderated"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "content_moderated",
                "message": "The prompt or reference image was declined by the provider's safety system. Retrying the same request will not help; rephrase it (avoid realistic depictions of real people, sexual or violent content)."
              }
            }
          }
        }
      },
      "Error429": {
        "description": "429 — code: `ip_daily_cap` / `rate_limited` / `user_daily_cap`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "ip_daily_cap",
                        "rate_limited",
                        "user_daily_cap"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "ip_daily_cap",
                "message": "This network location has reached today's allowance for this service."
              }
            }
          }
        }
      },
      "Error500": {
        "description": "500 — code: `internal_error`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "internal_error"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "internal_error",
                "message": "Internal server error."
              }
            }
          }
        }
      },
      "Error503": {
        "description": "503 — code: `generation_failed` / `service_stage_unavailable`",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ],
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "enum": [
                        "generation_failed",
                        "service_stage_unavailable"
                      ]
                    }
                  }
                }
              }
            },
            "example": {
              "error": {
                "code": "generation_failed",
                "message": "Generation failed. Please retry."
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/": {
      "get": {
        "operationId": "getRoot",
        "summary": "API index",
        "description": "エンドポイント一覧（この JSON がインデックス）",
        "tags": [
          "Health / Index"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/announce_weekly.json": {
      "get": {
        "operationId": "getAnnounceWeeklyJson",
        "summary": "Weekly announcements",
        "description": "週次のお知らせ（/v1/announce/weekly.json と同じ）",
        "tags": [
          "週次のお知らせ（メールニュースの素）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Health check",
        "description": "ヘルスチェック（api/tts/db/storage の状態）",
        "tags": [
          "Health / Index"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/health"
          }
        ]
      }
    },
    "/health/stats": {
      "get": {
        "operationId": "getHealthStats",
        "summary": "Platform statistics",
        "description": "プラットフォーム統計",
        "tags": [
          "Health / Index"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/announce/weekly.json": {
      "get": {
        "operationId": "getV1AnnounceWeeklyJson",
        "summary": "Weekly announcements feed",
        "description": "週次のお知らせ（ja/en・markdown と html つき）",
        "tags": [
          "週次のお知らせ（メールニュースの素）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/audio/estimate": {
      "post": {
        "operationId": "postV1AudioEstimate",
        "summary": "Estimate speech cost - alias",
        "description": "= /v1/tts/estimate の別名",
        "tags": [
          "Audio（OpenAI 標準パス別名）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "text": "こんにちは、AICUです",
                "voice": "nao"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "text_length": 12,
                  "estimated_duration_sec": 2,
                  "ap_cost": 3,
                  "jpy_cost": 3,
                  "pricing": {
                    "rate": "1,000文字 = 200 AP（$0.0200）",
                    "note": "入力文字数で課金します"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/audio/estimate \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\":\"こんにちは、AICUです\",\"voice\":\"nao\"}'"
          }
        ]
      }
    },
    "/v1/audio/generate": {
      "post": {
        "operationId": "postV1AudioGenerate",
        "summary": "Text to speech - alias",
        "description": "= /v1/tts/generate の別名",
        "tags": [
          "Audio（OpenAI 標準パス別名）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "tts",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "text": "こんにちは、AICUです",
                "slug": "nao"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "x-aicu-ap-cost": {
                "schema": {
                  "type": "string"
                },
                "example": "3"
              },
              "x-aicu-model": {
                "schema": {
                  "type": "string"
                },
                "example": "eleven_multilingual_v2"
              },
              "x-aicu-voice": {
                "schema": {
                  "type": "string"
                },
                "example": "nao"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/audio/generate \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\":\"こんにちは、AICUです\",\"slug\":\"nao\"}' \\\n  --output out.mp3"
          }
        ]
      }
    },
    "/v1/audio/speech": {
      "post": {
        "operationId": "postV1AudioSpeech",
        "summary": "Text to speech - OpenAI path",
        "description": "= /v1/tts/speech の別名（OpenAI 標準パス）",
        "tags": [
          "Audio（OpenAI 標準パス別名）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "tts",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "input": "こんにちは、AICUです",
                "voice": "nao"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "x-aicu-ap-cost": {
                "schema": {
                  "type": "string"
                },
                "example": "3"
              },
              "x-aicu-model": {
                "schema": {
                  "type": "string"
                },
                "example": "eleven_multilingual_v2"
              },
              "x-aicu-voice": {
                "schema": {
                  "type": "string"
                },
                "example": "nao"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/audio/speech \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"input\":\"こんにちは、AICUです\",\"voice\":\"nao\"}' \\\n  --output out.mp3"
          }
        ]
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "operationId": "postV1AudioTranscriptions",
        "summary": "Transcribe audio - OpenAI path",
        "description": "= /v1/tts/transcriptions の別名（OpenAI 互換・推奨。仕様は /skills/stt）",
        "tags": [
          "Audio（OpenAI 標準パス別名）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "tts",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "response_format": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "model": "whisper-large-v3-turbo",
                "file": "@clip.mp3",
                "response_format": "json"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "text": "こんにちは、AICUです",
                  "model": "whisper-large-v3-turbo"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/audio/transcriptions \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -F model=\"whisper-large-v3-turbo\" \\\n  -F file=@clip.mp3 \\\n  -F response_format=\"json\""
          }
        ]
      }
    },
    "/v1/audio/voices": {
      "get": {
        "operationId": "getV1AudioVoices",
        "summary": "List voices - OpenAI path",
        "description": "= /v1/tts/voices の別名（要キー）",
        "tags": [
          "Audio（OpenAI 標準パス別名）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "voices": [
                    {
                      "id": "nao",
                      "name": "ナオ・ヴェルデ",
                      "tagline": "優しい理系男子のソフトボイス",
                      "provider": "elevenlabs"
                    },
                    {
                      "id": "marsha",
                      "name": "マーシャ・アランチャ",
                      "tagline": "…",
                      "provider": "elevenlabs"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/audio/voices \\\n  -H \"Authorization: Bearer $AICU_API_KEY\""
          }
        ]
      }
    },
    "/v1/certs": {
      "get": {
        "operationId": "getV1Certs",
        "summary": "List your certificates",
        "description": "自分の発行済み一覧。?status=pending は承認者(approver_sub∈CERT_APPROVER_SUBS)のみ全件",
        "tags": [
          "Certs（AGT）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "cert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      },
      "post": {
        "operationId": "postV1Certs",
        "summary": "Issue a certificate",
        "description": "参加賞（Contest）対応: 証明書発行（status:pending で申請中登録＝課金なし・押印待ち。source=create は GALLERY_SUBMIT_AP 消費）。notify_email は申請（pending）と source=award/create/permit で必須、lecture/contest は猶予中で警告つき（#618）",
        "tags": [
          "Certs（AGT）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "cert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/certs/{certId}": {
      "get": {
        "operationId": "getV1CertsByCertId",
        "summary": "Verify a certificate",
        "description": "証明書の公開検証（status/approved_by/approved_at/record_sha256 を含む）",
        "tags": [
          "Certs（AGT）"
        ],
        "parameters": [
          {
            "name": "certId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/certs/{certId}/approve": {
      "post": {
        "operationId": "postV1CertsByCertIdApprove",
        "summary": "Approve a certificate",
        "description": "承認者が押印して発行（approved_by/at・record_sha256）。承認者のみ・#433",
        "tags": [
          "Certs（AGT）"
        ],
        "parameters": [
          {
            "name": "certId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "cert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/certs/{certId}/claim": {
      "post": {
        "operationId": "postV1CertsByCertIdClaim",
        "summary": "Claim a certificate",
        "description": "保有者の申告（X-AICU-User-Token の sub を pending claim として記録。自動照合なし・#495）",
        "tags": [
          "Certs（AGT）"
        ],
        "parameters": [
          {
            "name": "certId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "cert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/certs/{certId}/claim/approve": {
      "post": {
        "operationId": "postV1CertsByCertIdClaimApprove",
        "summary": "Approve a claim",
        "description": "承認者が申告を確定 → holder_sub（X-Cert-Approve-Secret＋approver_sub・#495）",
        "tags": [
          "Certs（AGT）"
        ],
        "parameters": [
          {
            "name": "certId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "cert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/certs/{certId}/claim/reject": {
      "post": {
        "operationId": "postV1CertsByCertIdClaimReject",
        "summary": "Reject a claim",
        "description": "承認者が申告を却下（#495）",
        "tags": [
          "Certs（AGT）"
        ],
        "parameters": [
          {
            "name": "certId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "cert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/certs/{certId}/image": {
      "post": {
        "operationId": "postV1CertsByCertIdImage",
        "summary": "Attach a certificate image",
        "description": "証書画像を発行後に紐づける（cert_image_url。noai-cert.aicu.ai の URL のみ・発行者本人の鍵のみ・取り消し済みは拒否）",
        "tags": [
          "Certs（AGT）"
        ],
        "parameters": [
          {
            "name": "certId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "cert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/certs/{certId}/revoke": {
      "post": {
        "operationId": "postV1CertsByCertIdRevoke",
        "summary": "Revoke a certificate",
        "description": "証明書の失効（**発行者本人の鍵、または承認者**だけ。#527）",
        "tags": [
          "Certs（AGT）"
        ],
        "parameters": [
          {
            "name": "certId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "cert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/char": {
      "get": {
        "operationId": "getV1Char",
        "summary": "List public characters",
        "description": "公開キャラクター一覧",
        "tags": [
          "Characters"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/char/{id}": {
      "get": {
        "operationId": "getV1CharById",
        "summary": "Get a character",
        "description": "キャラクター詳細（char_id または slug）",
        "tags": [
          "Characters"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "operationId": "postV1ChatCompletions",
        "summary": "Chat completions",
        "description": "チャット補完（OpenAI 互換・stream 対応）",
        "tags": [
          "LLM (OpenAI 互換)"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "llm",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "model": "gpt-5.6-sol",
                "messages": [
                  {
                    "role": "user",
                    "content": "Say hello in one short sentence."
                  }
                ],
                "max_tokens": 40
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "chatcmpl-…",
                  "object": "chat.completion",
                  "created": 1789366971,
                  "model": "gpt-5.6-sol",
                  "choices": [
                    {
                      "index": 0,
                      "message": {
                        "role": "assistant",
                        "content": "Hello!"
                      },
                      "finish_reason": "stop"
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 13,
                    "completion_tokens": 5,
                    "total_tokens": 18
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/chat/completions \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\":\"gpt-5.6-sol\",\"messages\":[{\"role\":\"user\",\"content\":\"Say hello in one short sentence.\"}],\"max_tokens\":40}'"
          }
        ]
      }
    },
    "/v1/chat/models": {
      "get": {
        "operationId": "getV1ChatModels",
        "summary": "List LLM models",
        "description": "LLM モデル一覧（D1 llm_models = 単価の SSoT）",
        "tags": [
          "LLM (OpenAI 互換)"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "object": "list",
                  "updated_at": "2026-09-12",
                  "data": [
                    {
                      "id": "gpt-5.6-sol",
                      "object": "model",
                      "type": "chat",
                      "endpoint": "POST /v1/chat/completions",
                      "max_tokens": 128000,
                      "pricing": {
                        "unit": "per_1k_tokens",
                        "ap_in_per_1k": 9,
                        "ap_out_per_1k": 27
                      }
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/chat/models"
          }
        ]
      }
    },
    "/v1/el/tts": {
      "post": {
        "operationId": "postV1ElTts",
        "summary": "Text to speech - ElevenLabs path",
        "description": "TTS（ElevenLabs 互換面。model で eleven_multilingual_v2 / eleven_v3 を選択）",
        "tags": [
          "TTS（ElevenLabs 互換パス）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "tts",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "text": "[excited] いりぐちはどちらですか？",
                "voice": "nao",
                "model": "eleven_v3"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "x-aicu-model": {
                "schema": {
                  "type": "string"
                },
                "example": "eleven_v3"
              },
              "x-aicu-voice": {
                "schema": {
                  "type": "string"
                },
                "example": "nao"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/el/tts \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\":\"[excited] いりぐちはどちらですか？\",\"voice\":\"nao\",\"model\":\"eleven_v3\"}' \\\n  --output out.mp3"
          }
        ]
      }
    },
    "/v1/el/voices": {
      "get": {
        "operationId": "getV1ElVoices",
        "summary": "List ElevenLabs voices",
        "description": "ElevenLabs 提供分のボイス一覧（要キー・さくらボイスは含まない）",
        "tags": [
          "TTS（ElevenLabs 互換パス）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "voices": [
                    {
                      "id": "nao",
                      "name": "ナオ・ヴェルデ"
                    },
                    {
                      "id": "marsha",
                      "name": "マーシャ・アランチャ"
                    }
                  ],
                  "models": [
                    "eleven_multilingual_v2",
                    "eleven_v3"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/el/voices \\\n  -H \"Authorization: Bearer $AICU_API_KEY\""
          }
        ]
      }
    },
    "/v1/images/{id}/certify": {
      "post": {
        "operationId": "postV1ImagesByIdCertify",
        "summary": "Certify a selected image",
        "description": "採用画像を cert.aicu.ai で証明書化",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/beacon": {
      "get": {
        "operationId": "getV1ImagesBeacon",
        "summary": "Certificate page view beacon",
        "description": "証明書ページの PV ビーコン（204）",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/candidate/{id}": {
      "get": {
        "operationId": "getV1ImagesCandidateById",
        "summary": "Get a candidate image",
        "description": "候補画像の取得",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/cert/{id}": {
      "get": {
        "operationId": "getV1ImagesCertById",
        "summary": "Verify a v.aicu.ai certificate",
        "description": "旧形式証明書の検証（v.aicu.ai）",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/characters": {
      "get": {
        "operationId": "getV1ImagesCharacters",
        "summary": "List character presets",
        "description": "キャラクターピッカー一覧",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      },
      "post": {
        "operationId": "postV1ImagesCharacters",
        "summary": "Register a character preset",
        "description": "キャラクター登録",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/edits": {
      "post": {
        "operationId": "postV1ImagesEdits",
        "summary": "Edit an image",
        "description": "画像編集（generations と同ハンドラ・参照画像/複数参照 reference_images[]・詳細モード同上）",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "model": "gpt-image-2.5-flare",
                "prompt": "Same character, autumn bookstore background",
                "size": "1536x1024",
                "quality": "high",
                "reference_image": "<base64 PNG>"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "3c960601-…",
                  "data": [
                    {
                      "b64_json": "iVBORw0KGgo…",
                      "url": "https://api.aicu.ai/v1/images/file/3c960601-…"
                    }
                  ],
                  "cached": false,
                  "ap_cost": 5100
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/images/edits \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\":\"gpt-image-2.5-flare\",\"prompt\":\"Same character, autumn bookstore background\",\"size\":\"1536x1024\",\"quality\":\"high\",\"reference_image\":\"<base64 PNG>\"}'"
          }
        ]
      }
    },
    "/v1/images/file/{id}": {
      "get": {
        "operationId": "getV1ImagesFileById",
        "summary": "Get a generated image",
        "description": "生成画像の取得",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/gallery": {
      "get": {
        "operationId": "getV1ImagesGallery",
        "summary": "Public gallery",
        "description": "公開ギャラリー（?character=&limit=&offset=）",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/gallery/{id}": {
      "get": {
        "operationId": "getV1ImagesGalleryById",
        "summary": "Get a gallery image",
        "description": "ギャラリー画像バイト列（R2）",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "operationId": "postV1ImagesGenerations",
        "summary": "Generate images",
        "description": "画像生成（OpenAI 互換・gpt-image-2 / 2.5・詳細パラメータ対応）",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "model": "gpt-image-2.5-flare",
                "prompt": "A friendly robot mascot, flat illustration",
                "size": "1024x1024",
                "quality": "low"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "3c960601-…",
                  "data": [
                    {
                      "b64_json": "iVBORw0KGgo…",
                      "url": "https://api.aicu.ai/v1/images/file/3c960601-…"
                    }
                  ],
                  "cached": false,
                  "ap_cost": 700
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/images/generations \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\":\"gpt-image-2.5-flare\",\"prompt\":\"A friendly robot mascot, flat illustration\",\"size\":\"1024x1024\",\"quality\":\"low\"}'"
          }
        ]
      }
    },
    "/v1/images/inspect": {
      "post": {
        "operationId": "postV1ImagesInspect",
        "summary": "Detect C2PA provenance",
        "description": "C2PA 埋め込み検出（PNG caBX/JUMBF）",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/license/{token}": {
      "get": {
        "operationId": "getV1ImagesLicenseByToken",
        "summary": "Verify an image license",
        "description": "ライセンス検証（PII なし）",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/models": {
      "get": {
        "operationId": "getV1ImagesModels",
        "summary": "List image models",
        "description": "画像モデル一覧。応答の recommended が既定として勧めるモデル（アプリはこれを読む）",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "id": "gpt-image-2.5-flare",
                      "object": "model",
                      "owned_by": "openai",
                      "supports_reference_image": true,
                      "typical_latency_s": 85,
                      "may_exceed_gateway_timeout": true
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/images/models"
          }
        ]
      }
    },
    "/v1/images/recent": {
      "get": {
        "operationId": "getV1ImagesRecent",
        "summary": "Your recent generations",
        "description": "自分の生成履歴",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "3c960601-…",
                      "model": "gpt-image-2.5-flare",
                      "size": "1920x1008",
                      "quality": "high",
                      "visibility": "public",
                      "ap_cost": 5100,
                      "latency_ms": 24689,
                      "created_at": "2026-09-14 05:21:49",
                      "url": "https://api.aicu.ai/v1/images/file/3c960601-…"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/images/recent?limit=1 \\\n  -H \"Authorization: Bearer $AICU_API_KEY\""
          }
        ]
      }
    },
    "/v1/images/select": {
      "post": {
        "operationId": "postV1ImagesSelect",
        "summary": "Select a candidate image",
        "description": "候補から採用を選択",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/sets/{id}": {
      "get": {
        "operationId": "getV1ImagesSetsById",
        "summary": "Get a generation set",
        "description": "生成セットの取得",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/images/status/{id}": {
      "get": {
        "operationId": "getV1ImagesStatusById",
        "summary": "Get image generation status",
        "description": "生成の状態と成果物（JSON・id でポーリング。stream の X-AICU-Image-Id で 524 前に id 取得・#404）",
        "tags": [
          "Images（生成・証明・ギャラリー）"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "3c960601-…",
                  "status": "completed",
                  "ap_cost": 5100,
                  "created_at": "2026-09-14 05:21:49",
                  "data": [
                    {
                      "b64_json": "iVBORw0KGgo…",
                      "url": "https://api.aicu.ai/v1/images/file/3c960601-…"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/images/status/3c960601-23f3-478f-a105-f92b3bce1868 \\\n  -H \"Authorization: Bearer $AICU_API_KEY\""
          }
        ]
      }
    },
    "/v1/jev": {
      "post": {
        "operationId": "postV1Jev",
        "summary": "Typed answers with confidence",
        "description": "TypeSafe の Jev（`typesafe/jev`）。Choice / Score / Noul を**確率**で返す（結論ではない）。基本 2 AP ＋ 入力 1,000 文字ごとに 1 AP・2026-09-21 00:00 UTC 発効・失敗は返金",
        "tags": [
          "Jev（TypeSafe・確率を返す）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "llm",
        "x-aicu-units": 2,
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/keys/self": {
      "get": {
        "operationId": "getV1KeysSelf",
        "summary": "Inspect the current key",
        "description": "自分の鍵のメタデータ（introspection・失効日/残日数/スコープ/請求先/環境。シークレット値は返さない）",
        "tags": [
          "API Keys（introspection）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "key_id": "…",
                  "key_prefix": "aicu_live_xxxxx",
                  "name": "my-app",
                  "active": true,
                  "scopes": [
                    "tts",
                    "llm",
                    "images"
                  ],
                  "expires_at": null,
                  "days_until_expiry": null,
                  "billing": "aicu-inc-alpha",
                  "rate_limit_rpm": 60,
                  "limits": {
                    "daily_spend_cap_ap": null,
                    "max_ap_per_request": null,
                    "allowed_models": null
                  },
                  "created_at": "2026-09-12 10:12:33",
                  "last_used_at": "2026-09-14 06:22:56"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/keys/self \\\n  -H \"Authorization: Bearer $AICU_API_KEY\""
          }
        ]
      }
    },
    "/v1/me/certs": {
      "get": {
        "operationId": "getV1MeCerts",
        "summary": "List my certificates",
        "description": "自分が保有者（holder_sub = sub）の証明書一覧。X-AICU-User-Token 必須・#495",
        "tags": [
          "Me（利用者本人の面・X-AICU-User-Token）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "cert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "getV1Models",
        "summary": "List LLM models - OpenAI path",
        "description": "全モデルの単一の真実（chat / image / tts / stt を type で区別・単価・docs_url・updated_at 同梱・OpenAI 互換、60s edge cache）",
        "tags": [
          "LLM モデル"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/models"
          }
        ]
      }
    },
    "/v1/models/{id}": {
      "get": {
        "operationId": "getV1ModelsById",
        "summary": "Get a model",
        "description": "モデル 1 件（OpenAI 互換 retrieve。画像の別名 flare / sunburst も可）",
        "tags": [
          "LLM モデル"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/models/deepseek-v3"
          }
        ]
      }
    },
    "/v1/models/popularity": {
      "get": {
        "operationId": "getV1ModelsPopularity",
        "summary": "Model Popularity",
        "description": "モデルの人気/トレンド（実利用の直近7日・順位とバッジのみ・件数非公開・15分cache）",
        "tags": [
          "LLM モデル"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/models/popularity"
          }
        ]
      }
    },
    "/v1/royalty/express-login": {
      "post": {
        "operationId": "postV1RoyaltyExpressLogin",
        "summary": "Open the payout dashboard",
        "description": "Stripe Express ホストダッシュボードへの login_link 発行（Connect鍵未設定は501）",
        "tags": [
          "Royalty（支払先ダッシュボード）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/royalty/grants": {
      "get": {
        "operationId": "getV1RoyaltyGrants",
        "summary": "Your payout line items",
        "description": "自分の payee に紐づく付与明細（公開検証URLつき・最大50件）",
        "tags": [
          "Royalty（支払先ダッシュボード）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/royalty/summary": {
      "get": {
        "operationId": "getV1RoyaltySummary",
        "summary": "Your payout summary",
        "description": "支払先の報酬サマリー（当期見込み・繰越・全期間支払済み）",
        "tags": [
          "Royalty（支払先ダッシュボード）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/services/{id}": {
      "get": {
        "operationId": "getV1ServicesById",
        "summary": "Get a service",
        "description": "サービスの段階（stage / charge / stage_until / budget 区分 / 利用者上限の有無 / 利用者向け message）。正確な予算残量は出さない。aicu.ai/create 等が表示に使う",
        "tags": [
          "Services（段階: 社内企画 → 無料 → 企画 → 課金）"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/services/create"
          }
        ]
      }
    },
    "/v1/stats": {
      "get": {
        "operationId": "getV1Stats",
        "summary": "Usage statistics",
        "description": "公開統計（certs/credentials/gc_tokens/generations の件数・無認証・5分 edge cache）",
        "tags": [
          "Public Stats（公開統計）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/stats"
          }
        ]
      }
    },
    "/v1/tts/estimate": {
      "post": {
        "operationId": "postV1TtsEstimate",
        "summary": "Estimate speech cost",
        "description": "TTS コスト見積（課金なし）",
        "tags": [
          "TTS / STT"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "text": "こんにちは、AICUです",
                "voice": "nao"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "text_length": 12,
                  "estimated_duration_sec": 2,
                  "ap_cost": 3,
                  "jpy_cost": 3,
                  "pricing": {
                    "rate": "1,000文字 = 200 AP（$0.0200）",
                    "note": "入力文字数で課金します"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/tts/estimate \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\":\"こんにちは、AICUです\",\"voice\":\"nao\"}'"
          }
        ]
      }
    },
    "/v1/tts/generate": {
      "post": {
        "operationId": "postV1TtsGenerate",
        "summary": "Text to speech",
        "description": "TTS 音声生成（slug でキャラボイス指定）",
        "tags": [
          "TTS / STT"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "tts",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "text": "こんにちは、AICUです",
                "slug": "nao"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "x-aicu-ap-cost": {
                "schema": {
                  "type": "string"
                },
                "example": "3"
              },
              "x-aicu-model": {
                "schema": {
                  "type": "string"
                },
                "example": "eleven_multilingual_v2"
              },
              "x-aicu-voice": {
                "schema": {
                  "type": "string"
                },
                "example": "nao"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/tts/generate \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\":\"こんにちは、AICUです\",\"slug\":\"nao\"}' \\\n  --output out.mp3"
          }
        ]
      }
    },
    "/v1/tts/speech": {
      "post": {
        "operationId": "postV1TtsSpeech",
        "summary": "Text to speech - OpenAI body",
        "description": "TTS（OpenAI /audio/speech 互換ボディ）",
        "tags": [
          "TTS / STT"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "tts",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "input": "こんにちは、AICUです",
                "voice": "nao"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "x-aicu-ap-cost": {
                "schema": {
                  "type": "string"
                },
                "example": "3"
              },
              "x-aicu-model": {
                "schema": {
                  "type": "string"
                },
                "example": "eleven_multilingual_v2"
              },
              "x-aicu-voice": {
                "schema": {
                  "type": "string"
                },
                "example": "nao"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/tts/speech \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"input\":\"こんにちは、AICUです\",\"voice\":\"nao\"}' \\\n  --output out.mp3"
          }
        ]
      }
    },
    "/v1/tts/transcriptions": {
      "post": {
        "operationId": "postV1TtsTranscriptions",
        "summary": "Transcribe audio",
        "description": "STT 文字起こし（whisper-large-v3-turbo・response_format json/verbose_json/text/srt/vtt・timestamp_granularities[] 透過・1リクエスト 30MB/30分・音声10秒=1AP・2026-09-09T05:00Zから3AP）",
        "tags": [
          "TTS / STT"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "tts",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "response_format": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "model": "whisper-large-v3-turbo",
                "file": "@clip.mp3",
                "response_format": "json"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "text": "こんにちは、AICUです",
                  "model": "whisper-large-v3-turbo"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v1/tts/transcriptions \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -F model=\"whisper-large-v3-turbo\" \\\n  -F file=@clip.mp3 \\\n  -F response_format=\"json\""
          }
        ]
      }
    },
    "/v1/tts/voices": {
      "get": {
        "operationId": "getV1TtsVoices",
        "summary": "List voices",
        "description": "ボイス一覧（要キー・無償API対策 2026-08-17）",
        "tags": [
          "TTS / STT"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "voices": [
                    {
                      "id": "nao",
                      "name": "ナオ・ヴェルデ",
                      "tagline": "優しい理系男子のソフトボイス",
                      "provider": "elevenlabs"
                    },
                    {
                      "id": "marsha",
                      "name": "マーシャ・アランチャ",
                      "tagline": "…",
                      "provider": "elevenlabs"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/tts/voices \\\n  -H \"Authorization: Bearer $AICU_API_KEY\""
          }
        ]
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "getV1Usage",
        "summary": "Usage summary",
        "description": "利用サマリ",
        "tags": [
          "Usage / Credits"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/usage/charge": {
      "post": {
        "operationId": "postV1UsageCharge",
        "summary": "Charge AP idempotently",
        "description": "外部アプリからの冪等 AP 消費",
        "tags": [
          "Usage / Credits"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "F",
        "x-aicu-scope": "charge",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/usage/credits": {
      "get": {
        "operationId": "getV1UsageCredits",
        "summary": "Credit balance",
        "description": "クレジット残高（既定は鍵の所有者。X-AICU-User-Token を添えると利用者本人の残高。応答の scope が key/user を名乗る）",
        "tags": [
          "Usage / Credits"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/usage/grant": {
      "post": {
        "operationId": "postV1UsageGrant",
        "summary": "Grant AP",
        "description": "AP 付与（first-party 限定）",
        "tags": [
          "Usage / Credits"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "F",
        "x-aicu-scope": "grant",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/usage/logs": {
      "get": {
        "operationId": "getV1UsageLogs",
        "summary": "Usage logs",
        "description": "利用ログ",
        "tags": [
          "Usage / Credits"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/usage/subjects": {
      "get": {
        "operationId": "getV1UsageSubjects",
        "summary": "List billable subjects",
        "description": "課金対象サブジェクト一覧",
        "tags": [
          "Usage / Credits"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/video/file/{id}": {
      "get": {
        "operationId": "getV1VideoFileById",
        "summary": "Download a video",
        "description": "生成した動画の取得（mp4）",
        "tags": [
          "動画生成（Video）"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "video",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/video/generate": {
      "post": {
        "operationId": "postV1VideoGenerate",
        "summary": "Generate a video",
        "description": "動画生成（キャラクター指定可・本文の @Name でも可・202 で id を返し status をポーリング。AP は開始時に確保し失敗時は全額返却）",
        "tags": [
          "動画生成（Video）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "video",
        "x-aicu-units": "model",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/video/status/{id}": {
      "get": {
        "operationId": "getV1VideoStatusById",
        "summary": "Get video status",
        "description": "動画生成の状態（processing / completed / failed）",
        "tags": [
          "動画生成（Video）"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "video",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/x/search": {
      "get": {
        "operationId": "getV1XSearch",
        "summary": "Search X posts",
        "description": "X 検索 recent（?q=&limit=10・5min cache・成功時のみ課金）",
        "tags": [
          "X 読み取りゲートウェイ"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "x",
        "x-aicu-units": 2250,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "query": "AICU",
                  "posts": [
                    {
                      "id": "2099311063212994603",
                      "text": "…",
                      "created_at": "2026-09-14T01:35:35.000Z",
                      "author_username": "wni_jp",
                      "like_count": 12,
                      "repost_count": 3,
                      "reply_count": 1,
                      "quote_count": 0,
                      "bookmark_count": 2,
                      "has_media": true
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/x/search?q=AICU&limit=10 \\\n  -H \"Authorization: Bearer $AICU_API_KEY\""
          }
        ]
      }
    },
    "/v1/x/status/{id}": {
      "get": {
        "operationId": "getV1XStatusById",
        "summary": "Get an X post",
        "description": "X 単一ポスト（id / text / author / created_at / media[]{type,url,preview_image_url,width,height,alt_text}。10min cache。上流参照 1 回 100 AP・キャッシュヒット 0。2026-09-23〜）。反応の数（like/repost/reply/quote/bookmark/impression）も返す",
        "tags": [
          "X 読み取りゲートウェイ"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "x",
        "x-aicu-units": 100,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "2099311063212994603",
                  "text": "【台風発生予想】…",
                  "author": {
                    "username": "wni_jp",
                    "name": "ウェザーニュース",
                    "profile_image_url": "https://pbs.twimg.com/…"
                  },
                  "created_at": "2026-09-14T01:35:35.000Z",
                  "media": [
                    {
                      "type": "photo",
                      "url": "https://pbs.twimg.com/media/….png",
                      "width": 800,
                      "height": 600
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/x/status/2099311063212994603 \\\n  -H \"Authorization: Bearer $AICU_API_KEY\""
          }
        ]
      }
    },
    "/v1/x/timeline/{username}": {
      "get": {
        "operationId": "getV1XTimelineByUsername",
        "summary": "Get an X user timeline",
        "description": "X ユーザタイムライン（?limit=10・10min cache・成功時のみ課金）",
        "tags": [
          "X 読み取りゲートウェイ"
        ],
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "x",
        "x-aicu-units": 2250,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "username": "AICUai",
                  "posts": [
                    {
                      "id": "2099311063212994603",
                      "text": "…",
                      "created_at": "2026-09-14T01:35:35.000Z",
                      "author_username": "wni_jp",
                      "like_count": 12,
                      "repost_count": 3,
                      "reply_count": 1,
                      "quote_count": 0,
                      "bookmark_count": 2,
                      "has_media": true
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/x/timeline/AICUai?limit=10 \\\n  -H \"Authorization: Bearer $AICU_API_KEY\""
          }
        ]
      }
    },
    "/v1/x/user/{username}": {
      "get": {
        "operationId": "getV1XUserByUsername",
        "summary": "Get an X profile",
        "description": "X プロフィール（12–24h cache。上流参照 1 回 100 AP・キャッシュヒット 0。2026-09-23〜）",
        "tags": [
          "X 読み取りゲートウェイ"
        ],
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "x",
        "x-aicu-units": 100,
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "name": "AICU - つくる人をつくる",
                  "username": "AICUai",
                  "description": "…",
                  "profile_image_url": "https://pbs.twimg.com/…",
                  "public_metrics": {
                    "followers_count": 2691,
                    "following_count": 1404,
                    "tweet_count": 15224
                  },
                  "created_at": "2023-07-17T19:11:53.000Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v1/x/user/AICUai \\\n  -H \"Authorization: Bearer $AICU_API_KEY\""
          }
        ]
      }
    },
    "/v1/x/verify": {
      "post": {
        "operationId": "postV1XVerify",
        "summary": "Verify X account ownership",
        "description": "X 所有証明: 検証 — 作者一致∧コード含有∧@AICUai メンション（status_id/status_url 指定 or search）。member から引き取り",
        "tags": [
          "X 読み取りゲートウェイ"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "x",
        "x-aicu-units": 0,
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v1/x/verify/code": {
      "post": {
        "operationId": "postV1XVerifyCode",
        "summary": "Issue an X ownership code",
        "description": "X 所有証明: 認証コード発行（30分有効・post_text と intent_url 付き。自前コード運用なら不要）",
        "tags": [
          "X 読み取りゲートウェイ"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "x",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        }
      }
    },
    "/v2.5/images/edits": {
      "post": {
        "operationId": "postV25ImagesEdits",
        "summary": "Edit an image",
        "description": "画像編集（OpenAI images.edit 同形: multipart image / image[] / mask。/v1/images/edits に翻訳・再送、応答に created 付与）",
        "tags": [
          "Images（OpenAI 同形 /v2.5・SDK は base_url を向けるだけ）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "size": {
                    "type": "string"
                  },
                  "quality": {
                    "type": "string"
                  },
                  "image": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              },
              "example": {
                "model": "gpt-image-2.5-flare",
                "prompt": "Same character, autumn bookstore background",
                "size": "1536x1024",
                "quality": "high",
                "image": "@ref.png"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "created": 1789366971,
                  "id": "3c960601-…",
                  "data": [
                    {
                      "b64_json": "iVBORw0KGgo…",
                      "url": "https://api.aicu.ai/v1/images/file/3c960601-…"
                    }
                  ],
                  "cached": false,
                  "ap_cost": 5100
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v2.5/images/edits \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -F model=\"gpt-image-2.5-flare\" \\\n  -F prompt=\"Same character, autumn bookstore background\" \\\n  -F size=\"1536x1024\" \\\n  -F quality=\"high\" \\\n  -F image=@ref.png"
          }
        ]
      }
    },
    "/v2.5/images/generations": {
      "post": {
        "operationId": "postV25ImagesGenerations",
        "summary": "Generate an image",
        "description": "画像生成（OpenAI images.generate 同形。/v1/images/generations へ再送、user / response_format は無視）",
        "tags": [
          "Images（OpenAI 同形 /v2.5・SDK は base_url を向けるだけ）"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-aicu-tier": "P",
        "x-aicu-scope": "images",
        "x-aicu-units": "model",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "model": "gpt-image-2.5-flare",
                "prompt": "A friendly robot mascot, flat illustration",
                "size": "1024x1024",
                "quality": "low"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "created": 1789366971,
                  "id": "3c960601-…",
                  "data": [
                    {
                      "b64_json": "iVBORw0KGgo…",
                      "url": "https://api.aicu.ai/v1/images/file/3c960601-…"
                    }
                  ],
                  "cached": false,
                  "ap_cost": 700
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X POST https://api.aicu.ai/v2.5/images/generations \\\n  -H \"Authorization: Bearer $AICU_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\":\"gpt-image-2.5-flare\",\"prompt\":\"A friendly robot mascot, flat illustration\",\"size\":\"1024x1024\",\"quality\":\"low\"}'"
          }
        ]
      }
    },
    "/v2.5/images/models": {
      "get": {
        "operationId": "getV25ImagesModels",
        "summary": "List image models",
        "description": "= /v1/images/models の別名（画像モデル一覧・base_url=/v2.5 のクライアント用）",
        "tags": [
          "Images（OpenAI 同形 /v2.5・SDK は base_url を向けるだけ）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v2.5/images/models"
          }
        ]
      }
    },
    "/v2.5/models": {
      "get": {
        "operationId": "getV25Models",
        "summary": "List models",
        "description": "= /v1/models の別名（OpenAI SDK の base_url=/v2.5 用）",
        "tags": [
          "Images（OpenAI 同形 /v2.5・SDK は base_url を向けるだけ）"
        ],
        "security": [],
        "x-aicu-tier": "V",
        "responses": {
          "200": {
            "description": "OK"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "curl -X GET https://api.aicu.ai/v2.5/models"
          }
        ]
      }
    }
  }
}
