
Measure one task at a time
Breaking down AI usage into discrete tasks is the first step towards understanding and controlling costs. Each interaction with an AI model—whether classifying an email, searching a document database, summarising a report, or generating a final response—consumes tokens and incurs charges. These stages often differ in complexity and resource intensity. For example, a document search may require retrieving and embedding multiple passages, while a final response might simply stitch together summarised content. If you only track the cost of the final output, you risk missing where the real spend accumulates.
To address this, set up a ticket queue dedicated to AI usage analysis. Each ticket should represent a single task, capturing the number of tokens used at every stage and the corresponding cost. This granular approach highlights which steps are driving expenses. For instance, you might discover that document retrieval is responsible for the majority of token usage, not the model’s answer itself. This insight enables targeted optimisation—such as reducing the number of passages retrieved or summarising them earlier in the process.
Failure to measure at this level can lead to several issues. One common pitfall is assuming that the final model output represents the total cost, leading to underestimation and budget overruns. Another is the inability to pinpoint which workflow changes actually reduce spend. Good practice involves exporting detailed usage logs for each task, storing them in a central location, and reviewing them regularly. Avoid aggregating all usage into a single monthly figure, as this obscures the true cost drivers and hinders effective intervention.
Manage token growth in context windows
Token consumption does not scale linearly with the number of user queries. Context windows—where the model receives previous messages, retrieved documents, or system instructions—can quickly balloon in size, especially in chat-based applications. Each additional passage or message adds tokens, and costs rise accordingly. If left unchecked, this can result in unexpected spikes in monthly bills, particularly if users are encouraged to have long, ongoing conversations with the AI.
To mitigate this, configure your application to limit the context window to only approved passages. For example, use a dedicated VLAN to isolate the retrieval service, ensuring only sanctioned data sources are accessed. Implement logic to summarise repeated history, so that only the most relevant or recent exchanges are included. Where your provider allows, cache stable system instructions and reuse them across sessions, reducing redundant token usage. This can be set up as a scheduled backup job that refreshes instructions only when changes are detected.
Several failure modes can arise here. If you fail to limit context, you may see requests rejected for exceeding provider limits, or worse, silent truncation of important information. Another risk is that users manually copy large amounts of text into the system, bypassing your controls. Good practice is to set explicit alert thresholds for context size, triggering a ticket in your monitoring queue when limits are approached. Avoid letting context windows grow unchecked, and never assume that the provider will handle context management for you.
Set budgets and fallbacks
Cost control is not just about measurement—it requires active enforcement. Assigning budgets per user, tenant, or API key is a practical way to prevent runaway spend. For instance, you might set a monthly token quota for each department, tracked via a dedicated API usage ticket queue. When a quota is reached, the system should have a defined fallback: either deny further requests, degrade to a simpler model, or prompt the user to request an exception through a change window.
A common failure mode is silent escalation. If a request fails due to quota exhaustion, some systems automatically switch to a more expensive model or provider. This can lead to unexpected cost spikes and erode trust in your cost controls. Instead, configure explicit error handling—failed requests should log a ticket with details of the user, feature, and attempted model. This allows IT to investigate and decide whether to approve additional spend.
Monthly reviews are essential. Log usage by feature, not just by user, so you can identify which tools or prompts are underutilised. Remove those that are no longer needed, and compare the cost of each workflow with its task completion rate. Good cost control means retaining quality while minimising unnecessary spend. Avoid blanket quotas that do not account for differing user needs, and never allow the system to silently bypass your budget controls.
Monitor and audit feature-level usage
Visibility at the feature level is critical for ongoing AI cost management. Simply tracking aggregate spend does not reveal which features are driving usage. For example, a chatbot might offer summarisation, translation, and data extraction. Each of these should be logged separately, with a dedicated ticket queue for feature usage audits. This enables you to identify high-cost features and assess their value to the business.
To implement this, instrument your application to tag each API call with the feature name and user identifier. Export these logs daily and store them in a secure archive. Set up automated alerts for features that exceed predefined thresholds, such as a sudden spike in summarisation requests. This allows you to respond quickly to anomalous behaviour, such as a misconfigured integration or a user inadvertently triggering excessive usage.
Failure to monitor at this level can result in features being abused or misused without detection. For example, a data extraction tool might be repurposed for bulk processing, consuming far more tokens than intended. Good practice is to review feature-level usage monthly, comparing cost with business value. Remove or restrict features that do not justify their spend. Avoid relying solely on provider dashboards, as they may not offer the granularity required for effective auditing.
Optimise prompts and remove redundancy
Prompt design has a direct impact on token usage and, by extension, cost. Redundant or verbose prompts can inflate context windows and increase charges without improving output quality. For instance, repeating system instructions or including unnecessary background information in every request leads to wasted tokens. To address this, maintain a version-controlled repository of prompts, and review them regularly for efficiency.
Set up a change window for prompt updates, allowing IT and business stakeholders to approve changes before deployment. This ensures that prompt modifications are deliberate and documented. Use configuration exports to compare prompt versions and track their impact on token usage. After each change, monitor the relevant ticket queue for any increase in failed requests or cost anomalies.
Failure modes include prompt drift, where prompts become bloated over time as new requirements are added without removing outdated instructions. Another risk is accidental prompt duplication across features, leading to inconsistent behaviour and unnecessary spend. Good practice is to schedule periodic prompt audits, removing redundancy and consolidating similar instructions. Avoid making ad-hoc prompt changes without review, and never assume that longer prompts yield better results.
Implement staged rollouts and cost alerts
Introducing new AI features or models should be done in stages, with clear cost monitoring at each phase. A common approach is to roll out to a small group of users first, tracking their usage in a dedicated staging VLAN. Set up alert thresholds for token consumption, triggering tickets if costs exceed expectations. This allows you to catch issues early, such as a misconfigured prompt or an unexpectedly expensive model selection.
During each rollout stage, export configuration and usage data for review. Compare projected costs with actual spend, and adjust quotas or feature access as needed. If a failure occurs—such as a runaway process consuming excessive tokens—halt the rollout and investigate before proceeding. Document all incidents in a central ticket queue, including root cause analysis and remediation steps.
A frequent mistake is to move directly from pilot to full deployment without intermediate checks. This can result in widespread cost overruns or degraded service quality. Good practice is to maintain a rollback plan, allowing you to revert to a previous configuration if issues arise. Avoid deploying new features to all users simultaneously, and never ignore early warning signs from your monitoring system.
Review and maintain cost control artefacts
Cost control is an ongoing process, not a one-time setup. Artefacts such as ticket queues, VLAN configurations, prompt repositories, and usage logs must be maintained and reviewed regularly. Assign responsibility for each artefact to a specific team or individual, and document procedures for updating and auditing them.
Schedule monthly reviews of all cost control artefacts. For ticket queues, check that all incidents and anomalies have been resolved and closed. For VLANs, verify that only authorised services have access to AI endpoints. For prompt repositories, ensure that all changes have been approved and documented. For usage logs, archive older data and ensure that current logs are complete and accurate.
Failure to maintain these artefacts can lead to gaps in cost control, such as orphaned prompts, unauthorised access, or missing usage data. Good practice is to automate as much of the maintenance as possible, using scheduled backup jobs and configuration exports. Avoid treating cost control artefacts as set-and-forget; they require active management to remain effective.
Prepare for provider changes and outages
AI service providers may change pricing, modify API behaviour, or experience outages. These events can disrupt your cost control measures if you are not prepared. Set up alert thresholds for provider status changes, and maintain a ticket queue for tracking provider incidents. Document all dependencies on provider features, such as context window limits or caching capabilities.
When a provider announces a change, export your current configuration and usage data for impact analysis. Assess which workflows or features will be affected, and prepare fallback plans. For example, if a provider reduces the maximum context window, you may need to summarise more aggressively or limit certain features. If an outage occurs, trigger your change window to switch to a backup provider or degrade service gracefully.
A common failure mode is to rely on provider defaults, assuming that changes will not impact your workflows. This can result in unexpected cost increases or service disruptions. Good practice is to test fallback procedures regularly and keep documentation up to date. Avoid waiting until an incident occurs to review your provider dependencies; proactive preparation is key to maintaining cost control.
Starlink Nexus AI practice
If this reflects a problem you are dealing with, we can review your environment and tell you what we would change first - including if the answer is nothing.
Start a conversation