Use Vercel AI SDK with Shannon
Create an OpenAI-compatible provider for Shannon with @ai-sdk/openai-compatible and use it in streamText, generateText and tools.
- Tested Nov 7, 2026
- OpenAI Chat Completions
- About 2 min
About Vercel AI SDK
The AI SDK is Vercel's TypeScript library for building AI features in Node.js, Next.js and other frameworks. It wraps providers behind one interface for text, streaming, tools and structured output. The @ai-sdk/openai-compatible package connects it to any OpenAI-compatible API, including Shannon.
What you need
- A Shannon API key
- Keys & usage
- Base URL
-
https://api.shannon-ai.com/v1Endpoint:/v1/chat/completions - Every snippet below follows your choice.
Set it up
-
Install the packages
Shellnpm install ai @ai-sdk/openai-compatible zod -
Create the provider and stream
namelabels the provider in errors and metadata;baseURLends in/v1.TypeScriptimport { createOpenAICompatible } from "@ai-sdk/openai-compatible"; import { streamText } from "ai"; const shannon = createOpenAICompatible({ name: "shannon", baseURL: "https://api.shannon-ai.com/v1", apiKey: process.env.SHANNON_API_KEY, }); const result = streamText({ model: shannon("Kimi-K3-uncensored-NVFP4"), prompt: "Name three colours a cat can be.", }); for await (const text of result.textStream) process.stdout.write(text); -
Call tools
TypeScriptimport { generateText, tool } from "ai"; import { z } from "zod"; const { toolCalls } = await generateText({ model: shannon("Kimi-K3-uncensored-NVFP4"), prompt: "What is the weather in Oslo?", tools: { getWeather: tool({ description: "Weather for a city", inputSchema: z.object({ city: z.string() }), }), }, }); console.log(toolCalls[0].input); // { city: "Oslo" }
Check that it works
Send: Run the streaming sample with SHANNON_API_KEY set.
You should see: The colours printed as they stream in.
Models that fit Vercel AI SDK
Every id below meets what Vercel AI SDK needs. The first one is the default in the snippets.
| Model id | Context window | Max output | Image input |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | Yes |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | Yes |
shannon-3 | 196,608 | 65,536 | Yes |
shannon-coder-1 | 131,072 | 65,536 | No |
Good to know
- Use
@ai-sdk/openai-compatible, the AI SDK's package for OpenAI-compatible APIs;@ai-sdk/openaiis built around OpenAI's own API and options. - Tool schemas use
inputSchemain current AI SDK versions (older guides showparameters).
Tips
- Add
executeto a tool and setstopWhento let the SDK run the tool and send the result back in the same call. shannon.chatModel(id)is the same asshannon(id);namealso prefixes provider-specific options.- Keep the key in
SHANNON_API_KEYand read it withprocess.env, never in client-side code.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
404 Not Found | baseURL lacks /v1. | Use https://api.shannon-ai.com/v1. |
toolCalls is empty | The model answered in text. | Use a model with tool calls from the picker, or set toolChoice: "required". |
401 Unauthorized | The key is missing, mistyped or rotated. | Copy the key again from Keys & usage; it starts with sk-. |
context_length_exceeded / "prompt is too long" | The conversation is longer than the model's window. | Start a new chat, let the tool compact it, or pick a model with a larger window. |
insufficient_quota | Your balance cannot pay for the request. | Top up or change plan; the request is not retried by itself. |
Questions
Does the Vercel AI SDK work with Shannon?
Yes, through createOpenAICompatible with baseURL: "https://api.shannon-ai.com/v1".
Can I use it in Next.js route handlers?
Yes; create the provider on the server and stream the result to the browser.