---
name: tasteray-business-api
description: Integrate TasteRay Business - Recommendation API (explainable multi-vertical catalog ranking, single-item fit explanations, keyless demo smoke tests, remote Streamable-HTTP MCP at https://api.tasteray.com/mcp) or the TasteRay ForMe PDP verdict widget into a codebase.
---

# TasteRay Business - Recommendation API Skill

Use this skill when a developer asks to add personalized recommendations, explainable catalog ranking, mood-based discovery rows, or an "Is this for me?" product-page verdict to their application or storefront.

- **Product name:** TasteRay Business - Recommendation API
- **Base URL:** `https://api.tasteray.com`
- **Remote MCP (Streamable HTTP, `2025-03-26`):** `https://api.tasteray.com/mcp`
- **Local stdio MCP (`@tasteray/business-mcp`):** `npx -y github:tasteray/business-mcp` (https://github.com/tasteray/business-mcp)
- **AI Catalog:** `https://api.tasteray.com/.well-known/ai-catalog.json`
- **OpenAPI 3.1:** `https://api.tasteray.com/openapi.json`
- **Full API Reference (Markdown):** `https://api.tasteray.com/docs.md` (also `https://api.tasteray.com/llms.txt`)
- **AI Assistant Guide:** `https://api.tasteray.com/ai-assistant-guide.md`
- **Runnable Examples & Benchmark:** https://github.com/tasteray/business-api-examples
- **ForMe PDP Widget Skill:** `https://forme.tasteray.com/SKILL.md`

## Step 1: Inspect the developer's repository

Before writing code, inspect the codebase to determine:

1. **Runtime & framework:** TypeScript/Node/Cloudflare Workers/Next.js/Astro, Python (FastAPI/Django), Ruby/Rails, Go, Shopify Liquid, WooCommerce PHP, or static HTML.
2. **Backend boundary:** Locate server routes, Server Actions, API handlers, or Worker endpoints where secrets are read (`process.env`, `c.env`, `os.environ`). Never place `TASTERAY_API_KEY` in browser bundles or mobile binaries.
3. **Catalog source:** Find where products, titles, SKUs, inventory flags, region/entitlement filters, and item metadata live so you can pre-filter candidates before calling the API.
4. **UI surface:** Check whether the user needs server-ranked recommendation rows/search results, single-item fit explanations, or only a drop-in product-page "Is this for me?" button.

## Step 2: Choose the right integration path

| Need | Integration path | Auth & key |
|---|---|---|
| Rank your own candidate catalog or generate 1–10 picks with `why_match`, `key_factors`, `potential_concerns`, `confidence` | `POST https://api.tasteray.com/v1/recommend` (server-to-server) | `X-API-Key: reco_live_...` |
| Explain why one specific item fits or does not fit a buyer/viewer (with `alternatives`) | `POST https://api.tasteray.com/v1/explain` (server-to-server) | `X-API-Key: reco_live_...` |
| Smoke-test payload shapes before requesting a key (clamped: `fast: true`, `grounding: false`, `count <= 3`) | `POST https://api.tasteray.com/v1/demo/recommend`, `POST /v1/demo/explain`, `POST /v1/demo/discover` | None (IP-limited: 5/min, 25/day) |
| Drop-in **"Is this for me?"** conversational verdict button on product/title pages (no backend proxy) | **TasteRay ForMe** widget (`https://forme.tasteray.com/widget.js`) — follow `https://forme.tasteray.com/SKILL.md` | None (free up to 1,000 checks/domain/mo) |
| Call tools live from an IDE/agent during development or generate validated ForMe snippets | Remote Streamable-HTTP MCP at `https://api.tasteray.com/mcp` (or stdio `npx -y github:tasteray/business-mcp`) | Optional (`X-API-Key` or `Authorization: Bearer`; keyless demo fallback) |

## Step 3: Pricing & tier facts (quote accurately)

- **Free:** `$0`, **1,000 req/month**, **5 req/min**, all verticals, community support. Get a self-serve key immediately at **https://api.tasteray.com/generate-key** (keys start with `reco_live_`).
- **Basic:** `$49/mo`, **10,000 req/month**, **50 req/min**, all verticals, email support.
- **Pro:** `$199/mo`, **100,000 req/month**, **200 req/min**, usage analytics, priority support.
- **Enterprise:** Custom pricing — custom AI trained on your content, white-label, SLA & dedicated support, analytics, custom limits (`hello@tasteray.com`).
- No training data is required to start on any tier.

## Step 4: Architecture invariants (do not violate)

1. **Server-to-server only.** Read `TASTERAY_API_KEY` from server environment variables and send it in `X-API-Key`. Never ship it to clients.
2. **Use plain HTTP (`fetch`, `httpx`, `curl`).** TasteRay does not publish an npm or PyPI REST SDK — do not hallucinate `@tasteray/sdk` or `tasteray-python`.
3. **Stateless per request.** Send `vertical` plus `context.preferences` (non-empty string array) and/or `context.profile` (non-empty text) on every request, with optional `context.constraints`, `context.history` (max 50 items), or `context.history_text`.
4. **Candidate ranking vs. open discovery.** Pass `items: [{ id, name, description?, metadata? }]` when ranking inventory you control. Pre-filter out-of-stock, regional, or already-seen items first. The API returns only IDs from your submitted `items` list, so handle responses with fewer than `options.count` results.
5. **Design for LLM latency.** Use `options: { fast: true, grounding: false }` on interactive UI paths (~2–5 s); cache results per user/mood or precompute discovery rows off the hot path.
6. **Handle rate limits accurately.** `X-RateLimit-Reset` is a **Unix timestamp in milliseconds** (not seconds). On HTTP `429`, compute wait time as `Math.max(0, Number(res.headers.get('X-RateLimit-Reset')) - Date.now())` or honor `Retry-After`. Log `meta.request_id` for support tracing.

## Step 5: Connect the remote MCP server (optional)

Any MCP client supporting Streamable HTTP (`2025-03-26`) can connect directly without installing a local binary:

```json
{
  "mcpServers": {
    "tasteray-business": {
      "type": "http",
      "url": "https://api.tasteray.com/mcp",
      "headers": {
        "X-API-Key": "${TASTERAY_API_KEY}"
      }
    }
  }
}
```

Omit `headers` to run keyless against `/v1/demo/*` and `generate_forme_widget_snippet`.

## Step 6: Verify live before finishing

Run a live keyless smoke test against `POST /v1/demo/recommend` and verify your integration tests pass:

```bash
curl -sS -X POST https://api.tasteray.com/v1/demo/recommend \
  -H "Content-Type: application/json" \
  -d '{
    "vertical": "movies",
    "context": {
      "profile": "Tired after a long week. Want something absorbing and humane, not loud action."
    },
    "items": [
      { "id": "cat-1", "name": "Past Lives" },
      { "id": "cat-2", "name": "Arrival" },
      { "id": "cat-3", "name": "Perfect Days" }
    ],
    "options": { "count": 3, "fast": true, "grounding": false }
  }'
```

Verify also against keyless catalog mood discovery (`POST /v1/demo/discover`):

```bash
curl -sS -X POST https://api.tasteray.com/v1/demo/discover \
  -H "Content-Type: application/json" \
  -d '{
    "catalog": "Past Lives\nArrival\nPerfect Days\nMad Max: Fury Road",
    "theme": "Quiet, humane cinema for a late Sunday evening"
  }'
```

### Verification checklist

- [ ] Smoke test returns HTTP `200` with `recommendations[].item.id` drawn strictly from sent `items`.
- [ ] Every returned item has non-empty `explanation.why_match`, `explanation.key_factors`, and `confidence` in `[0, 1]`.
- [ ] Unit test in the developer's repo asserts `X-API-Key` is sent only from server code, handles fewer than `count` results cleanly, and backs off on HTTP `429` using millisecond `X-RateLimit-Reset`.
