> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alana.shopping/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Engine

> Brand-aware AI content generation, enhancement, and chat.

## Overview

The Alana AI Engine is the intelligence layer behind product content operations. It generates, enhances, and refines product content while respecting your brand guidelines.

## Capabilities

### Chat (Canvas AI)

The `/ai/chat` endpoint powers the Canvas — an interactive AI assistant that understands your brand context and product catalog. It can:

* Answer questions about your products
* Suggest improvements to descriptions
* Generate content variations
* Analyze competitor positioning

The chat endpoint uses **RAG (Retrieval-Augmented Generation)** — it fetches relevant brand specs and product data before generating a response.

### Generate

The `/ai/generate` endpoint creates new content from scratch:

* Product descriptions
* SEO-optimized titles
* Feature bullet points
* Marketing copy

### Enhance

The `/ai/enhance` endpoint improves existing content:

* Fix grammar and spelling
* Improve readability
* Add missing keywords
* Align with brand tone

## How brand context works

```mermaid theme={null}
sequenceDiagram
    participant Client
    participant API
    participant BrandService
    participant AIEngine
    participant LLM

    Client->>API: POST /ai/generate (brandId, prompt)
    API->>BrandService: Load AI specs for brand
    BrandService-->>API: tone, keywords, policies
    API->>AIEngine: Build context-aware prompt
    AIEngine->>LLM: Generate with brand system prompt
    LLM-->>AIEngine: Generated content
    AIEngine-->>Client: Response with content
```

The AI engine automatically:

1. Retrieves brand AI specs (tone, keywords, policies)
2. Fetches relevant product context from the catalog
3. Builds a system prompt that incorporates all brand guidelines
4. Sends the enriched prompt to the LLM
5. Returns the generated content

## Model selection

The platform uses **LiteLLM** as an abstraction layer, supporting multiple LLM providers. Content generation requests are routed based on complexity and workspace plan limits.

<Info>
  AI credits are tracked per workspace. Check your usage at **Settings > Billing > Usage** or via the `/billing/usage` endpoint.
</Info>
