A Claude-based product recommendation assistant for your Turkish e-commerce sites: It understands customers’ natural-language queries such as “If it’s sunny in summer, I’m going to the beach; what can I buy for no more than 1,000 TRY?” and recommends real products from the catalog. Complete code + monthly cost estimate + VAT + strategy for TRY exchange-rate fluctuations.
Why Claude Haiku 4.5?
For “understand + format” tasks such as product recommendations, Claude Haiku 4.5 delivers about 85% of Sonnet 4.6’s quality at one-third the cost. At Kunavo prices:
- Haiku 4.5: input $0.40/1M, output $2.00/1M
- Sonnet 4.6: input $1.20/1M, output $6.00/1M
A 200-product catalog + customer query = ~3K input tokens; JSON response = ~200 output tokens. Cost per call: ~$0.0016 (about ₺0.06).
Working code
import json
from openai import OpenAI
client = OpenAI(
api_key="sk-kn-...",
base_url="https://api.kunavo.com/v1",
)
# Claude, json_schema tipindeki response_format'a uyar; json_object garanti edilmez.
ONERI = {
"type": "object",
"properties": {
"oneriler": {"type": "array", "items": {
"type": "object",
"properties": {"urun_id": {"type": "string"}, "neden": {"type": "string"}},
"required": ["urun_id", "neden"],
"additionalProperties": False,
}},
"toplam_oneri": {"type": "integer"},
},
"required": ["oneriler", "toplam_oneri"],
"additionalProperties": False,
}
def urun_oneri(kullanici_sorgusu: str, urun_katalogu: list[dict]) -> dict:
"""Müşterinin doğal dil sorgusuna göre 3-5 ürün önerir."""
katalog_metni = "\n".join(
f"- {u['id']}: {u['baslik']} | {u['kategori']} | {u['fiyat']} TL"
for u in urun_katalogu[:200]
)
resp = client.chat.completions.create(
model="claude-haiku-4-5", # Hızlı + ucuz, ürün önerisi için yeterli
messages=[
{
"role": "system",
"content": [
{
"type": "text",
"text": (
"Sen bir Türk e-ticaret asistanısın. "
"Türkçe doğal konuş, samimi ama saygılı. "
"Cevap formatı JSON: "
'{"oneriler": [{"urun_id": "...", "neden": "..."}, ...], '
'"toplam_oneri": int}'
),
"cache_control": {"type": "ephemeral"},
},
],
},
{
"role": "user",
"content": (
f"## Müşteri sorgusu\n{kullanici_sorgusu}\n\n"
f"## Mevcut katalog\n{katalog_metni}"
),
},
],
response_format={"type": "json_schema",
"json_schema": {"name": "oneri", "schema": ONERI}},
max_tokens=400,
)
return json.loads(resp.choices[0].message.content)We marked the system prompt with cache_control. When consecutive calls use the same prompt, Anthropic prompt caching kicks in and saves 90% of input costs.
Monthly cost projection
| Recommendations per day | Monthly USD | Approx. TRY |
|---|---|---|
| 1,000 | ~$48 | ~₺1,700 |
| 10,000 | ~$480 | ~₺17,000 |
| 100,000 | ~$4,800 | ~₺170,000 |
Comparison: running an e-commerce assistant with staff requires at least a support team working 2-3 shifts for 1,000+ recommendations per day (~₺120,000/month). AI saves 95% on costs.
A strategy for TRY exchange-rate fluctuations
Because Kunavo prices in USD, your costs rise as the TRY loses value. To soften the impact:
- Bulk top-up: Top-ups of $1,000+ unlock an extra 20% bonus credit (deposit $1,000, receive $1,200 in credit). Approximately 17% savings in USD terms, with an indirect exchange-rate buffer in TRY terms
- Always enable prompt caching — unlocks 70% in savings
- Haiku → Sonnet tiering: Handle simple queries with Haiku and complex queries with Sonnet. For an automatic decision maker, see the cost optimization guide
- Limit output: Cut output costs in half with max_tokens=300
Troubleshooting card issues
Most Turkish banks disable international online transactions by default. If Stripe checkout declines your card:
- Ask your bank to enable “international online card usage”
- Visa, Mastercard, American Express, and JCB are all supported
- Apple Pay may go through more smoothly; if Google Pay is set up in Chrome / Android, it can also be selected, but the card behind it must still be enabled for international transactions
KVKK compliance
If the customer's personal data (name, phone number, address) is present, mask it before sending it to the LLM. Stripe payment data is already covered by PCI-DSS and remains outside your systems. Kunavo does not provide a data processing agreement (DPA); requests are processed in the U.S. and forwarded to upstream model providers. If you need a DPA, contract directly with the model provider (Anthropic, OpenAI, or Google's enterprise terms).
Production checklist
- Review the first 100 recommendations manually, then automate once quality reaches ≥80%
- Set a daily spending limit through /app/keys (to prevent accidental spending spikes)
- Add fallback behavior for error payloads that tells users, “Sorry, I can’t make a recommendation right now”
- Track costs monthly in /app/usage, and set an alert for unexpected increases
To get started, sign up for free, top up from $10, and pay only for what you use. Full documentation at /docs/quickstart.