Skip to content

feat: Configure AI usage counter#11

Open
kofimokome wants to merge 5 commits into
mainfrom
feat/ai-allowance
Open

feat: Configure AI usage counter#11
kofimokome wants to merge 5 commits into
mainfrom
feat/ai-allowance

Conversation

@kofimokome

@kofimokome kofimokome commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Fixes #7

Depends on #10

@kofimokome
kofimokome marked this pull request as draft June 28, 2026 16:52
@sourceant

sourceant Bot commented Jun 28, 2026

Copy link
Copy Markdown

Code Review Summary

This PR introduces subscription management and AI usage counting using Laravel Cashier. It adds necessary migrations, configures Stripe plans, and implements an entitlement service.

🚀 Key Improvements

  • Implementation of CloudEntitlements to manage AI token usage based on subscription levels.
  • Automated migration loading in CloudServiceProvider.php.
  • Stripe Checkout integration for simplified user upgrades.

💡 Minor Suggestions

  • Avoid hardcoded strings like 'us', 'eu', 'uk' in controllers; use constants or config keys.
  • Add PHPDoc return types to the checkout method.

🚨 Critical Issues

  • Hardcoded Stripe Price IDs in config/cloudplans.php will fail in different environments.
  • Webhook route lacks explicit signature verification middleware in the diff.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Comment thread config/cloudplans.php
Comment thread src/Support/CloudEntitlements.php Outdated
@kofimokome
kofimokome marked this pull request as ready for review July 6, 2026 20:12

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Comment thread src/Support/CloudEntitlements.php Outdated
@kofimokome
kofimokome force-pushed the feat/ai-allowance branch from 35627ef to ea97334 Compare July 6, 2026 20:18

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Comment thread src/Models/AiUsageCounter.php Outdated
@kofimokome
kofimokome force-pushed the feat/ai-allowance branch from ea97334 to d97f1f4 Compare July 6, 2026 20:21

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Comment thread src/Http/Controllers/CloudController.php

@nfebe nfebe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good but since we have multiple projects that the question of tokens will come up. I built and publish a package that will simplify things there is already a task to implement it in the core and it may remove the need for one table you have here.

See: https://github.com/whilesmartphp/eloquent-agent-metrics

@kofimokome

Copy link
Copy Markdown
Collaborator Author

@nfebe what's the issue number on trakli core? I can't find it

@nfebe

nfebe commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

I already implemented it so its closed

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Comment thread src/Support/CloudEntitlements.php
@kofimokome
kofimokome requested a review from nfebe July 15, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cloud): Add Stripe subscriptions via Cashier mirror

2 participants