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.',
});
About

What is Vercel AI SDK?

The Vercel AI SDK is a framework-agnostic TypeScript toolkit for AI apps. Primitives like streamText, generateObject, and embed, plus React/Svelte/Vue hooks for building chat UIs. Providers are pluggable via base URL: create one Melious provider and the Chat Completions primitives work unchanged.

Visit the official site ai-sdk.dev
Setup

How to use Vercel AI SDK with Melious?

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

    Shell
    npm install ai @ai-sdk/openai-compatible zod
    echo "MELIOUS_API_KEY=sk-mel-<YOUR_API_KEY>" >> .env.local
  2. Create a Melious provider

    One createOpenAICompatible call with the Melious base URL gets you a provider object. Export it. Every file in your app reuses it.

    TypeScript
    import { 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,
    });
  3. Stream text and tools

    All SDK primitives accept the Melious provider. Streaming, tools, and structured outputs work without custom middleware.

    TypeScript
    import { 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.