Run Vercel AI SDK on Mingles Router
The AI SDK has a first-class package for OpenAI-compatible endpoints. It is the intended path, not a workaround.
Pick your model and paste your key — every command and value on this page updates live.
Endpoint: https://router.mingles.ai/v1 · key stays in your browser ·
no key entered? commands show <your-key>.
Wire it up
1. Install the provider package
npm i ai @ai-sdk/openai-compatible 2. Create the provider and call it
The name is only a label used to scope provider-specific options:
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const mingles = createOpenAICompatible({
name: "mingles",
baseURL: "https://router.mingles.ai/v1",
apiKey: process.env.MINGLES_API_KEY!,
});
const { text } = await generateText({
model: mingles("deepseek-ai/DeepSeek-V4-Flash-0731"),
prompt: "Write a haiku about routing.",
}); 3. Streaming in a route handler
Same provider, streamed — this is the shape most Next.js apps use:
import { streamText } from "ai";
export async function POST(req: Request) {
const { messages } = await req.json();
const result = streamText({ model: mingles("deepseek-ai/DeepSeek-V4-Flash-0731"), messages });
return result.toDataStreamResponse();
} Exact values
| baseURL | https://router.mingles.ai/v1 |
| apiKey | <your-key> |
| model id | deepseek-ai/DeepSeek-V4-Flash-0731 |
Switch model
Pass includeUsage: true to createOpenAICompatible if you want token counts back on streamed responses — they are omitted by default.
Before you file a bug: read the limits
Reasoning models spend the output budget on internal thinking, output is capped at 8192 tokens, there is no KV cache, and there are no built-in web tools. Most “it broke on Mingles Router” reports are one of these. See Model limits & behavior →
Frequently asked
Should I use @ai-sdk/openai instead? +
You can — createOpenAI also takes a baseURL. The openai-compatible package exists for exactly this case and makes no assumptions about OpenAI-only features, so it is the safer default for a third-party endpoint.
Do tool calls work? +
Yes — the SDK maps its tool definitions onto the chat-completions tools API, which is what we serve.