docs(plans): plan entitlements contract: plan fields on credits, 402 plan_limit on tasks, plan on subscription sessions (app#2044 row 2)

Merged
SW
3mo ago
+250-15

Implements row 2 of app#2044: the contract for three plans (Free, Starter, Pro) and the task gate, ahead of the api PR that fulfils it.

What changed

  • AccountCreditsResponse (GET /api/accounts/{id}/credits) gains plan (free | starter | pro), task_limit (nullable, null = uncapped), min_cadence_minutes. is_pro description now states Starter is not pro.
  • POST /api/tasks and PATCH /api/tasks document 402 plan_limit with a new PlanLimitError schema and two examples (task_count, min_cadence). Body keeps the tasks envelope (status: "error"), machine code in error, human text in message, billingUrl constant like insufficient_credits.
  • CreateSubscriptionSessionRequest (POST /api/subscriptions/sessions) gains optional plan (starter | pro, default pro); the 400 documents starter_unavailable when the Starter price is not configured.
  • credits.mdx: three-plan table (price, credits, tasks, shortest cadence), plan resolution rule, the Task limits section with the 402 body, and the grandfathering date (tasks that predate the gate run until 2026-10-01).

Assumptions carried from the tracking issue (Sweets' "Go" on 2026-08-29)

  • Pro credits = 3x price ($300/month); Starter = $20; Free = $3.33.
  • Shortest cadence: Free weekly (10080 min), Starter daily (1440), Pro hourly (60).
  • Starter has no trial; Pro keeps the 30-day trial.
  • Grandfathering until 2026-10-01T00:00:00Z.

Merge order

This PR first, then api#877. Edits to the OpenAPI JSON are anchored text insertions; both files re-parse.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GkSubbDhRVoNanCEoKgL6K


Summary by cubic

Documents row 2 of app#2044: the Free, Starter, and Pro plan entitlements contract ahead of the API PR that implements it. Task creation and updates return a 402 plan_limit, credits responses carry plan fields, and subscription sessions accept a plan selector. API keys now work on every plan, not just Pro.

What changed

  • AccountCreditsResponse adds plan, task_limit, and min_cadence_minutes; is_pro now only reflects Pro features, so Starter accounts are not pro.
  • POST /api/tasks and PATCH /api/tasks document the 402 plan_limit body via a new PlanLimitError schema with task_count and min_cadence examples; both link billingUrl to /plan.
  • CreateSubscriptionSessionRequest gains optional plan (default pro), and its 400 response documents starter_unavailable when the Starter price is not configured.
  • credits.mdx adds a three-plan table matching the in-app comparison, a task limits section, and upgrade steps pointing to /plan; limits apply immediately, with no grandfathering.

Assumptions

  • Credits per month: Pro $300, Starter $20, Free $3.33; shortest cadence: Free weekly (10080 min), Starter daily (1440), Pro hourly (60).
  • Starter has no trial; Pro keeps the 30-day trial.

Summary by CodeRabbit

  • New Features

    • Added documentation for Free, Starter, and Pro subscription tiers.
    • Added plan selection when starting a subscription.
    • Account credit responses now include plan details, task limits, and minimum scheduling cadence.
    • Task creation and updates now document payment-required responses when plan limits are exceeded.
  • Documentation

    • Expanded subscription comparisons, plan-resolution rules, task limits, and upgrade instructions.
    • Added examples for plan-limit errors and Starter availability errors.
    • Clarified Pro status for enterprise domains and Starter accounts.
    • Updated credit balance examples and Pro-only feature restrictions.