A Next.js demo application showcasing Respan tracing, API workflows, and gateway-backed model calls with the Vercel AI SDK.
- APIs: Interactive examples for Respan logs, traces, users, threads, datasets, prompts, experiments, and gateway requests.
- Examples: End-to-end use cases such as banking support, SEC compliance review, lead qualification, prompt optimization, customer tracking, and multi-tenant service desk workflows.
This demo routes model calls through the Respan gateway. Vercel does not need an OPENAI_API_KEY for the included examples.
The server routes use the OpenAI-compatible Vercel AI SDK provider with Respan credentials. Requests resolve credentials in this order: the UI-provided x-respan-api-key header first, then RESPAN_API_KEY from Vercel/.env.local.
const apiKey = getRespanApiKey(req); // x-respan-api-key first, then RESPAN_API_KEY
createOpenAI({
apiKey,
baseURL: getRespanGatewayBaseUrl(),
});Docs: Respan documentation overview
- Node.js 20+
- Yarn 1.x
- Respan API key from platform.respan.ai
yarn installThis project uses traditional
node_modulesfor Turbopack compatibility.
Create a .env.local file in this repo root:
# Respan gateway + tracing
RESPAN_API_KEY=your_respan_api_key_here
RESPAN_BASE_URL=https://api.respan.aiRESPAN_BASE_URL is optional when you use https://api.respan.ai, but setting it explicitly keeps local and Vercel environments clear.
yarn devOpen http://localhost:3000 and choose an API section or example card.
- Create or link a Vercel project from this repo root.
- In Vercel Project Settings -> Environment Variables, add:
RESPAN_API_KEYRESPAN_BASE_URLset tohttps://api.respan.aiunless you use a custom Respan endpoint
- Deploy.
Do not add OPENAI_API_KEY for the included gateway-backed demo routes. The routes call models through https://api.respan.ai/api using RESPAN_API_KEY.
The UI has an API keys (optional) panel:
- Keys are not persisted; refreshing the page clears them.
- A pasted Respan key is sent per request via the
x-respan-api-keyheader and takes precedence over the server env var. - If
RESPAN_API_KEYis set in Vercel or.env.local, routes can run without a pasted UI key.
For production or shared demos, prefer Vercel env vars and keep the UI field empty unless you intentionally want to test a different key.
- Never commit secrets. This repo ignores
.env*via.gitignore. - UI key inputs are convenient for demos, but they still send secrets to your deployed server. Treat them as sensitive.
app/
api/
respan/ # Respan API proxy routes used by the API explorer
banking-chatbot/ # Gateway-backed example route
customer-tracking/ # Gateway-backed example route
sec-compliance/ # Gateway-backed example route
warmly-lead-qualification/
atomicworks/
prompt-optimizer/
apis/ # API explorer UI
examples/ # Example showcase UI
instrumentation.ts # Respan tracing setup