Skip to main content
Build a complete streaming chat application using Next.js and the Vercel AI SDK, powered by General Compute’s fast inference. Clone the full example project:

1. Install dependencies

2. Create the API route

The Vercel AI SDK has an @ai-sdk/openai-compatible provider that works with any OpenAI-compatible API — including General Compute.
app/api/chat/route.ts
We’re using minimax-m2.7 here — our best general-purpose model with 160k context at an unbeatable price. Swap it for deepseek-v3.2 if you need stronger reasoning. See all models on the Models & Pricing page.

3. Create the chat UI

The useChat hook from @ai-sdk/react handles message state and streaming. You manage input state yourself and call sendMessage() to send messages.
app/page.tsx

4. Add your API key

Create a .env.local file in your project root:
.env.local

5. Run it

Open http://localhost:3000 and start chatting. Responses stream in token-by-token.

Next steps

  • Swap minimax-m2.7 for deepseek-v3.2 to try reasoning capabilities
  • Add system prompts by prepending to the messages array in the API route
  • Deploy to Vercel with vercel deploy — just add GENERALCOMPUTE_API_KEY to your environment variables