{"agent":"claude","input":"Do the work the Linear issue describes: track token usage per user in this AI SDK chatbot. Read app/(chat)/api/chat/route.ts, lib/ai/entitlements.ts, lib/ai/providers.ts, lib/ai/models.mock.ts, lib/db/schema.ts, lib/db/queries.ts, lib/db/migrate.ts, drizzle.config.ts, lib/errors.ts, tests/e2e/api.test.ts, package.json and the workflows under .github first. Add a Usage table with userId, chatId, modelId, inputTokens, outputTokens, totalTokens, cacheReadTokens, reasoningTokens and createdAt, generate the migration with pnpm db:generate, and add saveUsage and getUsageByUserId queries in the style of getMessageCountByUserId. In the chat route read usage from streamText's onEnd event and save a row per response. Add GET /api/usage returning the signed-in user's totals for the last day and the last 30 days. Write a Playwright test that sends one message and asserts the usage endpoint matches the mock model's counts. Run pnpm check and the Playwright suite against a PostgreSQL you start, and open a pull request linking the issue and quoting the output.","resources":[{"url":"https://github.com/your-org/your-app"}]}