Add AI to Your App in 5 Minutes
Get your API key, make your first call, and ship AI features. No backend required.
Prerequisites
- A Behest AI account (free, sign up at behest.ai/dashboard — no credit card required)
- Any HTTP client — fetch, axios, requests, curl, or your language of choice
1Get Your API Key
- Sign up at behest.ai/dashboard
- Create a new project
- Configure your allowed CORS origins (e.g.,
http://localhost:3000for local development) - Copy your project API key
Your project URL will look like https://your-project.behest.app
2Make Your First API Call
Two headers to attribute every request
Behest groups token usage and cost by X-End-User-Id (the end user) and X-Session-Id (the conversation thread). Set both on every request so your dashboard can show per-user and per-session spend instead of one aggregate bucket.
Use any unique identifier for X-Session-Id — typically a chat session ID or a user-{userId}-conv-{conversationId} pair. The header is optional, but skipping it collapses every request into a single “no session” bucket in your analytics.
JavaScript (fetch)
const response = await fetch(
"https://your-project.behest.app/v1/chat/completions",
{
method: "POST",
headers: {
"Authorization": "Bearer your-api-key",
"Content-Type": "application/json",
"X-End-User-Id": userId,
// Uniquely identifies a conversation thread for per-session cost attribution.
"X-Session-Id": `user-${userId}-conv-${conversationId}`,
},
body: JSON.stringify({
model: "gemini-2.5-flash",
messages: [
{ role: "user", content: "Summarize this contract" }
],
}),
}
);
const data = await response.json();
console.log(data.choices[0].message.content);Python (requests)
import requests
response = requests.post(
"https://your-project.behest.app/v1/chat/completions",
headers={
"Authorization": "Bearer your-api-key",
"Content-Type": "application/json",
"X-End-User-Id": user_id,
# Uniquely identifies a conversation thread for per-session cost attribution.
"X-Session-Id": f"user-{user_id}-conv-{conversation_id}",
},
json={
"model": "gemini-2.5-flash",
"messages": [
{"role": "user", "content": "Summarize this contract"}
],
},
)
data = response.json()
print(data["choices"][0]["message"]["content"])curl
# X-Session-Id uniquely identifies a conversation thread for
# per-session cost attribution in your analytics dashboard.
curl -X POST https://your-project.behest.app/v1/chat/completions \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-H "X-End-User-Id: user-123" \
-H "X-Session-Id: user-123-conv-abc" \
-d '{
"model": "gemini-2.5-flash",
"messages": [
{"role": "user", "content": "Summarize this contract"}
]
}'3What Happens Automatically
When you make that API call, Behest handles everything behind the scenes:
Next Steps
API Reference
Full endpoint documentation, request/response schemas, and error codes.
CORS Guide
How Behest handles CORS so you can call your LLM from the browser.
Add AI to React
Complete React component example with state management and streaming.
Add AI to Next.js
Server Component and Client Component patterns for Next.js apps.
Multi-Tenant Auth
JWT, API keys, tenant isolation, and per-user rate limiting.
PII Protection
Configure PII Shield modes, actions, and per-entity settings.