Per-token prices are falling faster than almost any other IT cost item: across capability thresholds, Epoch AI measures a decline of 50x per year at the median (Epoch AI). Even so, a third of German companies running AI report costs significantly above expectations: 33% (Bitkom). The contradiction dissolves once you break the bill apart. Cost is not driven by the price per token but by context length, output length and call frequency. Anyone moving AI features for online shops from prototype to production therefore needs a cost model that exists before go-live.

Understanding the cost model: input, output, context

Language models are billed per token, separately for input and output. One token corresponds to roughly three to four characters of running text. Two properties of this billing model matter for your calculation: output tokens cost a multiple of input tokens across the common model classes, typically around five times as much (project experience). And input covers not just the current question but the entire context you send along: system instruction, product data, conversation history, attached documents.

From this follows the single most important sentence in this article: context length is the main cost driver, not answer quality. An assistant that ships 8,000 tokens of catalogue excerpt with every message costs ten times that context across ten messages, even though the catalogue has not changed in between. The API is stateless: every call carries the full history again, and every repetition is billed again.

The quiet multiplier

A ten-message advisory dialogue with 6,000 tokens of context each does not process 6,000 but roughly 60,000 input tokens, because the history grows with it. This effect is exactly why prototypes look cheap and production surprises people. The pattern is familiar from shop caching layers: anyone who has tuned Redis caching for shop performance already knows it from front-end work.

Cost driverEffect on the billMost effective lever
Context length per calllinear, repeated on every calltrim context, prompt caching
Output lengthhigh price per tokencap output format and length
Call frequencymultiplies everything elsepre-filters, result caching
Model choicefactor between classesmodel routing per task
Repeated bulk runsmass runs at peak timesbatch processing

This structure dictates the right control metric. A monthly invoice tells you something was expensive but not why. The robust figure is cost per interaction: per generated product text, per chat answer, per classified ticket. Only that figure can be set against a benefit, and only it makes forecasting possible as volume grows.

Why the bill grows while prices fall

Epoch AI observes price declines between 9x and 900x per year (Epoch AI), depending on the performance threshold. For models released after January 2024 the median rises from 50x to 200x per year (Epoch AI). If your bill still grows, context, output length and call volume are growing faster than the price falls. That is an architecture question, not a procurement question.

Cost per use case instead of interpreting a monthly invoice

A shop rarely runs one AI feature; usually it runs four to six. They differ by orders of magnitude in cost and benefit, yet disappear behind a single number on the combined invoice. The first step towards cost control is therefore mundane and still rarely taken: calculate every feature separately, with tokens per operation and expected volume.

Generating a product text

Long context (attributes, category, tone of voice), long output, low frequency. The most expensive single operation, but easy to plan. Details in the article on AI-generated product descriptions.

Chat answer in an advisory dialogue

Medium context, short output, high and volatile frequency. The riskiest item, because the volume is set from outside. See also AI chatbots in e-commerce.

Alt text for product images

Image plus short context, very short output, high frequency in bursts. A classic case for bulk processing, as described in the article on AI alt text for product images.

Classifying a support ticket

Short context, minimal output, high frequency. The cheapest operation and the one most likely to work without a large model. Context in the article on AI-supported ticket automation.

Benefit belongs next to cost, expressed as contribution margin rather than gut feeling. For product text generation the calculation is usually clear: editorial time saved per item can be valued at an internal hourly rate. For advisory dialogue it gets fuzzier but not impossible: comparing the share of sessions with chat contact and their order rate against a control group gives a workable approximation. The same reasoning carries profitability and margin work in e-commerce.

That this calculation is still rarely done properly shows on the impact side. According to the enterprise survey analysed by Stanford HAI, organisations report the largest cost savings in software engineering and manufacturing at 56% each (Stanford HAI, AI Index 2026), while revenue effects are most often cited for marketing and sales at 67% (Stanford HAI, AI Index 2026) and for product development at 62% (Stanford HAI, AI Index 2026). At enterprise level, however, only 39% (McKinsey) of respondents report a measurable EBIT effect, and roughly 6% (McKinsey) attribute more than five percent of EBIT to AI use.

An AI feature without a cost per operation is an experiment. That number is what turns it into a product you can scale or switch off.

XICTRON development team

Seven levers that actually reduce the bill

The following seven measures differ in impact, but in this order they take effect fastest. The order matters because the first three are purely technical and need no business sign-off, whereas the last four require decisions about behaviour and quality.

  1. Prompt caching for recurring context. System instruction, legal texts, shipping rules and catalogue excerpts typically do not change between two calls. Cached as a prefix, they are billed at a fraction of the input price on the next call.
  2. Result caching for identical requests. The same question against the same data produces the same answer. A cache key built from a normalised question plus data version intercepts a substantial share of requests before any model is called.
  3. Batch processing for bulk runs. Alt texts, category texts or data enrichment are not time-critical. Asynchronous bulk processing is billed considerably lower than real-time individual calls, in the order of half the price at the common providers.
  4. Model routing per task. Classification, extraction and short decisions do not need a large model. A small model for structured tasks and a large one only for free text reduces the bill without a noticeable quality drop at the customer-facing surface.
  5. Trim context instead of attaching the catalogue. Rather than shipping 200 products, a semantic product search supplies the five relevant ones. This is the lever with the best effort-to-effect ratio.
  6. Pre-filters against pointless calls. Empty inputs, duplicates within seconds, obvious bot patterns and requests outside the intended scope should be rejected before the model call, not after it.
  7. Cap output length. A hard token limit plus a validated output schema prevents sprawling answers. Because output tokens are the most expensive, this measure has a disproportionate effect.

Prompt caching deserves a closer look, because the mechanics are often misunderstood. What gets cached is a prefix, meaning the beginning of the request in exactly the same byte sequence. If anything ahead of it changes, everything after it drops out of the cache. A timestamp injected into the system instruction, an unsorted JSON serialisation or a per-user tool set is enough to push the hit rate to zero. Stable content first, volatile content last is the rule.

The economics of the cache

The first write into the cache costs more than a normal input token; reading costs considerably less. With a short cache lifetime this pays off from the second call with the same prefix onwards, with a long lifetime from the third (project experience). For a shop that means: caching pays where the same context is needed several times within minutes, so in dialogue and in bulk runs with a shared preamble. Verify the hit rate in the usage statistics of the response, not by gut feeling.

Batch processing is the most frequently overlooked lever because it requires a change in the workflow. Bulk runs belong in a queue, not in the shop's request cycle. The discount matters less than the side effect: bulk runs are predictable, interruptible and can be capped with a quota. Robust asynchronous processing is the same discipline that carries Shopware performance work in general.

Sequence beats perfection

In practice the first three levers deliver the larger share of the savings, because they can be implemented without business sign-off. Only afterwards is it worth discussing which model is good enough for which task. Working the other way round means negotiating quality for weeks while the easy savings sit untouched. Structured data enrichment benefits from all seven levers at once.

Budget governance: caps, cost centres, alerts

Technical levers lower the price per operation. They do not protect against the number of operations rising unexpectedly. That is what governance is for, and at its core it is unspectacular: every AI feature gets its own cap, its own cost centre and its own alert.

  • Cap per feature, not per account. A daily and a monthly cap per feature prevents a runaway bulk run from consuming the customer dialogue's budget.
  • Carry a cost centre per feature. Every model call is logged with feature identifier, model, input, output and cache tokens. Without that attribution, later optimisation is guesswork.
  • Alert on outliers instead of a monthly report. Two thresholds work well: an absolute one (daily budget 80 percent consumed) and a relative one (cost per operation deviates by more than a third from the mean).
  • A kill path without a deployment. Every AI feature needs a configuration switch that disables it within minutes or reroutes it to a cheaper model.
  • Define the degradation step. What happens when the cap is reached? An error message, classic search, a contact form or a queue are four defensible answers; a silent failure is not.
  • Cost in the definition of done. An AI feature counts as finished only once cost per operation, cap, cost centre and degradation step are documented.

The most common mistake is a cap without a defined reaction. When the budget bites and the feature then breaks off without comment, support cases arise whose handling costs more than the inference saved. The degradation step therefore belongs in the business requirement, not in a technical footnote. For recurring workflows the same principle applies as in any other process automation: the exception belongs in the design.

Forecast instead of surprise

Model three scenarios before go-live: expected volume, peak load (campaign days, season) and misuse (duplicate calls from a faulty client). The third figure is the one that typically surprises operators, because it does not appear in business planning. It is also the one a cap actually protects against.

Abuse protection for public AI endpoints

An AI endpoint any visitor can call without signing in is, from an attacker's perspective, free compute. Running it unprotected means paying for someone else's inference. The attack needs no sophistication: a script calling the chat endpoint ten thousand times overnight produces a bill that blows the monthly plan without triggering anything in classic security monitoring.

  • Rate limit per IP and per session, with different thresholds: a short one (calls per minute) and a long one (calls per hour and day).
  • Session quota instead of a pure frequency brake. An advisory dialogue rarely needs more than around twenty answers. A hard quota per session limits the damage even when frequency stays inconspicuous.
  • Cap input length. A field without a length limit invites flooding the context with foreign text and multiplying the cost per call.
  • Verify origin. Same-origin checks, short-lived tokens and a server-side proxy prevent the endpoint from being used out of third-party applications.
  • Log cost per session. Being able to see the most expensive sessions of a day surfaces abuse patterns typically within hours rather than at month end.
  • Limit anonymous use, treat signed-in use more generously. This gradation protects the budget without slowing genuine customers down.
Cost risk and security risk are connected

The same open endpoint that causes cost is also the entry point for manipulated input. Rate limit and quota therefore belong in the same layer as the guardrails described in the article on prompt injection in AI features. An endpoint that can be abused cheaply can as a rule also be abused substantively.

Make or buy: when self-hosting becomes financially interesting

As soon as the bill becomes visible, the self-hosting question arrives. It is legitimate but usually asked too early and argued with the wrong numbers. The comparison is not API price against server price, but API invoice against the fully loaded cost of a permanently operated model.

CriterionModel via interfaceSelf-hosted
Cost profilevariable, scales with usagelargely fixed, independent of usage
Set-up effortlow, dayshigh, weeks to months
Utilisation risknone, you pay for usageidle capacity costs in full
Model changeconfiguration changere-provisioning and testing
Data sovereigntyto be settled contractuallyentirely in house
Operating effortmonitoring and budgetsplus capacity, updates, on-call

Self-hosting becomes financially interesting only when two conditions hold at once: the monthly interface invoice clearly exceeds the fully loaded cost of permanently reserved accelerator capacity, and utilisation sits stably above roughly 40 percent (project experience). Below that threshold you are paying for idle time. For most mid-sized shops this argues clearly against self-hosting the language model, while smaller specialist models for classification or embeddings can run sensibly in your own hosting.

The same fixed costs are regularly overlooked: on-call outside business hours, model and driver maintenance, headroom for load peaks, a second site for resilience, and the staff effort for quality comparisons at every model change. Adding these positions to the calculation usually pushes the break-even considerably higher. Sober architecture consulting saves more here than any price negotiation.

The pragmatic middle ground

In practice a mixed set-up often works well: small, clearly bounded tasks such as classification, speech recognition or embeddings run in house, while free-text generation and dialogue run via the interface. This split lowers the variable bill where volume is high and the task is narrow, without bringing the operating load for the demanding cases into your own team.

Worked example: a mid-sized shop

To close, a worked example. The starting point is a shop with around 45,000 sessions a month, roughly 18,000 items and four AI features in operation. All values are example values based on typical volume structures; they are meant to show the calculation grid, not to replace your own figures.

FeatureVolume per monthBaselineAfter optimisation
Chat answer in advisory dialogue12,0000.80 ct = EUR 960.30 ct = EUR 36
Product text (new or changed)2,5003.20 ct = EUR 801.40 ct = EUR 35
Alt text for product images6,0000.60 ct = EUR 360.18 ct = EUR 11
Support ticket classification4,0000.25 ct = EUR 100.05 ct = EUR 2
Total24,500 operationsEUR 222EUR 84

The saving amounts to roughly 62 percent, without switching off a feature or changing answer quality at the customer-facing surface. It comes from the sum of the levers: prompt caching of the shared preamble in dialogue, a result cache for recurring questions, batch runs for alt texts and product texts, a small model for ticket classification, and a leaner context through semantic pre-selection instead of a catalogue excerpt.

The second figure is more interesting than the saving. Without a rate limit and session quota, a single automated access to the public chat endpoint can trigger 40,000 additional answers overnight. At the baseline price that would be EUR 320 in a single day, more than the entire planned monthly bill. In this calculation, abuse protection is therefore not the last item on the list but the one with the largest single effect on risk.

What follows from the calculation

At EUR 84 a month for 24,500 AI operations, the cost question is settled and the benefit question moves to the front. That is exactly the goal: get AI cost under control far enough that the discussion returns to impact rather than the invoice. Survey data suggests the impact exists: 77% (Bitkom) of AI-using companies see their competitive position improved, and 52% (Bitkom) report a measurable contribution to business success.

Build AI features with cost control from day one

Adoption has made this a mainstream question. 41% (Bitkom) of German companies with 20 or more employees already use AI, up from 17% (Bitkom) a year earlier, and a further 48% (Bitkom) are planning or discussing it. Internationally, the share of organisations using AI in at least one business function stands at 88% (Stanford HAI, AI Index 2026) after 78% (Stanford HAI, AI Index 2026) the year before, and at 91% (Stanford HAI, AI Index 2026) in Europe. Anyone building an AI feature today builds it into an environment where competitors use the same technology. The difference does not come from access but from economics.

The good news: cost control is not a retrofit project but a design decision. A caching layer, a model router, cost logging per feature and a cap with a defined degradation step together form a manageable building block when they are planned from the start. Retrofitted into a grown integration, the same components cost a multiple, because prompt assembly, data access and error handling have to be re-cut.

XICTRON develops AI features for online shops with exactly this set-up: prompt and result caching as a dedicated layer, model routing per task, batch paths for bulk runs, budget caps with a degradation step per feature, and reporting that makes cost per operation and per feature visible. That way the economics of an AI feature are settled before go-live rather than with the first invoice.

Sources and studies

This article draws on data from: Bitkom, study report Artificial Intelligence in Germany 2026 (bitkom.org, representative survey of 604 companies with 20 or more employees, March 2026), Stanford HAI, AI Index Report 2026, Chapter 4 Economy (hai.stanford.edu/ai-index), Epoch AI, LLM inference price trends (epoch.ai) and McKinsey, The State of AI (Global Survey) (mckinsey.com). Figures marked (project experience) are experience values from our own projects. The figures quoted may vary depending on survey date, sample and model generation; the worked example uses example values and does not replace your own calculation.

Frequently asked questions

Because volume and call frequency usually grow faster than the price falls. Epoch AI measures price declines of 50x per year at the median (Epoch AI), and 200x per year for models released after January 2024 (Epoch AI). If your context per call grows longer, more features go live and usage rises, the volume effect overtakes the price effect. Typically a per-operation calculation therefore helps more than a price negotiation.

In most projects, prompt caching of recurring context combined with a result cache for identical requests. Both can be implemented purely technically and need no business agreement on quality. Only afterwards is it worth discussing model routing, because that touches quality expectations. The actual effect depends on the share of recurring context in your particular use case.

A sensible combination is a rate limit per IP and session, a hard quota of answers per session, a cap on input length, and an origin check via same-origin plus short-lived tokens. In addition, cost per session should be logged so outliers are typically noticed within hours rather than with the monthly invoice. Complete security cannot be achieved this way, but the damage can be limited considerably.

Financially, only once the monthly interface invoice clearly exceeds the fully loaded cost of permanently reserved accelerator capacity and utilisation sits stably above roughly 40 percent (project experience). Fully loaded cost includes on-call, model maintenance, headroom for load peaks and the effort for quality comparisons at every change. For small, narrowly defined tasks such as classification or embeddings the threshold is typically reached earlier than for free-text generation.

Through contribution margin per operation rather than overall impressions. For text generation, editorial time saved can be valued at an internal hourly rate; for dialogue features a comparison of order rates between sessions with and without contact works well. Survey data suggests the impact is real but unevenly distributed: 39% (McKinsey) of companies report a measurable EBIT effect, and around 6% (McKinsey) attribute more than five percent of EBIT to AI.

In principle yes, though as a rule with considerably more effort than designing for it up front. Retrofitting usually means re-cutting prompt assembly, data access and error handling so that caching, routing and caps can take effect at all. A staged approach works well: first introduce cost logging per feature, then caching, then routing. An assessment of your specific set-up can usually be given on the basis of the existing integration and codebase.