Skip to content
Vercel AI SDK

Frameworks and SDKs

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/v1 Endpoint: /v1/chat/completions
Every snippet below follows your choice.

Set it up

  1. Install the packages

    Shell
    npm install ai @ai-sdk/openai-compatible zod
  2. Create the provider and stream

    name labels the provider in errors and metadata; baseURL ends in /v1.

    TypeScript
    import { 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);
  3. Call tools

    TypeScript
    import { 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 idContext windowMax outputImage 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/openai is built around OpenAI's own API and options.
  • Tool schemas use inputSchema in current AI SDK versions (older guides show parameters).

Tips

  1. Add execute to a tool and set stopWhen to let the SDK run the tool and send the result back in the same call.
  2. shannon.chatModel(id) is the same as shannon(id); name also prefixes provider-specific options.
  3. Keep the key in SHANNON_API_KEY and read it with process.env, never in client-side code.

Troubleshooting

SymptomCauseFix
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.

Choose your language

All languages are equal. Pick the one you want to browse in.

Europe

Middle East & North Africa

South Asia

Southeast Asia

East Asia

Central Asia & Caucasus

Africa

Oceania

Constructed & Classical