I built Attrifast — an analytics platform for website traffic, customer-level revenue and AI brand visibility. It started because I spent two years duct-taping GA4 exports to Stripe payouts in spreadsheets and never got a straight answer to "which channel actually booked this revenue."
The part worth posting here is the AI-visibility side: it asks ChatGPT, Claude, Gemini and
Perplexity a set of buying-intent questions and measures whether your domain gets named and
cited. All four run through Vercel AI Gateway with ai@7 generateText and plain
provider/model slugs, keeping each provider's native web-search tool so per-engine
share-of-voice stays comparable.
Stack: Next.js 15 + React 19 (App Router) on Vercel · MDX content · NestJS + BullMQ worker · Postgres/Prisma · Stripe · a ~2KB first-party tracker script · AI Gateway for every model call.
Four things I got wrong first, in case they save someone a week:
1. The prompt decides whether the engine searches at all. Definitional prompts ("what is X") get answered from parametric memory — no search, no sources, so a 0% visibility score is structurally guaranteed and tells you nothing. Commercial prompts make every engine search. Measured on the same day:
| prompt shape | anthropic | openai | perplexity | |
|---|---|---|---|---|
| definitional | 0 sources | 0 | 5 | 20 |
| tool-seeking / commercial | 10 | 10 | 8 | 20 |
Forcing toolChoice fixes Anthropic and OpenAI. It makes Google worse, and Perplexity has
no tool to force — so it can't be applied uniformly.
2. Google grounding hands back proxy URLs. Every citation comes through as
vertexaisearch.cloud.google.com/``..., which my domain classifier filtered as plumbing —
84 of 322 citations silently dropped before I noticed. They have to be resolved back to the
real host first.
3. Real cost, from the credit-balance delta rather than an estimate: $0.0735 per prompt
across all four engines — google $0.0377, anthropic $0.0300, perplexity $0.0055,
openai $0.0002. A 30-prompt scan is ~$2.20. Google is 51% of the bill and openai is a
rounding error, which is not what I would have guessed.
GET https://ai-gateway.vercel.sh/v1/credits is handy for measuring this.
4. Gateway auth from a non-Vercel backend. The worker runs on EC2, so OIDC isn't
available — a static AI_GATEWAY_API_KEY works fine and replaced four separate provider keys.
On the free tier a 40-call burst rate-limited ~60% of the time; a small inter-query delay
(1.5s) plus credit top-up made scans clean.
Unified result.sources[] across providers was the real win — it replaced four bespoke
citation parsers with one code path.
Happy to answer anything about the Gateway setup or the tracker. Feedback on the dashboard welcome — especially from anyone else measuring AI search visibility.