Documentation
Everything you need to add AI to your app with Behest AI.
Quickstart
TypeScript / JavaScript
npm install openaiimport OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.behest.ai/v1",
apiKey: "your-api-key",
defaultHeaders: {
"X-End-User-Id": userId,
},
});
const completion = await client.chat.completions.create({
model: "gemini-2.5-flash",
messages: [{ role: "user", content: userMessage }],
});
console.log(completion.choices[0].message.content);Python
pip install openaifrom openai import OpenAI
client = OpenAI(
base_url="https://api.behest.ai/v1",
api_key="your-api-key",
default_headers={
"X-End-User-Id": user_id,
},
)
completion = client.chat.completions.create(
model="gemini-2.5-flash",
messages=[{"role": "user", "content": user_message}],
)
print(completion.choices[0].message.content)cURL
POST /v1/chat/completionscurl -X POST https://api.behest.ai/v1/chat/completions \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-H "X-End-User-Id: user-12345" \
-d '{
"model": "gemini-2.5-flash",
"messages": [
{"role": "user", "content": "Summarize this document"}
]
}'API Reference
Chat Completions
POST /v1/chat/completions — request body, response format, headers, and streaming.
Authentication
Bearer tokens, API key generation, and Argon2id hashing.
Error Reference
HTTP status codes, error response format, and troubleshooting.
Models & Routing
GET /v1/models — available models and smart routing.
Guides
CORS from Browsers
Call Behest directly from React, Next.js, or any frontend. No backend proxy required.
PII Protection
Automatically scrub sensitive data before it reaches any LLM. Configure modes, actions, and per-entity settings.
Streaming Responses
Real-time streaming with Server-Sent Events. React, vanilla JS, and Python examples.
Add AI to Next.js
Server components, route handlers, and streaming — add Behest to your Next.js app.
Multi-Tenant Auth
Project keys, user tokens, and tenant isolation. Per-user rate limiting and token budgets.
Rate Limiting
5-layer rate limiting: project, user, IP, token budget, and aggregate. Graceful handling with headers.
SDKs & Tools
@behest/client-ts
behest
Python SDK for Behest. Async-first, type-safe, and compatible with the OpenAI Python SDK.
OpenAPI Spec
Full OpenAPI 3.1 specification for the Behest API. Import into Postman, Insomnia, or generate your own client.