Inferensys

Prompt

Freemium vs Paid Tier Routing Prompt

A practical prompt playbook for using the Freemium vs Paid Tier Routing Prompt in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the exact job-to-be-done, the ideal user, and the critical boundaries for using the Freemium vs Paid Tier Routing Prompt in a production AI system.

This prompt is for platform engineers building routing middleware that must classify an account into a freemium or paid tier before making a downstream decision. Use it when a request hits your system and you need a deterministic, auditable tier assignment that respects upgrade/downgrade timing, trial status, and edge-case account states. The output drives feature gates, support queue selection, rate limit application, and model routing. The ideal user is an AI infrastructure or backend engineer integrating this classification step into a request-handling pipeline where tier information is not already available as a single, trusted source-of-truth field.

Do not use this prompt when tier information is already available as a structured field in your account database. In that case, read the field directly and skip the model call entirely. This prompt is specifically for scenarios where tier must be inferred from messy or compound signals: account metadata, recent billing events, contract snippets, or user-provided context. Using an LLM for a lookup that a database can perform in single-digit milliseconds introduces unnecessary latency, cost, and a potential point of failure. Reserve this prompt for the inference path, not the retrieval path.

Before wiring this prompt into production, define the exact downstream consequences of a misclassification. A false 'paid' classification for a freemium user might expose a gated feature incorrectly, while a false 'freemium' classification for a paying customer can degrade their experience and trigger a support escalation. Implement a validation layer that cross-references the model's output against any available deterministic signals, such as a plan_type field or a recent invoice timestamp. Log every classification decision with the input signals, model output, and final routed action so that audit trails exist for billing disputes or customer-impact investigations. If the confidence score falls below a defined threshold, route the request to a human review queue rather than making an automated gating decision.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Freemium vs Paid Tier Routing Prompt works, where it breaks, and the operational preconditions required before you wire it into a production routing middleware.

01

Strong Fit: Deterministic Tier Logic

Use when: Your application already has a single source of truth for account tier (e.g., a tier field on the account object). The prompt acts as a normalization layer, mapping messy or inconsistent tier labels to a canonical enum. Avoid when: Tier is inferred from complex, undocumented business rules that live only in someone's head.

02

Poor Fit: Real-Time Billing State

Risk: The prompt cannot reliably determine tier from raw payment processor webhooks or subscription state machines. Guardrail: Always resolve tier in the application layer using your billing system's API before the prompt ever sees the request. The prompt should only normalize, never calculate entitlement from raw payment events.

03

Required Input: Canonical Account Context

What to watch: The prompt fails silently when account context is missing, stale, or ambiguous. Guardrail: Enforce a required input contract: account_id, current_tier_label, subscription_status, and entitlements_list must be injected by the application. If any field is null, route to a human review queue instead of calling the prompt.

04

Operational Risk: Downgrade Grace Periods

Risk: A recently downgraded account may still have paid-tier entitlements during a grace period. The prompt may incorrectly route them to the freemium queue. Guardrail: The application must resolve the effective tier based on downgrade_effective_date before calling the prompt. Add an eval case for accounts in a grace window to catch premature feature revocation.

05

Operational Risk: Custom Enterprise Contracts

Risk: Bespoke contracts with non-standard entitlements bypass standard tier logic. The prompt may misclassify a high-touch enterprise account as standard paid. Guardrail: Flag accounts with is_custom_contract: true and route them via a separate bespoke-entitlement extraction prompt or directly to a named support queue. Never let the generic tier prompt handle custom contracts.

06

Testing Gap: Silent Misclassification

Risk: The prompt returns a valid tier label that is wrong for the account, and downstream systems act on it without detection. Guardrail: Implement a post-routing assertion: compare the prompt's output tier to the application's known tier. If they conflict, log the mismatch, default to the application's tier, and flag for review. Treat prompt output as a hint, not the authoritative source.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A production-ready prompt for classifying accounts into freemium or paid tiers and enforcing routing rules for feature access, support channels, and rate limits.

This prompt template is designed to be placed in your system instructions or classification node. It accepts account metadata, request context, and tier definitions, then returns a structured routing decision. The prompt handles standard tier classification, but its real value is in managing edge cases: recently upgraded accounts that haven't propagated through billing systems, downgrade grace periods, trial-to-paid transitions, and accounts with conflicting entitlement signals. Before copying, review the square-bracket placeholders and replace them with your application's actual tier definitions, feature gates, and routing rules.

code
SYSTEM INSTRUCTION:
You are a tier classification and routing engine for a SaaS platform. Your job is to determine whether an account is on a freemium or paid tier and enforce the correct routing rules for feature access, support channels, and rate limits.

INPUT:
- Account metadata: [ACCOUNT_METADATA_JSON]
- Request context: [REQUEST_CONTEXT]
- Current timestamp: [TIMESTAMP]

TIER DEFINITIONS:
[Tier definitions with explicit criteria for each tier, including feature flags, support entitlements, and rate limits]

EDGE CASE RULES:
- Recently upgraded accounts (upgrade within [UPGRADE_PROPAGATION_WINDOW_HOURS] hours): Treat as paid tier even if billing system shows freemium.
- Downgrade grace period (within [GRACE_PERIOD_DAYS] days of downgrade): Continue routing as paid tier until grace period expires.
- Trial accounts with payment method on file: Route as [TRIAL_WITH_PAYMENT_ROUTING_RULE].
- Conflicting signals: When account metadata and request context disagree on tier, prioritize [CONFLICT_RESOLUTION_PRIORITY] and flag for review.
- Missing account data: If account metadata is empty or malformed, return [MISSING_ACCOUNT_FALLBACK_TIER] with confidence "low" and flag for manual review.

OUTPUT SCHEMA:
{
  "account_id": "string",
  "effective_tier": "freemium | paid | [ADDITIONAL_TIERS]",
  "confidence": "high | medium | low",
  "routing_decision": {
    "feature_access": ["[FEATURE_1]", "[FEATURE_2]"],
    "support_channel": "[SUPPORT_CHANNEL]",
    "rate_limit": [RATE_LIMIT_VALUE],
    "queue_priority": "[QUEUE_PRIORITY]"
  },
  "edge_case_flags": ["recent_upgrade | grace_period | trial | conflicting_signals | missing_data | null"],
  "requires_review": true | false,
  "review_reason": "string or null",
  "evidence": ["List of specific fields and values used to determine tier"]
}

CONSTRAINTS:
- Never grant paid-tier access to accounts that are unambiguously freemium.
- When confidence is "low," always set requires_review to true.
- Do not invent account data. If a field is missing, acknowledge it in evidence.
- For conflicting signals, explain the conflict in review_reason.

After pasting this template, replace each square-bracket placeholder with your application's concrete values. The tier definitions block should be exhaustive: list every feature flag, support channel, and rate limit per tier. The edge case rules are critical for production—most tier misclassifications happen during transitions, not steady state. Test this prompt against a golden dataset that includes recently upgraded accounts, accounts mid-downgrade, trial accounts with and without payment methods, and accounts with missing or malformed metadata. If your application serves enterprise customers with custom contracts, pair this prompt with the Contract Entitlement Gap Detection Prompt to catch requests that fall outside standard tier definitions.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Freemium vs Paid Tier Routing Prompt. Each placeholder must be populated before the prompt is assembled and sent to the model. Missing or malformed inputs are the most common cause of misrouting.

PlaceholderPurposeExampleValidation Notes

[ACCOUNT_OBJECT]

Full account record with tier, status, entitlements, and contract metadata

{"tier": "pro", "status": "active", "plan": "annual", "entitlements": ["priority_support", "api_access"]}

Must be valid JSON. Reject if null or missing required fields: tier, status. Schema check required before prompt assembly.

[REQUEST_CONTEXT]

The user's current request, feature access attempt, or support inquiry

"I need to export my data via the API but the button is grayed out"

Must be a non-empty string. Truncate to 2000 tokens if longer. Null allowed only if routing is based solely on account attributes.

[TIER_DEFINITIONS]

Mapping of tier labels to capabilities, limits, and support channels

{"free": {"features": ["basic_export"], "support": "community"}, "paid": {"features": ["api_export", "bulk_export"], "support": "priority"}}

Must be valid JSON with at least one tier defined. Missing tier definitions cause routing fallback to default deny. Validate against known tier enum.

[GRACE_PERIOD_CONFIG]

Rules for recently upgraded or downgraded accounts during transition windows

{"downgrade_grace_days": 14, "upgrade_immediate": true, "expired_behavior": "free_tier"}

Must be valid JSON. Default to 0-day grace period if null. Validate grace_days is a non-negative integer. Negative values trigger schema rejection.

[RECENT_EVENTS]

Array of recent account events: upgrades, downgrades, cancellations, payment failures

[{"event": "downgrade", "date": "2025-03-28", "from_tier": "pro", "to_tier": "free"}]

Must be a valid JSON array. Empty array allowed. Each event must have event type and ISO 8601 date. Malformed events should be dropped with a warning log.

[OVERRIDE_FLAGS]

Manual overrides for specific accounts: VIP, internal, test, blocked

{"vip": false, "internal": false, "test": false, "blocked": false}

Must be valid JSON with boolean values. Null allowed, defaults to false for all flags. Non-boolean values should be coerced with warning. Blocked accounts must short-circuit to deny.

[RATE_LIMIT_STATE]

Current rate limit consumption for the account: requests remaining, window, throttle level

{"requests_remaining": 42, "window_seconds": 3600, "limit": 1000, "throttle_level": "normal"}

Must be valid JSON. Null allowed if rate limiting is not active. Validate requests_remaining is an integer. Negative values indicate a bug upstream and should trigger an alert.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the freemium vs paid tier routing prompt into a production application with validation, retries, and audit logging.

This prompt is designed to sit inside a routing middleware layer—typically an API gateway, support ticketing system, or feature-flag service—that must make a deterministic tier classification before dispatching a request. The harness should call the prompt with a structured account object containing fields like account_id, plan_type, subscription_status, contract_start_date, contract_end_date, recent_upgrade_date, recent_downgrade_date, and any custom entitlement overrides. The output is a JSON object with tier (one of freemium, paid, grace_period, or unknown), confidence (0.0–1.0), routing_decision (the target queue or feature gate), and evidence (the specific fields that drove the classification). Do not pass raw, unparsed account blobs; the prompt works best when the application layer has already normalized the account state into a clean input schema.

Validation must happen in two layers. First, validate the model's output against a strict JSON schema before the routing decision takes effect. If tier is not one of the enumerated values, or if confidence is below a configurable threshold (start at 0.85), reject the classification and fall back to a safe default—typically routing to the freemium queue with a logged low_confidence_override flag. Second, validate against business rules in the application layer: if the model returns paid but the account's plan_type is free and there is no recent_upgrade_date, flag a contradiction and escalate for human review. These post-model business-rule checks catch hallucinations that schema validation alone would miss. Log every classification decision with the full input, output, validation result, and final routing action to an append-only audit table. This trace is essential for debugging misroutes and for demonstrating compliance with commercial agreements during contract disputes.

For retries, implement a single retry with exponential backoff (1s delay) if the model returns malformed JSON or a tier value outside the enum. Do not retry on low confidence or business-rule contradictions—those should escalate immediately. If the model fails twice, route to a human review queue with the full account context and a classification_failed reason code. Model choice matters: use a fast, cost-effective model like GPT-4o-mini or Claude Haiku for the primary classification path, and reserve a more capable model like GPT-4o or Claude Sonnet for the human-review fallback when contradictions are detected. Avoid using the same model for both primary classification and contradiction review, as it may reproduce the same error. Wire the prompt into your application with a timeout of 5 seconds and a circuit breaker that opens after 10 consecutive failures, preventing cascading latency in your routing middleware.

Edge cases around recently upgraded or downgraded accounts are the most common failure mode. The prompt includes instructions for detecting grace periods, but the harness should reinforce this with application-level date arithmetic: if recent_upgrade_date or recent_downgrade_date is within a configurable window (default 7 days), force the grace_period tier regardless of the model's output. This hard rule prevents the model from misinterpreting transitional account states. Similarly, if subscription_status is cancelled or suspended, override the tier to freemium with a status_override reason. These application-level overrides should be logged distinctly from model classifications so you can measure how often the model gets transitional states wrong and improve the prompt or fine-tune accordingly. Before deploying, run a regression suite of at least 50 account scenarios covering standard paid, standard freemium, grace-period upgrades, grace-period downgrades, cancelled accounts, custom entitlements, and missing fields. Measure precision and recall per tier, and set a release gate at >98% accuracy on the golden set before routing real traffic.

IMPLEMENTATION TABLE

Expected Output Contract

Define the exact shape, types, and validation rules your application code should enforce on the model's response. This contract ensures the routing decision is machine-readable and safe to act on.

Field or ElementType or FormatRequiredValidation Rule

classification.tier

enum: freemium | paid | unknown

Must match one of the allowed enum values exactly. Reject any other string.

classification.confidence

number (0.0-1.0)

Must be a float between 0.0 and 1.0 inclusive. Reject if confidence < [MIN_CONFIDENCE_THRESHOLD].

classification.reasoning

string

Must be a non-empty string summarizing the key evidence used for the tier decision. Max 280 characters.

account.effective_tier

enum: freemium | paid | grace_period | trial

Must reflect the current operational tier, accounting for [GRACE_PERIOD_DAYS] and [TRIAL_STATUS].

account.account_id

string

Must match the [INPUT_ACCOUNT_ID] format. Reject if null or mismatched.

routing.target_queue

enum: standard | priority | sales_assist | self_service

Must be a valid queue derived from the tier. Reject if paid tier maps to standard queue.

routing.rate_limit_tier

string

Must be a valid rate limit key (e.g., 'tier_1', 'tier_2'). Reject if key is not found in [RATE_LIMIT_CONFIG].

warnings.flags

array of strings

If present, each string must be from the allowed warning catalog: ['downgrade_grace', 'trial_expiring', 'entitlement_gap']. Null allowed.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when routing based on freemium vs paid tiers and how to guard against it in production.

01

Stale Tier State After Upgrade or Downgrade

What to watch: The prompt routes based on a cached tier value that is hours old. A user who just upgraded gets blocked from paid features; a user who just downgraded retains access they shouldn't have. Guardrail: Require a fresh tier lookup from the billing system or auth token claims at decision time. Add a tier_last_verified_at field and reject routing decisions older than 60 seconds.

02

Grace Period Misrouting During Tier Transitions

What to watch: The prompt treats a downgrade as immediate, cutting off access during a contractual grace period. This generates support tickets and churn. Guardrail: Include a grace_period_ends_at field in the prompt context. Add explicit instructions: 'If the current time is before the grace period end, route as the previous tier.' Validate with test cases for mid-grace-period timestamps.

03

Trial Account Treated as Freemium

What to watch: The prompt conflates trial accounts with freemium accounts, routing trial users away from premium features they are entitled to evaluate. This breaks the conversion funnel. Guardrail: Add a distinct account_lifecycle_stage field with values trial, freemium, paid, grace_period. Include explicit routing rules for each stage. Test with trial accounts that have paid-tier feature flags enabled.

04

Missing or Null Account Metadata

What to watch: The prompt receives a null or missing tier field and either defaults to paid (over-entitlement) or freemium (blocking legitimate users). Both are dangerous. Guardrail: Define an explicit fallback behavior. Add a tier_confidence field. If tier is missing or confidence is low, route to a manual review queue or apply the most restrictive safe default. Log every fallback decision for audit.

05

Prompt Ignores Feature-Specific Entitlements

What to watch: The prompt makes a binary paid/free decision, but the product has per-feature entitlements. A paid user on a basic plan gets routed to an enterprise-only feature. Guardrail: Include a feature_entitlements map in the prompt context. Instruct the model to check the specific feature entitlement, not just the account tier. Add eval cases where tier is paid but the specific feature is not entitled.

06

Parent-Child Account Inheritance Not Resolved

What to watch: A child account inherits a paid tier from its parent, but the prompt only sees the child's own metadata and routes as freemium. Guardrail: Resolve the effective tier in the application layer before calling the prompt. Pass an effective_tier and tier_inheritance_chain field. The prompt should use the effective tier, not the direct tier. Test with multi-level account hierarchies.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Freemium vs Paid Tier Routing Prompt before shipping. Each criterion targets a known failure mode in tier classification and routing logic.

CriterionPass StandardFailure SignalTest Method

Tier Classification Accuracy

Correctly labels [ACCOUNT_METADATA] as freemium or paid in >= 98% of golden cases

Output tier does not match expected label in golden dataset

Run against 200 labeled account profiles spanning freemium, paid, trial, and grace-period states

Downgrade Grace Period Handling

Routes accounts with [DOWNGRADE_DATE] within grace window as paid tier

Immediately routes downgraded account as freemium before grace period expires

Inject 20 accounts with recent downgrade timestamps and verify tier assignment matches grace-period rules

Recently Upgraded Account Routing

Routes accounts upgraded within [UPGRADE_WINDOW_HOURS] to paid-tier features and support queues

Upgraded account still routed to freemium-only paths due to stale tier cache

Simulate 15 upgrade events and verify routing decision within 60 seconds of upgrade timestamp

Missing Account Metadata Fallback

Returns confidence score below [CONFIDENCE_THRESHOLD] and triggers human review when [ACCOUNT_METADATA] is null or empty

Confidently classifies account as freemium when no metadata is available

Send 30 requests with null, empty, or malformed account metadata and verify escalation flag is set

Output Schema Compliance

Response matches [OUTPUT_SCHEMA] with all required fields present and correctly typed

Missing tier_label, confidence_score, or routing_queue field in JSON output

Validate 100 responses against JSON Schema; fail if any required field is absent or wrong type

Rate Limit Enforcement Signal

Includes rate_limit_tier field matching the classified account tier

Paid account receives freemium rate limit or vice versa

Cross-reference 50 routing outputs against known account tiers and verify rate_limit_tier consistency

Ambiguous Tier Resolution

When account has conflicting tier signals, returns confidence_score below 0.85 and flags for review

Confidently picks one tier without acknowledging conflicting evidence

Inject 25 accounts with mixed freemium/paid signals and verify confidence_score < 0.85 and review_flag is true

Latency Budget Compliance

Completes classification and routing decision in under [MAX_LATENCY_MS] for 95th percentile

P95 latency exceeds budget during concurrent request simulation

Load test with 500 concurrent requests and measure P95 end-to-end classification latency

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a simple JSON schema. Use a small set of known account profiles in the [ACCOUNT_CONTEXT] field. Skip retry logic and log the raw classification output for manual review.

code
Classify the account tier for [ACCOUNT_CONTEXT] as "freemium" or "paid".
Return JSON: {"tier": "freemium"|"paid", "confidence": 0.0-1.0, "evidence": ["..."]}

Watch for

  • Missing schema checks causing downstream parse failures
  • Overly broad instructions that pick up irrelevant account fields
  • No handling for recently upgraded or downgraded accounts
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.