Skip to content
pcreative Commerce

Connect AI and give it a spending cap

The store works without AI.

The store works without AI. What AI adds is what needs writing or reasoning: drafting product copy, understanding what a customer asks in plain language, answering in chat, summarising reviews.

The key is yours and so is the bill. The system ships with the brakes on, but you pay for the calls.

1. Choose a provider and set its key

In the backend .env, only the one for the provider you are going to use:

ANTHROPIC_API_KEY=sk-ant-...
# or OPENAI_API_KEY, GOOGLE_API_KEY, MISTRAL_API_KEY, OPENROUTER_API_KEY
# for search only: VOYAGE_API_KEY or COHERE_API_KEY

Restart the backend. The key never leaves the server: it is not stored in the database and does not travel to the browser.

ProviderKeyNotes
AnthropicANTHROPIC_API_KEYHas no embedding model
OpenAIOPENAI_API_KEYWorks for chat and for meaning-based search
GoogleGOOGLE_API_KEY
MistralMISTRAL_API_KEY
OpenRouterOPENROUTER_API_KEYAccess to models from several providers with one key
OllamanoneOn your own machine. No cost, and no data leaves
Voyage AIVOYAGE_API_KEYSearch only (embeddings)
CohereCOHERE_API_KEYSearch only (embeddings)

For meaning-based search you need embeddings, and not every provider has them: OpenAI, Google, Mistral, OpenRouter, Voyage AI and Cohere do; Anthropic does not. Voyage AI and Cohere are for search only: they do not write. You can use one for chat and another for embeddings.

2. Choose it in the panel

Panel → AI. You will see which keys the server found, and you can choose a provider and model for each job. It is stored in the store, not the .env, so changing it does not require a restart.

Press Try chat: it makes a real call to the provider and shows you the model's reply. If it fails, the message comes from the provider, not made up.

3. Set the spending cap

The default is €5 a day, resetting each day.

That cap matters more than it looks. Search and chat are public: anyone who visits your site uses them, and each use calls a paid provider. A normal limiter counts requests, not money — and someone who wants to hurt you stays under the request limit using the most expensive calls.

There are two separate brakes here:

  • Per visitor: how many times per minute each one can call.
  • Per daily spend: how many euros the store has run up, wherever it comes from.

The second is the one that really protects, because it measures the thing you want to protect.

Hitting the cap breaks nothing: search keeps working on keywords, and the chat says it cannot answer right now and points to your contact page so a person can answer.

The per-visitor brake on search does not block either: over 20 searches a minute, that visitor's searches fall back to keywords.

4. Check what you are spending

Panel → AI → Spend. Calls, cost and failures over the last 30 days, broken down by task. The costs are an estimate worked out from a price table of models. A model that is not in that table counts as €0, so it shows no spend and does not add to the daily cap: if you use one, keep an eye on the provider's own bill.

If you set no key at all

The store works just the same:

  • Keyword and fuzzy search (it rescues typos and "600W" against "600 W")
  • Product pages, reviews, panel alerts
  • Chat answers that it cannot right now, and points to your contact page

What turns off is what requires a model: writing, summarising, understanding natural language, and the panel copilot.

See also