osquarski OpenAI example Since OpenAI does not include cost, I use a custom pricing map to return it import { UIMessage, convertToModelMessages, generateText, wrapLanguageModel, } from 'ai'; import { createOpenAI } from '@ai-sdk/openai'; import { createOpenAIMiddleware } from '@ai-billing/openai'; import { consoleDestination, createObjectPriceResolver, ModelPricing, } from '@ai-billing/core'; const openai = createOpenAI({ // eslint-disable-next-line turbo/no-undeclared-env-vars apiKey: process.env.OPENAI_API_KEY, }); const customPricingMap: Record<string, ModelPricing> = { 'gpt-5': { promptTokens: 1.25
osquarski @ai-billing also sends usage events to Billing Providers Here is an infographic how: And a codesnippet showing how to do it for: Stripe import { createOpenRouter } from '@openrouter/ai-sdk-provider'; import { streamText, convertToModelMessages, UIMessage, wrapLanguageModel, } from 'ai'; import { createOpenRouterV3Middleware } from '@ai-billing/openrouter'; import { consoleDestination } from '@ai-billing/core'; import { createStripeDestination } from '@ai-billing/stripe'; type BillingTags = { org_name?: string; stripe_customer_id?: string; }; const stripeDestination = createStripeDestination<Bi
osquarski Installation npm install @ai-billing/core @ai-billing/openrouter # Example for OpenRouter Full-stack @ai-billing examples | Name | Demo Link | Repo | Deploy | | :--- | :--- | :--- | :--- | | Chatbot (OpenRouter + Polar) | View Demo | GitHub | [](vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fnarevai%2Fai-billing%2Ftree%2Fmain%2Fexamples%2Fchatbot-with-billing-polar) | | Chatbot (OpenAI + Polar) | View Demo | GitHub | [](vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fnarevai%2Fchatbot-openai-with-billing-polar&env=AUTH_SECRET,OPENAI_API_KEY,POSTGRES_URL,POLAR_ACC
Ryu Hi Nochinxx, Nice idea. The “five views” framing makes the PR review flow feel much easier to scan than a normal diff wall. One thing I’d consider adding is a small confidence/source indicator per AI comment, especially if the app is summarizing or flagging risky changes. For example: based on changed file only based on related files based on package/config context needs human verification That could make the AI feedback easier to trust because reviewers can tell whether the comment came from local diff context or a broader repo read. I’d also make “open original PR/file on GitHub” very promin
Nochinxx Thanks, Ryu. Sure, I just added some of the source indicators. However, the idea is also that each user modifies the code so that the flags are more accurate to what they usually check for. I'd also make the “open original PR/file on GitHub” more prominent. Thanks!
Ryu Hi Nochinxx, That makes sense, and nice work moving on those changes so quickly. I like the idea that teams can tune the flags for their own review style. My only thought would be to make the default rules very transparent, even if they are meant to be customized later. Something like a small “why this was flagged” note could help new users understand the baseline before they start editing it. The source indicators already sound like a good step in that direction. I’m definitely not the expert here, but this feels like the kind of tool where trust and explainability matter almost as much as th
Ryu Hi Tn0127, You probably do not need to change the production branch for this. If main is your real production branch, keep it that way. With a connected GitHub repo, a push to any other branch, like dev, should create a Preview Deployment instead of replacing production. So the usual flow would be: git checkout dev git push origin dev Then in Vercel, open the project → Deployments and filter by the dev branch. That deployment will have its own preview URL. If you want dev to have a stable staging URL, you have two options: Use the branch preview URL Vercel gives you for that branch. Add a cust
VX360 Hi @Tn0127, Actually, you don't need to change Git commands or push a new branch to do this. Vercel lets you control the project's production branch directly from the dashboard, which is the easiest and safest way: Open your project in the Vercel Dashboard. Go to the Settings tab. Select Git from the sidebar. You'll find a section called Production Branch. There, you can select the branch you want to use for deployment (Production) instead of main or any other branch, and change it to dev. Once you save this setting, Vercel will automatically consider any update pushed to the dev branch as an
system The domain troubleshooting guide can help with most custom domain configuration issues. You might be able to use that guide to solve it before a human is available to help you. Then you can come back here and share the answer for bonus points. vercel.com/docs/projects/domains/troubleshooting You can also use v0 to narrow down the possibilities.
Ryu Hi Hero, I’d first separate “Safari is slow to get the document” from “Safari gets the document quickly but renders a blank page for a while.” A quick way to check is to run this in Safari’s console after a slow load, then compare it with Chrome on the same iPhone: const n = performance.getEntriesByType("navigation")[0]; console.table({ dns: Math.round(n.domainLookupEnd - n.domainLookupStart), connect: Math.round(n.connectEnd - n.connectStart), tls: Math.round(n.requestStart - n.secureConnectionStart), ttfb: Math.round(n.responseStart - n.requestStart), download: Math.round(n.responseEnd - n.r
Ryu Hi Trylotsy, I’d separate this into a few different “old version” cases, because they have different causes. First, ask one affected user to open DevTools → Network and hard reload, then check the main document request for / or the affected route: Status: Cache-Control: x-vercel-cache: x-vercel-id: If the HTML document itself is old, I’d check for something in front of Vercel, like Cloudflare, a corporate proxy, browser cache, or a service worker/PWA. A service worker is a common cause when only some users keep seeing an older frontend after a successful deployment. If the HTML is new but the
Trylotsy Thanks for the response. The challenge is that this is affecting a consumer-facing application with a large mobile user base, so it isn't practical to walk individual users through DevTools checks, cache clearing, service worker inspection, or other device-specific troubleshooting steps. What we're seeing is inconsistent behavior across devices: Some users see the latest version on desktop but not mobile. Some see the latest version on mobile but not desktop. Some see the latest version on both. Some continue to see the old version on both. Because the issue appears random across users and dev
Ryu Hi Trylotsy, I don’t think there is a single Vercel-side purge that guarantees every already-open browser/device moves to the newest frontend bundle. For a normal Next.js deployment, the production alias should point at one deployment, and /_next/static/... assets are content-hashed, so old JS chunks usually only continue loading if old HTML or a client-side cache is still serving the old app shell. For the “random across users/devices” pattern, I’d focus on these deployment-level checks: Check whether you have a service worker/PWA layer, such as next-pwa, Workbox, a custom sw.js, or a previou