Clef · Try the live demo →

Vercel AI SDK with an OpenAI-compatible provider: use Heabsy

The AI SDK reaches OpenAI-compatible providers through @ai-sdk/openai-compatible. Create a provider with createOpenAICompatible({ name: 'heabsy', baseURL: 'https://api.heabsy.com/v1', apiKey }), set includeUsage: true to get token counts in streams, and pass heabsy('qwen38') as the model to generateText or streamText.

TypeScript
// npm install ai @ai-sdk/openai-compatible
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { generateText } from 'ai';

const heabsy = createOpenAICompatible({
  name: 'heabsy',
  baseURL: 'https://api.heabsy.com/v1',
  apiKey: process.env.HEABSY_API_KEY,
  includeUsage: true,
});

const { text, usage } = await generateText({
  model: heabsy('qwen38'),
  prompt: 'Say hello from Heabsy in five words.',
});
console.log(text, usage);
Create a Heabsy key OpenAI base URL https://api.heabsy.com/v1 · Anthropic base URL https://api.heabsy.com

Streaming and tools

streamText works with the same provider object, and includeUsage: true adds token counts to the end of the stream. Tools defined with tool() run on models with tool calling — every model in the table has it.

Keep the key on the server

Call Heabsy from a route handler or server action, not from the browser, so the key never reaches the client. Give each app its own key with a budget in the Heabsy console.

Which model should I pick?

Our own models run in the EEA and store no prompts — relevant when an app sends user data to the model. qwen38 for general work, glm53 for long inputs up to 1,048,576 tokens.

ModelIDContextMax outputInput / 1MOutput / 1M
Qwen3.8 27B Fableqwen38-fable512K32K$0.095$0.58
Qwen3.8 27B Queenqwen38-queen512K32K$0.095$0.58
GLM 5.3 Flash Uncensoredglm53-flash-unc1M128K$0.1739$0.6957
MiMo V2.6 Flash Uncensoredmimo-v26-flash-unc1M64K$0.4404$1.4285
MiMo V2.6 Flashmimo-v26-flash1M64K$0.4762$1.4286
MiMo V2.6 Flash Abliteratedmimo-v26-flash-abl1M64K$0.4762$1.4286
GLM 5.3glm531M128K$0.5217$0.9565
Qwen3.8 27B Uncensored Fast by Heabsyqwen38-unc-fast512K230K$0.7904$2.4952
Qwen3.8 27B Uncensoredqwen38-unc1M230K$0.8095$2.5238
Qwen3.8 27Bqwen38256K32K$1.00$3.00
GLM 5.3 Uncensoredglm-5.3-uncensored1M128K$1.1905$2.1429
CyberHeabsycyberheabsy1M64K$1.4286$4.2857

All models above run on Heabsy hardware in the EEA; prompts and completions are not stored. Thecatalog also lists 23 partner-hosted models — Claude, GPT-6, Kimi K3, DeepSeek V4 and others — with the same key and invoice, but without zero data retention and without an EEA guarantee.

Verify it works

Run the snippet: it prints the text and the usage object with input and output tokens. The request also appears in the Logs page of your console.

If the tool shows an error you cannot read, test the key on its own first — one short request outside the tool:

curl
curl https://api.heabsy.com/v1/chat/completions \
  -H "Authorization: Bearer $HEABSY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen38","max_tokens":16,"messages":[{"role":"user","content":"Say hi"}]}'

Troubleshooting

What you seeWhat to change
Usage is missing in streamsSet includeUsage: true in createOpenAICompatible.
404 Not FoundbaseURL must be https://api.heabsy.com/v1.
401 UnauthorizedThe key is wrong or revoked — copy it again from the console into HEABSY_API_KEY on the server.
403 with an HTML page ("Sorry, you have been blocked")No key was sent at all: the key variable is empty or not set where the tool runs. Requests without a key are stopped before they reach the API; a wrong key gets a JSON 401 instead.

Where do my prompts go?

From Vercel AI SDK straight to api.heabsy.com. On our own models the request is processed in the European Economic Area and the text is not stored — we keep what billing needs: the model, the token counts and the time. Partner-hosted models are processed by third-party inference providers; each is marked in the catalog, and none of them carries the no-retention promise. The terms are in the data processing agreement, the invoice comes from an EU company.

FAQ

Can I use the OpenAI provider package instead?+

The OpenAI package targets OpenAI's own API, including the Responses API that Heabsy does not serve. @ai-sdk/openai-compatible speaks Chat Completions, which is what Heabsy provides.

Does structured output work?+

Use tool calling or ask for JSON in the prompt and validate the result; support for strict JSON schemas varies by model.

Also set up:LangChain · n8n · Open WebUI

Vercel and the AI SDK are trademarks of Vercel, Inc.; Heabsy is not affiliated with Vercel.