Skip to Content
Ai VisibilityAI Visibility — Configuration

AI Visibility — Configuration

Environment Variables

The keys must be set in three separate env files. The agents server makes the actual LLM calls; the API and dashboard only check for key presence to drive the UI state.

apps/servers/agents/.env

# Azure OpenAI — ChatGPT (GPT-4.1) AZURE_OPENAI_API_KEY="<your-azure-openai-key>" AZURE_OPENAI_ENDPOINT="https://<your-resource>.openai.azure.com" AZURE_OPENAI_DEPLOYMENT="gpt-4.1" AZURE_OPENAI_API_VERSION="2024-08-01-preview" # Anthropic — Claude (Sonnet) ANTHROPIC_API_KEY="<your-anthropic-key>" # Google — Gemini 2.0 GOOGLE_GENERATIVE_AI_KEY="<your-gemini-key>" # Perplexity PERPLEXITY_API_KEY="<your-perplexity-key>"

apps/api/.env

Same keys (API checks presence for the /platforms endpoint):

AZURE_OPENAI_API_KEY="<same-value>" ANTHROPIC_API_KEY="<same-value>" GOOGLE_GENERATIVE_AI_KEY="<same-value>" PERPLEXITY_API_KEY="<same-value>"

apps/dashboard/.env.local

Same keys (Next.js server component checks presence for apiKeyPresent in page.tsx):

AZURE_OPENAI_API_KEY=<same-value> ANTHROPIC_API_KEY=<same-value> GOOGLE_GENERATIVE_AI_KEY=<same-value> PERPLEXITY_API_KEY=<same-value>

Adding a New Platform

  1. Add a seed entry in packages/db/src/seed.tsAI_VISIBILITY_PLATFORMS array
  2. Run pnpm db:seed from packages/db
  3. Add the LLM caller function in packages/agents/src/workers/ai-visibility-monitor.worker.ts and wire it into callPlatform()
  4. Add the env var to all three env files above
  5. Restart the API and agents servers

Known Issues

Gemini 429 — Rate Limit

Symptom: All Gemini calls fail with Gemini API error 429 during a full run (29 prompts).

Cause: The free-tier Google Generative AI API key has a low requests-per-minute quota (typically 15 RPM on gemini-2.0-flash). A full 29-prompt run exhausts this in the first few prompts.

Fix (TODO): Either:

  • Upgrade to a paid Google Cloud project with higher quota, or
  • Add per-platform rate limiting / retry-with-backoff in callGemini() in the worker

Perplexity 401 — Key Not Configured

Symptom: All Perplexity calls fail with Perplexity API error 401.

Cause: The PERPLEXITY_API_KEY value is still a placeholder (pplx-replace-with-your-perplexity-key) in all three env files.

Fix (TODO): Replace the placeholder with a real Perplexity API key (obtainable from perplexity.ai/settings/api ) in:

  • apps/servers/agents/.env
  • apps/api/.env
  • apps/dashboard/.env.local

Then restart both the API and agents servers.

© 2026 Leadmetrics — Internal use only