AI Services — Anthropic, OpenRouter & Claude Subscription
Three different “Claude” products
| Product | What it is | Pays for portal AI? |
|---|---|---|
| Anthropic API | Pay-per-token API keys from console.anthropic.com | ✅ Yes — primary production path |
| OpenRouter | Multi-model API gateway at openrouter.ai | ✅ Yes — if OPENROUTER_API_KEY is set |
| Claude Pro / Team / Max | Chat subscription at claude.ai for humans | ❌ No — does not replace app API billing |
Important: A Claude Pro subscription gives developers access to claude.ai in the browser. The Governance Portal backend calls the Messages API with
ANTHROPIC_API_KEYorOPENROUTER_API_KEY. Those are billed separately on Anthropic Console or OpenRouter — unless your organisation has a specific enterprise/API bundle.
If your team uses Claude Pro for daily work, that cost is developer tooling, not application inference.
How the portal chooses a provider
Code: backend/src/lib/anthropic-client.ts
If OPENROUTER_API_KEY is set → OpenRouter (base URL openrouter.ai/api)
Else if ANTHROPIC_API_KEY → Direct Anthropic API
Else → AI features disabled (500 on AI routes)Model override (optional):
| Env var | Example |
|---|---|
AI_MODEL | anthropic/claude-sonnet-4 (OpenRouter slug) |
OPENROUTER_MODEL | Same |
ANTHROPIC_MODEL | Direct Anthropic model ID |
Default models in code include Claude Sonnet 4 / 4.5 depending on feature.
Pricing (indicative, August 2026)
Anthropic API (direct)
| Model (examples) | Input | Output |
|---|---|---|
| Claude Sonnet 4 | ~$3 / MTok | ~$15 / MTok |
| Claude Sonnet 4.5 | Check anthropic.com/pricing |
Billing: prepaid credits or invoiced — set spend limits in Anthropic Console.
OpenRouter
| Aspect | Detail |
|---|---|
| Billing | Prepaid credits; per-model pricing on openrouter.ai/models |
| Markup | Small fee over provider price |
| Benefit | One key for multiple models; easy model switching via AI_MODEL |
OpenRouter is useful if you want fallback models or consolidated billing across providers.
Claude Pro / Team (chat only)
| Plan | Price | Includes API? |
|---|---|---|
| Claude Pro | ~$20/mo | No — chat only |
| Claude Team | ~$25–30/user/mo | No — team chat + admin |
| Claude Max | Higher tier | No |
Estimated monthly spend
| Usage profile | Est. cost |
|---|---|
| Light (occasional AI edits, few users) | €5–20 |
| Moderate (regular content teams) | €20–80 |
| Heavy (bulk AI, many concurrent features) | €80–200+ |
Controls in the app: Budget caps and feature flags where implemented — monitor Anthropic/OpenRouter dashboards weekly during rollout.
Environment variables
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY | ✅* | Direct Anthropic API key (sk-ant-...) |
OPENROUTER_API_KEY | ⚪ | If set, overrides Anthropic (sk-or-v1-...) |
OPENROUTER_BASE_URL | ⚪ | Default https://openrouter.ai/api |
OPENROUTER_HTTP_REFERER | ⚪ | Attribution for OpenRouter |
OPENROUTER_APP_TITLE | ⚪ | App name for OpenRouter |
AI_MODEL | ⚪ | Global model override |
* At least one of ANTHROPIC_API_KEY or OPENROUTER_API_KEY required for AI features.
Set on Render → mqa-backend secrets. Never expose in VITE_* frontend vars.
Staging vs production
| Rule | Why |
|---|---|
| Separate API key for staging | Prevent test traffic from consuming prod budget |
| Lower spend limit on staging key | Anthropic/OpenRouter dashboard caps |
| Do not share unlimited prod key | See STAGING-SETUP |
Features using AI
Non-exhaustive list (see AI Content Editing Architecture):
- Streaming content editing
- Sharia compliance checker
- Due diligence assessor
- Tender / feasibility / vendor generators
- Bulk AI edit, module replication
- Masterplan concept generator
All share the same client in anthropic-client.ts.
Recommended setup for optimal operations
| Item | Recommendation |
|---|---|
| Production key | Anthropic Console or OpenRouter — pick one primary |
| Spend alerts | Enable in provider dashboard at 50% / 80% of monthly budget |
| Staging key | Separate key, hard cap (e.g. €10/mo) |
| Claude Pro for devs | Optional — improves developer productivity, not app runtime |
| Model policy | Document approved models for compliance (Sonnet 4+ for production) |
| Audit | Log AI usage in application where available |
Related
- Services & Costs — full cost table
- ENV-INVENTORY — all AI env keys
- AI Content Editing Architecture — feature design
- MONITORING — track errors from AI routes