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

# How it Works

> Set up API tokens and AI Configuration, assign them to a user, then ask Spree AI in chat.

Spree AI only works after it is allowed to reach BillSpree and an AI Configuration is assigned to the user. Setup comes first; chat comes after.

## 1. Scope an API token

Create an API token and choose which BillSpree actions Spree AI may use (for example **Retrieve Bills** or **Agent Chat**). The token acts as that user for the permissions you select.

<Frame>
  <img src="https://mintcdn.com/spreesuite/v8x_9X2QAbokl4c7/images/spree-ai/generate-token.png?fit=max&auto=format&n=v8x_9X2QAbokl4c7&q=85&s=9e3b747290de4704c84b7a5e1a256e35" alt="Generate API token with permissions" width="904" height="848" data-path="images/spree-ai/generate-token.png" />
</Frame>

## 2. Confirm the key in API Keys

After you generate the token, it appears under **API Keys** in BillSpree. Spree AI uses this key when it looks up billing data.

<Frame>
  <img src="https://mintcdn.com/spreesuite/v8x_9X2QAbokl4c7/images/spree-ai/api-keys.png?fit=max&auto=format&n=v8x_9X2QAbokl4c7&q=85&s=ad747d967729926ccb7b7948dad8e927" alt="BillSpree API Keys" width="1024" height="595" data-path="images/spree-ai/api-keys.png" />
</Frame>

## 3. Create an AI Configuration

Open **Spree AI** setup and add a configuration: provider, model, provider key, and the BillSpree API token. Set the configuration to **Active**.

<Frame>
  <img src="https://mintcdn.com/spreesuite/v8x_9X2QAbokl4c7/images/spree-ai/ai-configuration.png?fit=max&auto=format&n=v8x_9X2QAbokl4c7&q=85&s=7168d4c6b50a6e932cabe72116588f5f" alt="Spree AI Configuration list" width="1024" height="535" data-path="images/spree-ai/ai-configuration.png" />
</Frame>

## 4. Assign the configuration to a user

On the user account, set **Spree AI Configuration** to the active configuration that employee should use.

<Frame>
  <img src="https://mintcdn.com/spreesuite/v8x_9X2QAbokl4c7/images/spree-ai/assign-configuration.png?fit=max&auto=format&n=v8x_9X2QAbokl4c7&q=85&s=22bc6480a6dfd50aad147964c0211080" alt="Assign Spree AI Configuration on user account" width="1024" height="565" data-path="images/spree-ai/assign-configuration.png" />
</Frame>

## 5. Ask in chat

When an active configuration is assigned, the Spree AI robot opens in SpreeSuite. Ask in product language — Spree AI matches the question to billing data the token is allowed to see, then replies in chat.

For example questions, see [What You Can Ask](/spree-ai/what-you-can-ask).
