Connect → Vercel AI SDK
Use AxForge with the Vercel AI SDK
The Vercel AI SDK
(npm ai, Apache-2.0) is the de-facto standard TypeScript toolkit for
building with models. Point it at AxForge with its OpenAI-compatible provider and
the rest of your app — generateText, streamText, tools,
UI hooks — is unchanged.
Install & configure
$ npm i ai @ai-sdk/openai-compatible
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const axforge = createOpenAICompatible({
name: "axforge",
baseURL: "https://api.axforge.ai/v1",
apiKey: process.env.AXFORGE_API_KEY,
});
const { text } = await generateText({
model: axforge("chat"),
prompt: "Hello from Stockholm",
});
Streaming
import { streamText } from "ai";
const result = streamText({ model: axforge("chat"), prompt: "Count to five" });
for await (const delta of result.textStream) process.stdout.write(delta);
Embeddings
import { embed } from "ai";
const { embedding } = await embed({
model: axforge.textEmbeddingModel("embeddings"),
value: "a sentence to embed",
}); // 1024-dim
Prefer the OpenAI-compatible provider.
@ai-sdk/openai-compatible always calls
Chat Completions — the simplest,
most portable path. If you use @ai-sdk/openai instead, its default
openai('id') targets the
Responses API
(/v1/responses) — AxForge serves that too, but for the chat path call
openai.chat('id').
Model names
Pass chat / embeddings (stable role names) or an exact
version like qwen3.8-27b-nvfp4 — see
Models & pricing. Everything runs in the EU with
zero retention.