Set FLOWCY_AGENT_MODEL to an AI Gateway model ID. No fallback to FLOWCY_CHAT_MODEL or MODEL_NAME is used. Account AI metering must be configured with the existing RxSubscription integration. Each generation consumes one AI session, including failed model attempts.
POST /api/v1/agent/draft accepts an account cookie or native RxAuth bearer. Scoped API tokens are rejected. The caller must own or be a member of the project.
Request: { "projectId": "project-id", "kind": "task", "prompt": "Add offline support" }. kind is task or story; prompt must contain 1–8000 non-whitespace characters. The body is limited to 40,000 bytes.
Response (200): { "title": "Add offline support", "details": "## Scope\n…\n## Acceptance criteria\n…" }. The description is Markdown. Responses are not cached. Errors use { "error": "message" }: 400 invalid input, 401 unauthenticated, 403 account/allowance denied, 404 inaccessible project, 413 oversized body, 429 rate limited, 502 model failure or timeout, 503 missing configuration or admission unavailable. Model requests time out after 45 seconds and do not automatically retry.
Generation never saves a task/story, assigns a device, or starts an agent. Native creation uses a dedicated AI sheet; web creation uses a separate generation step in the creation dialog. Users review the editable title and description and save through the existing creation flow. Current classification, story selection, dependencies and assignees are preserved.
Deploy this endpoint and configure FLOWCY_AGENT_MODEL before releasing the matching mobile client. The web server action shares the same authorization, generation and metering service.