Quickstart
In five minutes you'll have a bot answering questions from your own documents on a live web page.
You need:
- A ScaiGrid API key with
scaibot:bots:create (any tenant admin has this).
- A PDF, Markdown, or text document to feed the bot.
- A web page where you can paste an HTML snippet.
| export SCAIGRID_HOST="https://scaigrid.scailabs.ai"
export SCAIGRID_API_KEY="sgk_..."
|
1. Create the bot
1
2
3
4
5
6
7
8
9
10
11
12 | curl -X POST "$SCAIGRID_HOST/v1/modules/scaibot/bots" \
-H "Authorization: Bearer $SCAIGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Quickstart Bot",
"slug": "quickstart",
"model": "scailabs/poolnoodle-omni",
"display_name": "Helper",
"welcome_message": "Hi! Ask me anything about the handbook.",
"knowledge_enabled": true,
"knowledge_mode": "managed"
}'
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 | import httpx, os
bot = httpx.post(
f"{os.environ['SCAIGRID_HOST']}/v1/modules/scaibot/bots",
headers={"Authorization": f"Bearer {os.environ['SCAIGRID_API_KEY']}"},
json={
"name": "Quickstart Bot",
"slug": "quickstart",
"model": "scailabs/poolnoodle-omni",
"display_name": "Helper",
"welcome_message": "Hi! Ask me anything about the handbook.",
"knowledge_enabled": True,
"knowledge_mode": "managed",
},
).json()["data"]
print(bot["id"])
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 | const res = await fetch(`${process.env.SCAIGRID_HOST}/v1/modules/scaibot/bots`, {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SCAIGRID_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Quickstart Bot",
slug: "quickstart",
model: "scailabs/poolnoodle-omni",
display_name: "Helper",
welcome_message: "Hi! Ask me anything about the handbook.",
knowledge_enabled: true,
knowledge_mode: "managed",
}),
});
const { data: bot } = await res.json();
console.log(bot.id);
|
Save the returned bot.id — you'll need it for the embed.
2. Upload a document
| curl -X POST "$SCAIGRID_HOST/v1/modules/scaibot/bots/$BOT_ID/documents" \
-H "Authorization: Bearer $SCAIGRID_API_KEY" \
-F "file=@handbook.pdf" \
-F "name=Product Handbook"
|
Indexing is asynchronous. Poll the document until status: "indexed":
| curl "$SCAIGRID_HOST/v1/modules/scaibot/bots/$BOT_ID/documents/$DOC_ID" \
-H "Authorization: Bearer $SCAIGRID_API_KEY"
|
For a handful of pages, this completes in seconds.
3. Generate an embed token
| curl -X POST "$SCAIGRID_HOST/v1/modules/scaibot/bots/$BOT_ID/embed-token" \
-H "Authorization: Bearer $SCAIGRID_API_KEY"
|
You'll get back a short-lived token (~1 hour by default). For a production embed you'll typically generate fresh tokens server-side per visitor; for this quickstart, copy it once.
Paste into any page on your site:
| <script
src="https://scaigrid.scailabs.ai/static/modules/scaibot/widget.js"
data-bot-id="bot_abc123"
data-token="sbt_short_lived_token"
async>
</script>
|
Refresh. A floating chat bubble appears in the corner. Click it, ask a question from the handbook, watch the bot answer with a citation back to the document.
5. Inspect the conversation
Back in the API:
| curl "$SCAIGRID_HOST/v1/modules/scaibot/conversations?bot_id=$BOT_ID&limit=5" \
-H "Authorization: Bearer $SCAIGRID_API_KEY"
|
You'll see every chat session, with messages, latencies, token counts, and which knowledge chunks were retrieved.
What just happened
- The bot you created is a row in ScaiGrid's database with its config and a reference to a knowledge collection.
- Each PDF you uploaded was chunked into ~500-token slices, embedded with ScaiGrid's embedding model, and stored in ScaiMatrix.
- The widget's JavaScript opens an authenticated session with the bot's API, streams answers via Server-Sent Events, and persists the conversation id in a visitor cookie.
- Every chat call is metered by ScaiGrid's accounting pipeline against your tenant's budget.
Next
- Configure tone — formality, verbosity, vocabulary in scope.
- Add escalation rules so the bot hands off when it should.
- See the full embed tutorial for production-grade token issuance, custom styling, and authenticated visitors.