Static multi-page AI workspace with a vanilla Vercel Serverless Function. The OmniRoute key remains server-side and the browser receives an SSE stream from /api/chat.
- Import the project into Vercel.
- In Settings → Environment Variables, set
OMNIROUTE_API_KEY,OMNIROUTE_BASE_URL,NVIDIA_NIM_MODEL=nvidia/llama-3.3-nemotron-super-49b-v1.5,OMNIROUTE_PROVIDER_HINT=nvidia, and optionallyMAX_OUTPUT_TOKENS. - Deploy. Vercel serves the HTML files and invokes
api/chat.jsat/api/chat.
POST /api/chat accepts:
{
"messages": [{ "role": "user", "content": "Summarize this contract." }],
"max_output_tokens": 700,
"temperature": 0.2
}The function intentionally fixes model and X-Provider-Hint rather than accepting them from browsers. It caps message size and output tokens, requests usage in the final stream event, and propagates streaming bytes without buffering.
The gateway payload is OpenAI-chat compatible:
{
model: "nvidia/llama-3.3-nemotron-super-49b-v1.5",
messages,
stream: true,
stream_options: { include_usage: true },
max_tokens: 1024,
temperature: 0.2
}OmniRoute receives the server-only headers Authorization: Bearer <token> and X-Provider-Hint: nvidia.