SDK
Vercel AI SDK
Streams, tools, agents. On Melious.
One `createOpenAICompatible` call with our base URL. Streaming, structured output, tool calls, agents: the SDK primitives that hit Chat Completions all work unchanged.
TypeScript
import { createOpenAICompatible } from class="s">'@ai-sdk/openai-compatible';
import { streamText } from class="s">'ai';
const melious = createOpenAICompatible({
name: class="s">'melious',
baseURL: class="s">'https:class="c">//api.melious.ai/v1',
apiKey: process.env.MELIOUS_API_KEY,
});
const result = streamText({
model: melious(class="s">'<MODEL_ID>'),
prompt: class="s">'Name three Hanseatic cities.',
});What is Vercel AI SDK?
How to use Vercel AI SDK with Melious?
-
Install and configure
Install the SDK and drop your API key in
.env.local. The compatible provider always speaks Chat Completions, which is what Melious serves.Shellnpm install ai @ai-sdk/openai-compatible zod echo "MELIOUS_API_KEY=sk-mel-<YOUR_API_KEY>" >> .env.local -
Create a Melious provider
One
createOpenAICompatiblecall with the Melious base URL gets you a provider object. Export it. Every file in your app reuses it.TypeScriptimport { createOpenAICompatible } from class="s">'@ai-sdk/openai-compatible'; export const melious = createOpenAICompatible({ name: class="s">'melious', baseURL: class="s">'https:class="c">//api.melious.ai/v1', apiKey: process.env.MELIOUS_API_KEY, }); -
Stream text and tools
All SDK primitives accept the Melious provider. Streaming, tools, and structured outputs work without custom middleware.
TypeScriptimport { streamText } from class="s">'ai'; import { melious } from class="s">'./melious'; const result = streamText({ model: melious(class="s">'<MODEL_ID>'), prompt: class="s">'Summarize the GDPR in one paragraph.', }); for await (const chunk of result.textStream) { process.stdout.write(chunk); }
Ready?
Three steps from here.
Grab a Melious key. Pick your tool. Follow the guide. Same client, now answering from Europe.