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

# Customer-Facing Chatbot

> How to configure Routor for a conversational chatbot with cost efficiency and reliable quality.

A conversational chatbot handles a wide range of user messages - greetings, simple FAQs, moderate questions, and occasional complex multi-turn conversations. Most messages are short and simple. Sending all of them to a frontier model wastes 70–80% of your LLM budget.

**Savings on this workload: typically 60–75% vs Claude Sonnet 4.6 baseline.**

***

## Recommended Profile Settings

| Setting      | Value           | Reason                                                                  |
| ------------ | --------------- | ----------------------------------------------------------------------- |
| Tier floor   | SIMPLE          | Handles greetings, short Q\&A - avoids NANO for public-facing responses |
| Tier ceiling | STANDARD        | Caps at Claude Sonnet 4.6 / GPT-5.4 for complex turns                   |
| Cost cap     | \$0.005/request | Avoids runaway costs on unexpectedly long conversations                 |
| Vision       | Off             | Unless users can send images                                            |
| Tool calling | Off             | Unless the bot calls APIs                                               |
| Tool quality | Any             | Only relevant if tool calling is on                                     |

***

## Step 1 - Create the profile

1. Go to **Playground → Configure**
2. Name it `Chatbot Production`
3. Set tier floor: **SIMPLE**, ceiling: **STANDARD**
4. Set cost cap: `$0.005`
5. Leave Vision and Tool calling unchecked
6. Click **Save & get API key**

***

## Step 2 - Use the profile key in your app

Replace your existing OpenAI key with the profile key from step 1.

### Node.js

```typescript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey:  "sk-routor-YOUR_PROFILE_KEY",
  baseURL: "https://api.routor.io/v1",
});

async function chat(history: { role: string; content: string }[]) {
  const response = await client.chat.completions.create({
    model:    "auto",
    messages: history,
    stream:   true,
  });

  for await (const chunk of response) {
    process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
  }
}

// Multi-turn example
await chat([
  { role: "system",    content: "You are a helpful customer support assistant for Acme Inc." },
  { role: "user",      content: "What are your business hours?" },
  { role: "assistant", content: "We're open Monday–Friday, 9am–6pm EST." },
  { role: "user",      content: "Can I get a refund on an order from last week?" },
]);
```

### Python

```python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="sk-routor-YOUR_PROFILE_KEY",
    base_url="https://api.routor.io/v1",
)

def chat(history: list[dict]) -> str:
    response = client.chat.completions.create(
        model="auto",
        messages=history,
    )
    return response.choices[0].message.content

history = [
    {"role": "system", "content": "You are a helpful customer support assistant for Acme Inc."},
    {"role": "user",   "content": "What are your business hours?"},
]

reply = chat(history)
history.append({"role": "assistant", "content": reply})
history.append({"role": "user", "content": "Can I get a refund on an order from last week?"})
reply = chat(history)
```

***

## Step 3 - Check routing decisions

After running a few messages, open **Dashboard → Overview** to see:

* Which tier each message routed to
* Cost per request
* Savings vs baseline

Simple greetings should route to SIMPLE. Refund questions and policy lookups should route to LIGHT or STANDARD. If you're seeing COMPLEX-tier routing on simple messages, raise the issue in [Troubleshooting](../troubleshooting) or test the specific prompt in the Playground.

***

## Streaming

For a better user experience, enable streaming to show responses word-by-word. Routor supports streaming identically to the OpenAI API.

```typescript theme={null}
const stream = await client.chat.completions.create({
  model:    "auto",
  messages: history,
  stream:   true,
});

for await (const chunk of stream) {
  const delta = chunk.choices[0]?.delta?.content;
  if (delta) process.stdout.write(delta);
}
```

***

## Cost estimate

On a chatbot handling 10,000 messages/day with a typical mix of short and medium messages:

| Scenario                              | Daily cost     |
| ------------------------------------- | -------------- |
| All requests to Claude Sonnet 4.6     | \~\$150        |
| With Routor (SIMPLE→STANDARD profile) | \~\$45–60      |
| Savings                               | \~\$90–105/day |

At scale this compounds significantly. A chatbot serving 1M messages/month can save \$2,000–3,000/month.

***

## Related

* [Create a routing profile](../playground/create-profile)
* [Understanding routing tiers](../tiers)
* [Fallback behavior](../fallback)
