Documentation Index
Fetch the complete documentation index at: https://mintlify.com/gcsconsultores/gcs-website/llms.txt
Use this file to discover all available pages before exploring further.
/api/sally is a Next.js Route Handler that accepts a conversation history and streams AI responses back to the browser. It runs on the Node.js runtime using the Vercel AI SDK’s streamText helper and routes requests through the Vercel AI Gateway to Google Gemini 3 Flash — no additional Google Cloud credentials are required in Vercel or v0 environments.
Endpoint overview
| Property | Value |
|---|---|
| Method | POST |
| Path | /api/sally |
| Runtime | Node.js (default Next.js runtime) |
| maxDuration | 30 seconds |
| Model | google/gemini-3-flash via Vercel AI Gateway |
Request
The endpoint expects a JSON body containing the full conversation history as managed by the AI SDK client.Body parameters
Array of conversation messages in the
UIMessage format produced by the Vercel AI SDK’s useChat hook. Each message carries id, role ("user" or "assistant"), and a parts array rather than a flat content string. The route handler converts these to model messages internally via convertToModelMessages.Response
A successful request returns a Server-Sent Events stream (text/event-stream) in the Vercel AI SDK’s UI message stream format, produced by result.toUIMessageStreamResponse(). The client-side useChat hook consumes this stream transparently.
Status codes
| Status | Meaning |
|---|---|
200 | Streaming response — AI SDK SSE format |
500 | Internal error — JSON body with a Spanish error message |
Error response body (500)
Route handler source
Integration with the SallyChat client component
TheSallyChat floating widget (components/sally/sally-chat.tsx) connects to this route using the AI SDK’s useChat hook with a DefaultChatTransport. No custom fetch logic is required — the transport handles serialisation, streaming, and state management automatically.
sendMessage({ text: value }) and the status field transitions through "idle" → "submitted" → "streaming" → "idle", letting the UI show a loading spinner while the model responds.
Model and system prompt constants
Two module-level constants control Sally’s behaviour. Both are defined at the top ofapp/api/sally/route.ts.
Customizing Sally’s behaviour
Switch the underlying model
Change
SALLY_MODEL to any model identifier supported by the Vercel AI Gateway. When GCS has a fine-tuned Gemini checkpoint, update this constant to point at the custom model endpoint — no other code changes are needed.Edit Sally's personality and rules
SALLY_SYSTEM_PROMPT is a plain template literal. Edit the PERSONALIDAD, TU MISIÓN, SERVICIOS, or REGLAS sections to change what Sally knows, how she speaks, or which actions she should encourage.The Vercel AI Gateway handles Google authentication zero-config in Vercel and v0 environments. No
GOOGLE_API_KEY environment variable is required when deploying to Vercel — the Gateway resolves credentials automatically.