{
  "schema_version": 1,
  "generated_at": "2026-11-26",
  "api_version": "v2",
  "source": "Defaults of the orchestrator setting ORCHESTRATOR_API_PLAN_LIMITS, fixed by the accepted design contract goPROMPT/notes/PLAN/api-tokens-and-automation-api.md §4.3. The server reads the same numbers from its settings; this file is the documentation copy.",
  "live_check": {
    "state": "pending-live-e2e",
    "checked_at": null,
    "live_endpoint": "GET /subscription",
    "live_url": "https://api.cloakctl.com/api/v2/automation/subscription",
    "method": "Run the example verifier against the live API with a real token and compare data.limits / data.usage with the values below. Live E2E is the root agent's step; docs-agent does not touch the live contour.",
    "command": "python docs/api/verify_examples.py --base-url https://api.cloakctl.com/api/v2/automation --token-env CLOAKCTL_API_TOKEN --check-limits",
    "compare": [
      {
        "json_path": "data.plan",
        "expect": "plan name observed live; one of start, solo, team, scale (aliases accepted)"
      },
      {
        "json_path": "data.limits.rpm",
        "expect": "plans[data.plan].rpm"
      },
      {
        "json_path": "data.limits.rph",
        "expect": "plans[data.plan].rph"
      },
      {
        "json_path": "data.limits.tokens",
        "expect": "plans[data.plan].token_limit"
      },
      {
        "json_path": "data.usage.tokens_used",
        "expect": "0..data.limits.tokens"
      }
    ]
  },
  "rate_limit_window": {
    "rpm_seconds": 60,
    "rph_seconds": 3600,
    "scope": "account",
    "unknown_plan": "solo",
    "description": {
      "ru": "Окна скользящие: событие живёт 60 или 3600 секунд с момента запроса, а не до границы календарной минуты. Счётчик общий на кабинет — все токены кабинета делят один лимит. Перезапуск процесса оркестратора обнуляет окно (лимитер хранится в памяти, а не в базе).",
      "en": "Windows are sliding: an event lives for 60 or 3600 seconds from the moment of the request, not until a calendar-minute boundary. One shared counter per account: all tokens of the account share the same limit. Restarting the orchestrator process resets the window because the limiter lives in process memory, not in the database."
    }
  },
  "headers": [
    {
      "name": "X-Ratelimit-Limit",
      "description": {
        "ru": "Предел запросов в минуту для тарифа кабинета (RPM).",
        "en": "Requests-per-minute limit of the account plan (RPM)."
      }
    },
    {
      "name": "X-Ratelimit-Limit-Hour",
      "description": {
        "ru": "Предел запросов в час для тарифа кабинета (RPH).",
        "en": "Requests-per-hour limit of the account plan (RPH)."
      }
    },
    {
      "name": "X-Ratelimit-Remaining",
      "description": {
        "ru": "Сколько запросов осталось в текущем минутном окне, включая уже обработанный запрос.",
        "en": "Requests left in the current minute window, including the request that produced this response."
      }
    },
    {
      "name": "X-Ratelimit-Remaining-Hour",
      "description": {
        "ru": "Сколько запросов осталось в текущем часовом окне.",
        "en": "Requests left in the current hour window."
      }
    },
    {
      "name": "X-Ratelimit-Reset",
      "description": {
        "ru": "Unix-время, когда освободится слот минутного окна (UTC, секунды).",
        "en": "Unix timestamp (UTC, seconds) when a minute-window slot frees up."
      }
    },
    {
      "name": "Retry-After",
      "description": {
        "ru": "Только при ответе 429: сколько секунд подождать до конца текущего окна. Повторять запрос раньше нельзя.",
        "en": "Only on a 429 response: seconds to wait until the current window ends. Do not retry earlier."
      }
    }
  ],
  "request_costs": [
    {
      "match": {
        "ru": "Любой запрос облачного API по умолчанию",
        "en": "Any cloud API request, default"
      },
      "rpm": 1,
      "rph": 1,
      "notes": {
        "ru": "Единица стоимости — запрос, а не профиль.",
        "en": "The cost unit is a request, not a profile."
      }
    },
    {
      "match": {
        "ru": "Ответ с кодом 400, 409 или 422",
        "en": "Response with status 400, 409 or 422"
      },
      "rpm": 6,
      "rph": 1,
      "notes": {
        "ru": "Ошибка валидации или конфликт стоит дороже: перебор не должен быть бесплатным.",
        "en": "Validation errors and conflicts cost more so that retry storms are not free."
      }
    },
    {
      "match": {
        "ru": "Ответ с кодом 401, 403 или 429",
        "en": "Response with status 401, 403 or 429"
      },
      "rpm": 0,
      "rph": 0,
      "notes": {
        "ru": "Отказ, который вернул сам сервер, квоту не тратит.",
        "en": "A refusal returned by the server itself costs nothing."
      }
    },
    {
      "match": {
        "ru": "DELETE /profiles и POST /profiles/trash_bin/restore",
        "en": "DELETE /profiles and POST /profiles/trash_bin/restore"
      },
      "rpm": 1,
      "rph": 1,
      "notes": {
        "ru": "Пакет до 100 профилей стоит как один запрос, а не как 100.",
        "en": "A batch of up to 100 profiles costs one request, not one hundred."
      }
    }
  ],
  "plans": {
    "start": {
      "aliases": [],
      "token_limit": 1,
      "rpm": 30,
      "rph": 600
    },
    "solo": {
      "aliases": [
        "legacy"
      ],
      "token_limit": 1,
      "rpm": 60,
      "rph": 1200
    },
    "team": {
      "aliases": [
        "working"
      ],
      "token_limit": 3,
      "rpm": 120,
      "rph": 3000
    },
    "scale": {
      "aliases": [
        "advanced"
      ],
      "token_limit": 5,
      "rpm": 240,
      "rph": 6000
    }
  },
  "token_limits": {
    "description": {
      "ru": "Число одновременно действующих токенов ограничено тарифом. Отозванный и перевыпущенный токены место не занимают. При превышении сервер отвечает 409 api_tokens.limit_reached.",
      "en": "The number of active tokens is capped by the plan. Revoked tokens do not count. When the cap is reached the server answers 409 api_tokens.limit_reached."
    }
  },
  "notes": {
    "ru": "Неизвестный тариф получает лимиты solo. Тариф читается из лицензии кабинета; сами числа можно изменить настройкой ORCHESTRATOR_API_PLAN_LIMITS без выкладки кода — тогда этот файл и документация обновляются повторной сборкой.",
    "en": "An unknown plan gets the solo limits. The plan comes from the account licence; the numbers can be changed by the ORCHESTRATOR_API_PLAN_LIMITS setting without a code deploy, in which case this file and the docs are rebuilt."
  }
}
