René's URL Explorer Experiment


Title: feat(aws-marketplace): bill a listing's LLM usage to AWS through a per-period metering tally by waleedlatif1 · Pull Request #9921 · simstudioai/sim · GitHub

Open Graph Title: feat(aws-marketplace): bill a listing's LLM usage to AWS through a per-period metering tally by waleedlatif1 · Pull Request #9921 · simstudioai/sim

X Title: feat(aws-marketplace): bill a listing's LLM usage to AWS through a per-period metering tally by waleedlatif1 · Pull Request #9921 · simstudioai/sim

Description: Summary Plans carry their usage pricing: platform-with-usage bills the organization's billed model usage (BYOK is model_unbilled and never billed) as llm_credits of $0.01; contract bills nothing beyond the contract. Repricing or changing what counts is a plan edit Metering charges what changed in the books, not hours of rows: usage_log cost is topped up in place (recordCumulativeUsage), so each run re-sums every billing period with a row that can still change (a request only raises its row while it runs, so a row settles after the longest execution timeout plus a day for late callbacks) and charges the whole units above that period's tally aws_marketplace_usage_tally (organization, dimension, period): cost counted, units charged, and where the count starts. Fractions wait in the tally; units only move forward aws_marketplace_usage_report (license, dimension, hour), the key AWS deduplicates on: a row gathers units while its hour is open and is sent once it closes, or at once for an ended license The charged license is the earliest-linked one in force (status active and not past expiresAt). A license ends at the earlier of its passed expiry and the check that first finds it inactive, so overlapping licenses never both bill and a renewal handoff needs no partial-hour logic. With none in force, a license that ended within the hour AWS allows takes the usage at the hour it ended, and that record is sent at once (AWS's hour runs from the unsubscribe, which a check only finds later, so later tail usage is deliberately not billed) aws_marketplace_license.ended_at, stamped by the read that first finds a license inactive and cleared if access returns, so a cancellation AWS reports with no entitlement (and no expiry) still gets its final flush aws_marketplace_license.organization_linked_at, stamped wherever a license is linked; usage counts from it. A linked license without one (linked before it existed) is stamped by the first run that sees it Sending: BatchMeterUsage by LicenseArn + CustomerAWSAccountId (no ProductCode), 25 per call, grouped per license. Success / DuplicateRecord → reported; CustomerNotSubscribed or a license-level refusal → rejected and logged; unprocessed or transient → pending. Rows AWS won't take (24h old, or last month's after 06:00 UTC on the 1st) are rejected and logged before sending; a TimestampOutOfBoundsException still raised for a batch is narrowed by sending each row alone A record's quantity is fixed once it is first sent (sent_at, stamped under the organization's usage lock with the quantity re-read), since AWS keeps the first record it accepts: a retry resends the same quantity, and later usage waits for a record that can still take it Cron /api/cron/aws-marketplace-meter every 15 minutes (scheduled in infra; SaaS fulfillment only runs on the hosted deployment, like aws-marketplace-reconcile) Report rows keep their license on organization deletion (organization_id set null), so usage already charged is still sent Migration 0456 is additive only Type of Change New feature Testing metering.integration.ts (17, real Postgres; only the AWS metering client is mocked) + lifecycle.integration.ts link-time and ended_at coverage; marketplace integration suites 89/89, unit 10/10 Each guard was removed in turn and its test went red: whole-period re-sum (in-place top-ups), send only after the hour closes, send an ended license at once, stop charging once its end-hour record is sent, skip a license past expiry, stamp unmarked links, period settle window, category filter, count from link, ended_at stamp / keep / clear, callers relinking only on change, the charge-side and send-side sent_at freeze, out-of-range isolation, month-end cutoff and its grace, the long-run row settle window, expiry as end, expired rows sent at once, report rows surviving org deletion bun run lint, tsc, check:migrations, check:audits (the only local failure is the gitignored docs .content registry CI generates), drizzle-kit generate reports no drift Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing (new tests pass the test-audit authoring gate) No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary Plans carry their usage pricing: platform-with-usage bills the organization's billed model usage (BYOK is model_unbilled and never billed) as llm_credits of $0.01; contract bills nothi...

X Description: Summary Plans carry their usage pricing: platform-with-usage bills the organization's billed model usage (BYOK is model_unbilled and never billed) as llm_credits of $0.01; contract bills n...

Opengraph URL: https://github.com/simstudioai/sim/pull/9921

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:fc72bcfa-ebd4-31a6-86b9-32cef20b66c8
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB88A:370E32:76E887:A388DC:6AFB43E8
html-safe-nonce17fa347728e76757aec4c4a84af74036491100117945400383b6fdc1ccadfe29
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODhBOjM3MEUzMjo3NkU4ODc6QTM4OERDOjZBRkI0M0U4IiwidmlzaXRvcl9pZCI6IjMxNzkxNzQ5Njk0MTgxMzg2MDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac1df5a4994c4722c9b842960b7cd1d8c0f7e81ad356d692dc03cfb814bcc24f41
hovercard-subject-tagpull_request:5270935808
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/9921/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary Plans carry their usage pricing: platform-with-usage bills the organization's billed model usage (BYOK is model_unbilled and never billed) as llm_credits of $0.01; contract bills nothi...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noned849b928f455c800985398e7f1b659425adb312a5fa14fba5d9a14e62e9fe5dd
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasea6c2f87cbcb6414452377b4967858ed6a66f1109
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/9921/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F9921%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F9921%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/9921/files
Reloadhttps://github.com/simstudioai/sim/pull/9921/files
Reloadhttps://github.com/simstudioai/sim/pull/9921/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests200 (200)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
feat/aws-marketplace-meteringhttps://github.com/simstudioai/sim/tree/feat/aws-marketplace-metering
Conversation 50 https://github.com/simstudioai/sim/pull/9921
Commits 4 https://github.com/simstudioai/sim/pull/9921/commits
Checks 84 https://github.com/simstudioai/sim/pull/9921/checks
Files changed https://github.com/simstudioai/sim/pull/9921/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9921/files
feat(aws-marketplace): bill a listing's LLM usage to AWS through a per-period metering tally https://github.com/simstudioai/sim/pull/9921/files#top
Show all changes 4 commits https://github.com/simstudioai/sim/pull/9921/files
34ce8d6 feat(aws-marketplace): bill a listing's LLM usage to AWS hourly throu… waleedlatif1 Nov 12, 2026 https://github.com/simstudioai/sim/pull/9921/commits/34ce8d61393e522bc82e35e5c2b3026014e2ea42
7a7f562 fix(aws-marketplace): meter what changed in the books per billing per… waleedlatif1 Nov 12, 2026 https://github.com/simstudioai/sim/pull/9921/commits/7a7f562466c9d982550f272368902b04ad5aa6b8
87f5256 fix(aws-marketplace): fix a record's quantity once it is first sent, … waleedlatif1 Nov 12, 2026 https://github.com/simstudioai/sim/pull/9921/commits/87f5256c9452f1011438074ed767b29b66e3de09
60b4fb6 fix(aws-marketplace): count rows while a long run can still raise the… waleedlatif1 Nov 12, 2026 https://github.com/simstudioai/sim/pull/9921/commits/60b4fb65e013b5dd0a5a08191d09b26a99df4e9f
Clear filters https://github.com/simstudioai/sim/pull/9921/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9921/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9921/files
route.ts https://github.com/simstudioai/sim/pull/9921/files#diff-9ee2ff88c24cc9e40d3fc4e277e8701f3eef54cac5ee358f82e8ce0ce34e5255
lifecycle.integration.ts https://github.com/simstudioai/sim/pull/9921/files#diff-b93f34d55a43ca6dfc41dd38e4bda49063dfc4ab41dcc1a1375273c7d827eba2
metering.integration.ts https://github.com/simstudioai/sim/pull/9921/files#diff-d48e8e43d9378ddf630cf2c8873edeb30bc7ccf3ab5c18c9ab89fcfadd3a98d5
metering.ts https://github.com/simstudioai/sim/pull/9921/files#diff-df9c67bb3cd8e53a402e39c402a70920321e89baecbbda619641ad76a18d97c0
products.ts https://github.com/simstudioai/sim/pull/9921/files#diff-200c5952f43de725331902f7c377de70d89c5740f9763ae6def52fa31237fde2
repository.ts https://github.com/simstudioai/sim/pull/9921/files#diff-4f5f1e2950d118f48332605b66d08c33c7299896a6c5e7efeeb676e294e43d4a
0456_aws_marketplace_usage_metering.sql https://github.com/simstudioai/sim/pull/9921/files#diff-a04d1f40afa6e3d152c754091373928e8c7e2ee2fe776885712dbda5dfaafeaf
0456_snapshot.json https://github.com/simstudioai/sim/pull/9921/files#diff-270b16a3c6778ec13c4f22bdc36985c28282e748f5c52534464db6fad199f415
_journal.json https://github.com/simstudioai/sim/pull/9921/files#diff-37150cc65ad16ee6fbc5fa318fc096be7730e16d63eaf863e3df5521b7030649
schema.ts https://github.com/simstudioai/sim/pull/9921/files#diff-9a959e2ce3cb4c86957bbae021d06eae364f7b0cb18964f5873bab53220af928
schema-tables.generated.ts https://github.com/simstudioai/sim/pull/9921/files#diff-e0edf0f56682cbbb36446389d81ccd7516f377568a0c09cd8e9c1c87b0b1850e
check-api-validation-contracts.ts https://github.com/simstudioai/sim/pull/9921/files#diff-48ae6a4d0c1f820d5b644522d25742bb29af758bc8350f1a3cf3f8afa0bd00b0
check-unused-exports.baseline.json https://github.com/simstudioai/sim/pull/9921/files#diff-4b59a8526a4f226dffb0fbf6b8ec25d3082ab45da697f584eaaca4bd483c928f
apps/sim/app/api/cron/aws-marketplace-meter/route.tshttps://github.com/simstudioai/sim/pull/9921/files#diff-9ee2ff88c24cc9e40d3fc4e277e8701f3eef54cac5ee358f82e8ce0ce34e5255
View file https://github.com/simstudioai/sim/blob/60b4fb65e013b5dd0a5a08191d09b26a99df4e9f/apps/sim/app/api/cron/aws-marketplace-meter/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9921/{{ revealButtonHref }}
Please reload this pagehttps://github.com/simstudioai/sim/pull/9921/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9921/files
apps/sim/lib/billing/aws-marketplace/lifecycle.integration.tshttps://github.com/simstudioai/sim/pull/9921/files#diff-b93f34d55a43ca6dfc41dd38e4bda49063dfc4ab41dcc1a1375273c7d827eba2
View file https://github.com/simstudioai/sim/blob/60b4fb65e013b5dd0a5a08191d09b26a99df4e9f/apps/sim/lib/billing/aws-marketplace/lifecycle.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/9921/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/9921/files#diff-b93f34d55a43ca6dfc41dd38e4bda49063dfc4ab41dcc1a1375273c7d827eba2
https://github.com/simstudioai/sim/pull/9921/files#diff-b93f34d55a43ca6dfc41dd38e4bda49063dfc4ab41dcc1a1375273c7d827eba2
https://github.com/simstudioai/sim/pull/9921/files#diff-b93f34d55a43ca6dfc41dd38e4bda49063dfc4ab41dcc1a1375273c7d827eba2
https://github.com/simstudioai/sim/pull/9921/files#diff-b93f34d55a43ca6dfc41dd38e4bda49063dfc4ab41dcc1a1375273c7d827eba2
Please reload this pagehttps://github.com/simstudioai/sim/pull/9921/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/9921/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.