← Integrations · SDKs & frameworks

Vercel AI SDK setup via the Kiree gateway

Connect the Vercel AI SDK to kiree.net: createOpenAICompatible({ baseURL: "https://kiree.net/v1", apiKey }) — generateText and streamText with catalog models.

Why the gateway

Why the direct setup does not cover every case

The AI SDK normally targets the OpenAI endpoint. The gateway exposes an OpenAI-compatible endpoint; create an openai-compatible provider with the baseURL and key, and run generateText/streamText with catalog models.

Setup

Steps to your first request

·

Get a key

Create a sk-… key in the kiree.net console.

·

Install packages

npm i ai @ai-sdk/openai-compatible: the SDK core and the OpenAI-compatible provider.

·

Create the provider

createOpenAICompatible({ name: "kiree", baseURL: "https://kiree.net/v1", apiKey }) and call generateText/streamText.

import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const kiree = createOpenAICompatible({
  name: "kiree", baseURL: "https://kiree.net/v1", apiKey: "sk-…"
});

For streaming: streamText with the same model. In a Next.js route handler, keep the key in environment variables, not in code.

Check: run the script or route handler: text comes from a gateway model, usage visible in the console.

Models

What to connect in Vercel AI SDK

Any text model from the catalog works on one key. Below are popular options to start.

Diagnostics

Common errors

!

401 Unauthorized

apiKey is wrong: check the environment variable and the key value.

!

APICallError / 404

baseURL lacks /v1 or the model ID is not from the catalog: use https://kiree.net/v1 and exact IDs.

!

Provider is not typed

Use @ai-sdk/openai-compatible, not @ai-sdk/openai: the latter is hard-bound to OpenAI.

FAQ

Frequently asked questions

How do I connect the Vercel AI SDK through the gateway?+

createOpenAICompatible with baseURL kiree.net goes to the gateway directly from Node/Next.js.

How are generations billed?+

Tokens are charged from the kiree.net balance; no subscription is required.

Does streaming work in the UI?+

Yes: streamText + useChat work through the gateway with no code changes.

Which models are available?+

Any catalog text model: gpt-4o-mini, gpt-6-astra, claude-sonnet-4-6 and others.

Get a key for Vercel AI SDK

Create a key in a couple of minutes; pay only for actual usage, no subscription required.